View Full Version : Ext.sql
Enygma
27 Mar 2008, 6:19 AM
Hi all,
I'm interested in doing a little bit of work with Ext and AIR and I've played around a little with the Sample Tasks application. What's not entirely clear to me is how the data access code works. I can't find any documentation on Ext.sql
Is there any overview of how to create a connection, create a table and perform operations on that table?
Thanks!
raulbuta
28 Mar 2008, 5:41 AM
Hi Enygma, init with Simple Task v2 if you want desktop app. To create table put this code in Ext.onReady(function(){:
tx.data.conn.open('tasks.db'); // connection with the database file
var sql = "";
sql += "CREATE TABLE IF NOT EXISTS my_table_name( ";
sql += "fieldId INTEGER PRIMARY KEY AUTOINCREMENT, ";
sql += "field1 INTEGER, ";
sql += "field2 TEXT, ";
sql += "field3 TEXT, ";
sql += "field4 DATE, ";
sql += "field5 TEXT, ";
sql += "field6 VARCHAR(255), ";
sql += "field7 NUMERIC CHECK (field7 >= 0) DEFAULT 0";
sql += ")";
tx.data.conn.exec(sql); // this will create a table in database file.
I hope
Sorry my enghish.
Enygma
28 Mar 2008, 8:48 AM
Hi,
Thanks for that. I've been doing a little investigation and figured out how the SQL connection stuff works, it's actually dead simple as you pointed out (duh!)
I'm currently playing about with the TaskStore and Proxy classes to figure out whats going on there.
From my understanding the Proxy class provides a generic way of loading the data from the database whilst the Store (which contains the Proxy) provides the application with the mechanism for inserting, updating etc.
I think anyway...:-?
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.