2 * Ext JS Library 0.30
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
10 * @class Ext.sql.SQLiteStore
11 * @extends Ext.data.Store
12 * Convenience class which assists in setting up SQLiteStore's.
13 * This class will create the necessary table if it does not exist.
14 * This class requires that all fields stored in the database will also be kept
15 * in the Ext.data.Store.
17 Ext.sql.SQLiteStore = Ext.extend(Ext.data.Store, {
19 * @cfg {String} key This is the primary key for the table and the id for the Ext.data.Record.
22 * @cfg {Array} fields Array of fields to be used. Both name and type must be specified for every field.
25 * @cfg {String} dbFile Filename to create/open
28 * @cfg {String} tableName Name of the database table
30 constructor: function(config) {
31 config = config || {};
32 config.reader = new Ext.data.JsonReader({
36 var conn = Ext.sql.Connection.getInstance();
38 conn.open(config.dbFile);
39 // Create the database table if it does
42 name: config.tableName,
44 fields: config.reader.recordType.prototype.fields
46 Ext.sql.SQLiteStore.superclass.constructor.call(this, config);
47 this.proxy = new Ext.sql.Proxy(conn, config.tableName, config.key, this, false);