X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/Table.html diff --git a/docs/source/Table.html b/docs/source/Table.html deleted file mode 100644 index 0fb385ff..00000000 --- a/docs/source/Table.html +++ /dev/null @@ -1,95 +0,0 @@ - - - The source code - - - - -
Ext.sql.Table = function(conn, name, keyName){
-	this.conn = conn;
-	this.name = name;
-	this.keyName = keyName;
-};
-
-Ext.sql.Table.prototype = {
-	update : function(o){
-		var clause = this.keyName + " = ?";
-		return this.updateBy(o, clause, [o[this.keyName]]);
-	},
-
-	updateBy : function(o, clause, args){
-		var sql = "UPDATE " + this.name + " set ";
-		var fs = [], a = [];
-		for(var key in o){
-			if(o.hasOwnProperty(key)){
-				fs[fs.length] = key + ' = ?';
-				a[a.length] = o[key];
-			}
-		}
-		for(var key in args){
-			if(args.hasOwnProperty(key)){
-				a[a.length] = args[key];
-			}
-		}
-		sql = [sql, fs.join(','), ' WHERE ', clause].join('');
-		return this.conn.execBy(sql, a);
-	},
-
-	insert : function(o){
-		var sql = "INSERT into " + this.name + " ";
-		var fs = [], vs = [], a = [];
-		for(var key in o){
-			if(o.hasOwnProperty(key)){
-				fs[fs.length] = key;
-				vs[vs.length] = '?';
-				a[a.length] = o[key];
-			}
-		}
-		sql = [sql, '(', fs.join(','), ') VALUES (', vs.join(','), ')'].join('');
-        return this.conn.execBy(sql, a);
-    },
-
-	lookup : function(id){
-		return this.selectBy('where ' + this.keyName + " = ?", [id])[0] || null;
-	},
-
-	exists : function(id){
-		return !!this.lookup(id);
-	},
-
-	save : function(o){
-		if(this.exists(o[this.keyName])){
-            this.update(o);
-        }else{
-            this.insert(o);
-        }
-	},
-
-	select : function(clause){
-		return this.selectBy(clause, null);
-	},
-
-	selectBy : function(clause, args){
-		var sql = "select * from " + this.name;
-		if(clause){
-			sql += ' ' + clause;
-		}
-		args = args || {};
-		return this.conn.queryBy(sql, args);
-	},
-
-	remove : function(clause){
-		this.deleteBy(clause, null);
-	},
-
-	removeBy : function(clause, args){
-		var sql = "delete from " + this.name;
-		if(clause){
-			sql += ' where ' + clause;
-		}
-		args = args || {};
-		this.conn.execBy(sql, args);
-	}
-};
- - \ No newline at end of file