changeset 1:0630179b9fc0

the pre-fulltext experimentation version of the code
author Myk Melez <myk@mozilla.org>
date Thu, 24 Jan 2008 15:28:22 -0800
parents f196fc7b6a59
children fb8c8fbdcfe5
files extension/content/snowl.js extension/modules/datastore.js
diffstat 2 files changed, 10 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/extension/content/snowl.js	Thu Jan 24 14:36:18 2008 -0800
+++ b/extension/content/snowl.js	Thu Jan 24 15:28:22 2008 -0800
@@ -6,21 +6,6 @@
 var Snowl = {
   init: function() {
     this._initModules();
-
-try {
-SnowlDatastore.dbConnection.executeSimpleSQL("create virtual table recipe using fts3(name, ingredients)");
-insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');
-  sqlite>insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');
-  sqlite>insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');
-  sqlite>insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');
-  
-}
-catch(ex) {
-  let error = ex + "\n" + SnowlDatastore.dbConnection.lastError + ": " + SnowlDatastore.dbConnection.lastErrorString;
-  dump(error + "\n");
-  Cu.reportError(error);
-}
-
     //SnowlFeedClient.refresh("http://www.melez.com/mykzilla/atom.xml");
   },
 
--- a/extension/modules/datastore.js	Thu Jan 24 14:36:18 2008 -0800
+++ b/extension/modules/datastore.js	Thu Jan 24 15:28:22 2008 -0800
@@ -71,6 +71,11 @@
                    timestamp INTEGER, \
                    link TEXT",
   
+      parts:      "id INTEGER PRIMARY KEY, \
+                   messageID INTEGER NOT NULL REFERENCES messages(id), \
+                   content BLOB NOT NULL, \
+                   contentType TEXT NOT NULL",
+
       attributes: "id INTEGER PRIMARY KEY, \
                    namespace TEXT, \
                    name TEXT NOT NULL",
@@ -132,7 +137,7 @@
       dbConnection = this._dbCreate(dbService, dbFile);
     else {
       try {
-        dbConnection = dbService.openUnsharedDatabase(dbFile);
+        dbConnection = dbService.openDatabase(dbFile);
 
         // Get the version of the database in the file.
         var version = dbConnection.schemaVersion;
@@ -165,8 +170,8 @@
 
   _dbCreate: function(aDBService, aDBFile) {
       var dbConnection = aDBService.openDatabase(aDBFile);
-      for (var table in this._dbSchema)
-        dbConnection.createTable(table, this._dbSchema[table]);
+      for (var tableName in this._dbSchema.tables)
+        dbConnection.createTable(tableName, this._dbSchema.tables[tableName]);
       dbConnection.schemaVersion = this._dbVersion;
       return dbConnection;
   },
@@ -190,8 +195,8 @@
   },
 
   _dbMigrate0To1: function(aDBConnection) {
-    for (var table in this._dbSchema)
-      aDBConnection.createTable(table, this._dbSchema[table]);
+    for (var tableName in this._dbSchema.tables)
+      dbConnection.createTable(tableName, this._dbSchema.tables[tableName]);
   },
 
   get _selectSourcesStatement() {