Shashak please use a* readable subject line *that describes your problem and not "Re: flex_india - 52 new messages in 24 topics - abridged"
Thank you, Mrinal Flex India Moderation team On Thu, Feb 12, 2009 at 3:53 PM, shashank kulkarni <shashank.pa...@gmail.com > wrote: > > Hi to all, > > So nobody seems to have solution for this problem. > > Dont worry i am just replying it to close the thread. > > Today i got the solution from Gabriel. Link to the discussion is here > > http://gmarius.posterous.com/a-test-33 > > > The problem was openAsync. > > As all sql calls are asynchronous. > > The calls to statement.sqlConnection.loadSchema(); was also > asynchronous. > > Corrected Code is: > > private var conn : SQLConnection; > > private function createDB():void > { > conn = new SQLConnection(); > > //conn.addEventListener(SQLEvent.OPEN, openSuccess); > //conn.addEventListener(SQLErrorEvent.ERROR, openFailure); > > var dbFile:File = File.applicationStorageDirectory.resolvePath > ("DBSample.db"); > conn.openAsync(dbFile,SQLMode.READ); > } > > > private var statement:SQLStatement; > private function masterCreationSuccess():void > { > statement = new SQLStatement(); > statement.sqlConnection = conn; > // use SQLTableSchema to get tables only, > // see the loadSchema API Doc > *//Solution Line* > * statement.sqlConnection.**addEventListener(SQLEvent.**SCHEMA, > handleSchema)* > statement.sqlConnection.loadSchema(); > > } > > private function handleSchema(event:SQLEvent):void > { > var result:SQLSchemaResult = statement.sqlConnection.getSchemaResult > (); > for each (var table:SQLTableSchema in result.tables) > { > trace(table.name); > } > } > > Thanks and Regards > > Shashank Kulkarni(09822576796), > Flex Developer, > Symphony services,Pune. > > Check out some Cool Stufs : http://shashankkulkarni.wordpress.com/ > > "Motivation is an external, temporary high that pushes you forward. > Inspiration is a sustainable internal glow which pulls you forward" > > > > On Fri, Feb 6, 2009 at 4:05 PM, shashank kulkarni < > shashank.pa...@gmail.com> wrote: > >> HI To all ; >> >> Requirement : To List the Table from given Database >> >> I am Finding the Error while executing the following code which says there >> is no sqlite_master table , >> >> private var masterTblStmt:SQLStatement; >> >> private function masterCreationSuccess():void >> { >> masterTblStmt = new SQLStatement(); >> masterTblStmt.sqlConnection = conn; >> >> var sql:String = ""; >> >> sql = "SELECT name FROM sqlite_master WHERE >> type='table'ORDER BY name" >> >> masterTblStmt.addEventListener(SQLEvent.RESULT,listTables); >> >> masterTblStmt.addEventListener(SQLErrorEvent.ERROR,masterCreationFailed); >> masterTblStmt.text = sql; >> masterTblStmt.execute(); >> } >> >> Also Tried the query //sql = "SELECT name FROM DBSample.sqlite_master >> WHERE type='table'ORDER BY name" >> >> and >> >> Also tried to solve it by >> >> >> conn.loadSchema(); >> >> var result:SQLSchemaResult = conn.getSchemaResult(); >> >> But i get result = null; when traced; >> >> Can Anybody Solve? Or Does anybody know some different query to get the >> list of table name from given database >> >> Thanks and Regards >> >> Shashank Kulkarni(09822576796), >> Flex Developer, >> Symphony services,Pune. >> >> Check out some Cool Stufs : http://shashankkulkarni.wordpress.com/ >> >> "Motivation is an external, temporary high that pushes you forward. >> Inspiration is a sustainable internal glow which pulls you forward" >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---