evolution-data-server r9119 - branches/camel-db-summary/camel
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9119 - branches/camel-db-summary/camel
- Date: Mon, 14 Jul 2008 13:50:21 +0000 (UTC)
Author: psankar
Date: Mon Jul 14 13:50:21 2008
New Revision: 9119
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9119&view=rev
Log:
system flag and user flag should be searchable simulataneously
Add new columns to store system flags like msg_type and msg_security
Modified:
branches/camel-db-summary/camel/camel-db.c
branches/camel-db-summary/camel/camel-db.h
branches/camel-db-summary/camel/camel-folder-search.c
Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c (original)
+++ branches/camel-db-summary/camel/camel-db.c Mon Jul 14 13:50:21 2008
@@ -628,13 +628,16 @@
{
int ret;
char *table_creation_query, *safe_index;
-
- table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS %Q ( uid TEXT PRIMARY KEY , flags INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT )", folder_name);
+
+ /* README: It is possible to compress all system flags into a single column and use just as userflags but that makes querying for other applications difficult an d bloats the parsing code. Instead, it is better to bloat the tables. Sqlite should have some optimizations for sparse columns etc. */
+
+ table_creation_query = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS %Q ( uid TEXT PRIMARY KEY , flags INTEGER , msg_type INTEGER , read INTEGER , deleted INTEGER , replied INTEGER , important INTEGER , junk INTEGER , attachment INTEGER , msg_security INTEGER , size INTEGER , dsent NUMERIC , dreceived NUMERIC , subject TEXT , mail_from TEXT , mail_to TEXT , mail_cc TEXT , mlist TEXT , followup_flag TEXT , followup_completed_on TEXT , followup_due_by TEXT , part TEXT , labels TEXT , usertags TEXT , cinfo TEXT , bdata TEXT )", folder_name);
ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
sqlite3_free (table_creation_query);
+ /* FIXME: sqlize folder_name before you create the index */
safe_index = g_strdup_printf("SINDEX-%s", folder_name);
table_creation_query = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS %Q ON %Q (uid, flags, size, dsent, dreceived, subject, mail_from, mail_to, mail_cc, mlist, part, labels, usertags, cinfo)", safe_index, folder_name);
ret = camel_db_add_to_transaction (cdb, table_creation_query, ex);
@@ -651,10 +654,10 @@
char *del_query;
char *ins_query;
- ins_query = sqlite3_mprintf ("INSERT INTO %Q VALUES (%Q, %d, %d, %d, %d, %d, %d, %d, %d, %ld, %ld, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q )",
+ ins_query = sqlite3_mprintf ("INSERT INTO %Q VALUES (%Q, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %ld, %ld, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q )",
folder_name, record->uid, record->flags,
- record->read, record->deleted, record->replied,
- record->important, record->junk, record->attachment,
+ record->msg_type, record->read, record->deleted, record->replied,
+ record->important, record->junk, record->attachment, record->msg_security,
record->size, record->dsent, record->dreceived,
record->subject, record->from, record->to,
record->cc, record->mlist, record->followup_flag,
@@ -933,7 +936,9 @@
return g_strdup ("mail_to");
else {
/* Let it crash for all unknown columns for now.
- We need to load the messages into memory and search etc. */
+ We need to load the messages into memory and search etc.
+ We should extend this for camel-folder-search system flags search as well
+ otherwise, search-for-signed-messages will not work etc.*/
return g_strdup ("");
}
Modified: branches/camel-db-summary/camel/camel-db.h
==============================================================================
--- branches/camel-db-summary/camel/camel-db.h (original)
+++ branches/camel-db-summary/camel/camel-db.h Mon Jul 14 13:50:21 2008
@@ -46,6 +46,8 @@
typedef struct _CamelMIRecord {
char *uid;
guint32 flags;
+ guint32 msg_type;
+ guint32 msg_security;
gboolean read;
gboolean deleted;
gboolean replied;
Modified: branches/camel-db-summary/camel/camel-folder-search.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-search.c (original)
+++ branches/camel-db-summary/camel/camel-folder-search.c Mon Jul 14 13:50:21 2008
@@ -501,8 +501,8 @@
goto fail;
}
- r(printf ("\nsexp is : [%s]\n", expr));
- r(printf ("Something is returned in the top-level caller : [%s]\n", search->query->str));
+ printf ("\nsexp is : [%s]\n", expr);
+ printf ("Something is returned in the top-level caller : [%s]\n", search->query->str);
matches = g_ptr_array_new();
cdb = (CamelDB *) (search->folder->cdb);
@@ -1335,6 +1335,7 @@
} else {
if (f->operators) {
g_string_append_printf (search->query, " %s labels LIKE %s", (char *) (g_slist_nth_data (f->operators, 0)), value);
+ f->operators = g_slist_remove_link (f->operators, g_slist_nth (f->operators, 0));
} else {
g_string_append_printf (search->query, " OR labels LIKE %s", value);
}
@@ -1344,7 +1345,7 @@
camel_db_free_sqlized_string (value);
}
} else
- g_warning ("Makes no sense to search for multiple things in user flag. A flag is either set or not that's all");
+ g_warning ("Makes no sense to search for multiple things in user flag. A flag is either set or not that's all: [%d]", argc);
r = e_sexp_result_new(f, ESEXP_RES_BOOL);
r->value.bool = FALSE;
@@ -1368,13 +1369,16 @@
r = e_sexp_result_new(f, ESEXP_RES_BOOL);
r->value.bool = truth;
} else {
+ /* FIXME: You need to complete the camel-db.c:camel_db_get_column_name function and use those return values */
char * value = argv[0]->value.string;
if (g_str_has_suffix (search->query->str, " "))
- g_string_append_printf (search->query, "WHERE %s = 0", value);
+ g_string_append_printf (search->query, "WHERE (%s = 0)", value);
else {
+
+ search->query->len -= 1;
if (f->operators)
- g_string_append_printf (search->query, " %s %s = 0", (char *) (g_slist_nth_data (f->operators, 0)), value);
+ g_string_append_printf (search->query, " %s %s = 0)", (char *) (g_slist_nth_data (f->operators, 0)), value);
else
g_string_append_printf (search->query, " OR %s = 0", value);
}
@@ -1419,10 +1423,10 @@
}
} else
- g_warning ("Makes no sense to search for multiple things in user tag as it can hold only one string data");
+ g_warning ("Makes no sense to search for multiple things in user tag as it can hold only one string data : [%d] ", argc);
r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = FALSE;
+ r->value.bool = TRUE;
return r;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]