/*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
-Ext.data.GearsDB = Ext.extend(Ext.data.SqlDB, {\r
- // abstract methods\r
- open : function(db, cb, scope){\r
- this.conn = google.gears.factory.create('beta.database', '1.0');\r
- this.conn.open(db);\r
- this.openState = true;\r
- Ext.callback(cb, scope, [this]);\r
- this.fireEvent('open', this);\r
- },\r
-\r
- close : function(){\r
- this.conn.close();\r
- this.fireEvent('close', this);\r
- },\r
-\r
- exec : function(sql, cb, scope){\r
- this.conn.execute(sql).close();\r
- Ext.callback(cb, scope, [true]);\r
- },\r
-\r
- execBy : function(sql, args, cb, scope){\r
- this.conn.execute(sql, args).close();\r
- Ext.callback(cb, scope, [true]);\r
- },\r
-\r
- query : function(sql, cb, scope){\r
- var rs = this.conn.execute(sql);\r
- var r = this.readResults(rs);\r
- Ext.callback(cb, scope, [r]);\r
- return r;\r
- },\r
-\r
- queryBy : function(sql, args, cb, scope){\r
- var rs = this.conn.execute(sql, args);\r
- var r = this.readResults(rs);\r
- Ext.callback(cb, scope, [r]);\r
- return r;\r
- },\r
-\r
- readResults : function(rs){\r
- var r = [];\r
- if(rs){\r
- var c = rs.fieldCount();\r
- // precache field names\r
- var fs = [];\r
- for(var i = 0; i < c; i++){\r
- fs[i] = rs.fieldName(i);\r
- }\r
- // read the data\r
- while(rs.isValidRow()){\r
- var o = {};\r
- for(var i = 0; i < c; i++){\r
- o[fs[i]] = rs.field(i);\r
- }\r
- r[r.length] = o;\r
- rs.next();\r
- }\r
- rs.close();\r
- }\r
- return r;\r
- },\r
-\r
- // protected/inherited method\r
- isOpen : function(){\r
- return this.openState;\r
- },\r
-\r
- getTable : function(name, keyName){\r
- return new Ext.data.SqlDB.Table(this, name, keyName);\r
- }\r
+Ext.data.GearsDB = Ext.extend(Ext.data.SqlDB, {
+ // abstract methods
+ open : function(db, cb, scope){
+ this.conn = google.gears.factory.create('beta.database', '1.0');
+ this.conn.open(db);
+ this.openState = true;
+ Ext.callback(cb, scope, [this]);
+ this.fireEvent('open', this);
+ },
+
+ close : function(){
+ this.conn.close();
+ this.fireEvent('close', this);
+ },
+
+ exec : function(sql, cb, scope){
+ this.conn.execute(sql).close();
+ Ext.callback(cb, scope, [true]);
+ },
+
+ execBy : function(sql, args, cb, scope){
+ this.conn.execute(sql, args).close();
+ Ext.callback(cb, scope, [true]);
+ },
+
+ query : function(sql, cb, scope){
+ var rs = this.conn.execute(sql);
+ var r = this.readResults(rs);
+ Ext.callback(cb, scope, [r]);
+ return r;
+ },
+
+ queryBy : function(sql, args, cb, scope){
+ var rs = this.conn.execute(sql, args);
+ var r = this.readResults(rs);
+ Ext.callback(cb, scope, [r]);
+ return r;
+ },
+
+ readResults : function(rs){
+ var r = [];
+ if(rs){
+ var c = rs.fieldCount();
+ // precache field names
+ var fs = [];
+ for(var i = 0; i < c; i++){
+ fs[i] = rs.fieldName(i);
+ }
+ // read the data
+ while(rs.isValidRow()){
+ var o = {};
+ for(var i = 0; i < c; i++){
+ o[fs[i]] = rs.field(i);
+ }
+ r[r.length] = o;
+ rs.next();
+ }
+ rs.close();
+ }
+ return r;
+ },
+
+ // protected/inherited method
+ isOpen : function(){
+ return this.openState;
+ },
+
+ getTable : function(name, keyName){
+ return new Ext.data.SqlDB.Table(this, name, keyName);
+ }
});
\ No newline at end of file