[glom] MySQL: Do not try to insert image examples.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] MySQL: Do not try to insert image examples.
- Date: Fri, 11 Jan 2013 15:35:13 +0000 (UTC)
commit 4835879d1ba3017bf59c95f2f30cc8a6a058e2db
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Jan 5 15:01:41 2013 +0100
MySQL: Do not try to insert image examples.
glom/libglom/db_utils.cc | 15 ++++++++++++++-
.../test_selfhosting_new_from_example_operator.cc | 7 +++++++
2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index a46b5c5..0a768d9 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -1588,7 +1588,7 @@ bool insert_example_data(Document* document, const Glib::ustring& table_name)
//Get field names:
- Document::type_vec_fields vec_fields = document->get_table_fields(table_name);
+ const Document::type_vec_fields vec_fields = document->get_table_fields(table_name);
//Actually insert the data:
//std::cout << "debug: " << G_STRFUNC << ": number of rows of data: " << vec_rows.size() << std::endl;
@@ -1606,6 +1606,8 @@ bool insert_example_data(Document* document, const Glib::ustring& table_name)
//std::cout << "DEBUG: row_data size = " << row_data.size() << ", (fields size= " << vec_fields.size() << " )" << std::endl;
+ const Document::HostingMode hosting_mode = document->get_hosting_mode();
+
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_INSERT);
builder->set_table(table_name);
for(unsigned int i = 0; i < row_data.size(); ++i) //TODO_Performance: Avoid calling size() so much.
@@ -1619,6 +1621,17 @@ bool insert_example_data(Document* document, const Glib::ustring& table_name)
break;
}
+ if(field->get_glom_type() == Field::TYPE_IMAGE)
+ {
+ if((hosting_mode == Document::HOSTING_MODE_MYSQL_CENTRAL) ||
+ (hosting_mode == Document::HOSTING_MODE_MYSQL_SELF))
+ {
+ //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=691099
+ std::cerr << G_STRFUNC << ": Skipping Image field because libgda does not support it for MySQL." << std::endl;
+ break;
+ }
+ }
+
builder->add_field_value(field->get_name(), row_data[i]);
}
diff --git a/tests/test_selfhosting_new_from_example_operator.cc b/tests/test_selfhosting_new_from_example_operator.cc
index c603fc5..d68114f 100644
--- a/tests/test_selfhosting_new_from_example_operator.cc
+++ b/tests/test_selfhosting_new_from_example_operator.cc
@@ -68,6 +68,13 @@ static bool test(Glom::Document::HostingMode hosting_mode)
return false;
}
+ //TODO_MySQL: Implement groups/users code.
+ if(hosting_mode == Glom::Document::HOSTING_MODE_MYSQL_SELF)
+ {
+ test_selfhosting_cleanup(false /* do not delete the file. */);
+ return true;
+ }
+
//Add an operator user:
const Glib::ustring operator_group_name = "personnel_department";
const Glom::DbUtils::type_vec_strings group_list =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]