-
4 Apr 2010 11:02 AM #1Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Accessing sqlite_master table error
Accessing sqlite_master table error
Anyone able to access the "sqlite_master" table successfully? I use the code:
But I constantly get this error:Code:var store = new Ext.sql.SQLiteStore({ dbFile: dbFile, key: "tbl_name", tableName : "sqlite_master", fields: [ {name: "type", type: "string"}, {name: "name", type: "string"}, {name: "tbl_name", type: "string"}, {name: "rootpage", type: "string"}, {name: "sql", type: "blob"} ] }); store.load();
I'm trying to dynamically get the different tablesSQLError: 'Error #3115: SQL Error.', details:'object name reserved for internal use: 'sqlite_master'', operation:'execute', detailID:'2402'Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Apr 2010 10:36 AM #2
That is because the original ext-air always executes a "CREATE TABLE sqlite_master IF NOT EXISTS..." query that throws this error. But even if you leave it, you will receive an error (no such table 'sqlite_master'). To get a list of all tables from your database use air.SQLConnection.loadSchema().
See this page for more information!Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
-
5 Apr 2010 10:59 AM #3Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
thank you sir! Just spent a little bit of time using Socket and ServerSocket... was easier than I was making it
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Apr 2010 12:41 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
I'm having a hard time with the loadSchema(). It keeps giving me an error:
This is the code I'm using according to my google searches and the Air Doc. Wish people would use JS and not Flex or Flash but that's just my personal tasteSQLError: 'Error #3115: SQL Error.', details:'No schema objects in database 'main' were found.', operation:'schema', detailID:'1010'
It is opening the file but once it tries to loadSchema() I get the error. I've attached a test SQLite DB file. I have 3 test tables each with at least one record.Code:var conn = new air.SQLConnection(); conn.addEventListener(air.SQLEvent.OPEN, openSuccess); conn.open(dbFile); conn.loadSchema();
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
6 Apr 2010 2:06 AM #5
No problems with your db and code. I reveice schema information.
Don't mix up synchronous and asynchronous style. In your code, the openSuccess function will never be called. If you use async style (which I recommend), then call loadSchema in your openSuccess function, because the connection needs to be established when loading schema information. Then use the "schema" event to call for getSchemaResult.
Btw, I'm also going nuts because most solutions are in flex only...Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
-
6 Apr 2010 6:23 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
OK, so I tried and am still getting errors

Code:
Errors when using Aptana:Code:var dump = new Array();; var folder = air.File.applicationStorageDirectory; var dbFile = folder.resolvePath("test.sqlite"); var conn = new air.SQLConnection(); conn.addEventListener(air.SQLEvent.OPEN, function(e) { e.target.loadSchema(); var result = e.target.getSchemaResult(); for (var table in result) { dump[table] = result["table"]; } }); conn.openAsync(dbFile);
I can comment out the getSchemaResult() and it's for loop and will still get this error.Error #2044: Unhandled error:. text=Error #3115: SQL Error.
Error #2044: Unhandled SQLErrorEvent:. errorID=3115, operation=schema , message=Error #3115: SQL Error. , details=No schema objects in database 'main' were found.
When I install the app I don't get any errors thrown. loadSchema() returns undefined, getSchemaResult() returns null and the dump array is empty.
I just don't get what's going wrongMitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
6 Apr 2010 6:33 AM #7
Don't mix up sync and async style! All operations are async, so loadSchema.
works for me.Code:var conn = new air.SQLConnection(); conn.addEventListener(air.SQLEvent.OPEN, function() { conn.addEventListener(air.SQLEvent.SCHEMA, function() { var result = conn.getSchemaResult(); console.info(result); }); conn.loadSchema(); }); conn.openAsync(air.File.applicationDirectory.resolvePath('data/test.sqlite'));
I cannot reproduce your sql error "No schema objects in database 'main' were found"...Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
-
6 Apr 2010 6:37 AM #8Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Ahhh... ok I see my errors. Thanks for taking time out to help me!
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
6 Apr 2010 6:42 AM #9
Ok, I can reproduce your sql error. Seems like you're not using the database you provided in post #4. I receive this error, if the database is empty, i.e. has no tables/views...
If you want to read the contained tables and the database could be empty, you should probably execute the loadSchema in a try-catch block....
Seems like your issue provides some stuff to integrate into my ext-air adapter
Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
-
6 Apr 2010 6:45 AM #10Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
I was thinking about writing a plugin for the SQLiteStore with a new function of getSchema() unless you just wanna throw it in yours. You changed the name of the store I see too
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote