1. #1
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default Accessing sqlite_master table error

    Accessing sqlite_master table error


    Anyone able to access the "sqlite_master" table successfully? I use the code:

    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();
    But I constantly get this error:

    SQLError: 'Error #3115: SQL Error.', details:'object name reserved for internal use: 'sqlite_master'', operation:'execute', detailID:'2402'
    I'm trying to dynamically get the different tables
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  2. #2
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    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

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I'm having a hard time with the loadSchema(). It keeps giving me an error:

    SQLError: 'Error #3115: SQL Error.', details:'No schema objects in database 'main' were found.', operation:'schema', detailID:'1010'
    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 taste

    Code:
    					var conn = new air.SQLConnection();
    					conn.addEventListener(air.SQLEvent.OPEN, openSuccess);
    					conn.open(dbFile);
    					conn.loadSchema();
    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.
    Attached Files
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    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. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    OK, so I tried and am still getting errors

    Code:

    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);
    Errors when using Aptana:
    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.
    I can comment out the getSchemaResult() and it's for loop and will still get this error.

    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 wrong
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    Don't mix up sync and async style! All operations are async, so loadSchema.
    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'));
    works for me.

    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

  8. #8
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Ahhh... ok I see my errors. Thanks for taking time out to help me!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  9. #9
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    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

  10. #10
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1