Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ext-gears-db.js
Package: ext-3.1.0.zip [view]
Upload User: dawnssy
Upload Date: 2022-08-06
Package Size: 9345k
Code Size: 2k
Category:
JavaScript
Development Platform:
JavaScript
- /*! * Ext JS Library 3.1.0 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ 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);
- }
- });