3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">// Asbtract base class for Connection classes
\r
9 Ext.sql.Connection = function(config){
\r
10 Ext.apply(this, config);
\r
11 Ext.sql.Connection.superclass.constructor.call(this);
\r
19 Ext.extend(Ext.sql.Connection, Ext.util.Observable, {
\r
24 open : function(file){
\r
30 exec : function(sql){
\r
33 execBy : function(sql, args){
\r
36 query : function(sql){
\r
39 queryBy : function(sql, args){
\r
42 // protected/inherited method
\r
43 isOpen : function(){
\r
44 return this.openState;
\r
47 getTable : function(name, keyName){
\r
48 return new Ext.sql.Table(this, name, keyName);
\r
51 createTable : function(o){
\r
52 var tableName = o.name;
\r
53 var keyName = o.key;
\r
55 if(!Ext.isArray(fs)){ // Ext fields collection
\r
59 for(var i = 0, len = fs.length; i < len; i++){
\r
60 var f = fs[i], s = f.name;
\r
73 if(f.allowNull === false || f.name == keyName){
\r
76 if(f.name == keyName){
\r
77 s += ' PRIMARY KEY';
\r
79 if(f.unique === true){
\r
83 buf[buf.length] = s;
\r
85 var sql = ['CREATE TABLE IF NOT EXISTS ', tableName, ' (', buf.join(','), ')'].join('');
\r
91 Ext.sql.Connection.getInstance = function(db, config){
\r
92 if(Ext.isAir){ // air
\r
93 return new Ext.sql.AirConnection(config);
\r
95 return new Ext.sql.GearsConnection(config);
\r