[evolution-data-server/cursor-staging: 4/30] EBookBackendSqliteDB: introspect summary structure before adding columns.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/cursor-staging: 4/30] EBookBackendSqliteDB: introspect summary structure before adding columns.
- Date: Mon, 14 Oct 2013 19:09:18 +0000 (UTC)
commit e771b17cae9af84d12764ed3e337d840644989c5
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Sat Oct 12 20:54:55 2013 +0200
EBookBackendSqliteDB: introspect summary structure before adding columns.
Some additional auxilary columns need to be added in upgrades, these
columns which need to be added depend on which contact fields are
in the summary. This patch ensures that the summary is properly
introspected before adding columns, so that the right columns are added.
.../libedata-book/e-book-backend-sqlitedb.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c
b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 0898786..d20ec3f 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -891,7 +891,7 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
GError **error)
{
gint i;
- gboolean success;
+ gboolean success = TRUE;
gchar *stmt, *tmp;
GString *string;
gboolean already_exists = FALSE;
@@ -900,6 +900,14 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
if (!success)
return FALSE;
+ /* Introspect the summary if the table already exists */
+ if (already_exists) {
+ success = introspect_summary (ebsdb, folderid, error);
+
+ if (!success)
+ return FALSE;
+ }
+
string = g_string_new (
"CREATE TABLE IF NOT EXISTS %Q ( uid TEXT PRIMARY KEY, ");
@@ -982,10 +990,6 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
g_free (tmp);
}
- /* Dont introspect the summary if the table did not yet exist */
- if (success && already_exists)
- success = introspect_summary (ebsdb, folderid, error);
-
/* Create indexes on the summary fields configured for indexing */
for (i = 0; success && i < ebsdb->priv->n_summary_fields; i++) {
if ((ebsdb->priv->summary_fields[i].index & INDEX_PREFIX) != 0 &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]