From 057a1f0a00a918f1e0cb9d4e6d5afc82c683ddfa Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 24 Jun 2009 12:54:39 +0200 Subject: [PATCH] Bug #568302 - create camel summary table if not exists on load --- camel/camel-folder-summary.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 571c72d..1bc1fff 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -1088,6 +1088,7 @@ camel_folder_summary_load_from_db (CamelFolderSummary *s, CamelException *ex) CamelDB *cdb; gchar *folder_name; gint ret = 0; + CamelException ex2; struct _CamelFolderSummaryPrivate *p = _PRIVATE(s); /* struct _db_pass_data data; */ @@ -1102,7 +1103,20 @@ camel_folder_summary_load_from_db (CamelFolderSummary *s, CamelException *ex) folder_name = s->folder->full_name; cdb = s->folder->parent_store->cdb_r; - ret = camel_db_get_folder_uids_flags (cdb, folder_name, s->sort_by, s->collate, s->uids, p->flag_cache, ex); + camel_exception_init (&ex2); + + ret = camel_db_get_folder_uids_flags (cdb, folder_name, s->sort_by, s->collate, s->uids, p->flag_cache, &ex2); + + if (camel_exception_is_set (&ex2) && camel_exception_get_description (&ex2) && + strstr (camel_exception_get_description (&ex2), "no such table") != NULL) { + /* create table the first time it is accessed and missing */ + ret = camel_db_prepare_message_info_table (cdb, folder_name, ex); + } else if (ex) { + camel_exception_xfer (ex, &ex2); + } + + camel_exception_clear (&ex2); + /* camel_folder_summary_dump (s); */ #if 0 -- 2.7.4