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
9 // Abstract base class for Connection classes
\r
10 Ext.sql.Connection = function(config){
\r
11 Ext.apply(this, config);
\r
12 Ext.sql.Connection.superclass.constructor.call(this);
\r
20 Ext.extend(Ext.sql.Connection, Ext.util.Observable, {
\r
25 open : function(file){
\r
31 exec : function(sql){
\r
34 execBy : function(sql, args){
\r
37 query : function(sql){
\r
40 queryBy : function(sql, args){
\r
43 // protected/inherited method
\r
44 isOpen : function(){
\r
45 return this.openState;
\r
48 getTable : function(name, keyName){
\r
49 return new Ext.sql.Table(this, name, keyName);
\r
52 createTable : function(o){
\r
53 var tableName = o.name;
\r
54 var keyName = o.key;
\r
56 if(!Ext.isArray(fs)){ // Ext fields collection
\r
60 for(var i = 0, len = fs.length; i < len; i++){
\r
61 var f = fs[i], s = f.name;
\r
74 if(f.allowNull === false || f.name == keyName){
\r
77 if(f.name == keyName){
\r
78 s += ' PRIMARY KEY';
\r
80 if(f.unique === true){
\r
84 buf[buf.length] = s;
\r
86 var sql = ['CREATE TABLE IF NOT EXISTS ', tableName, ' (', buf.join(','), ')'].join('');
\r
92 Ext.sql.Connection.getInstance = function(db, config){
\r
93 if(Ext.isAir){ // air
\r
94 return new Ext.sql.AirConnection(config);
\r
96 return new Ext.sql.GearsConnection(config);
\r