[flexcoders] Re: Saving data permanently to Sqlite DB

2009-01-19 Thread beriahotep
You were right on the money, the db in the bin-debug has the lastest
changes. 

Thanx for your help. 

Regards,
Tristan

--- In flexcoders@yahoogroups.com, Jim Hayes j...@... wrote:

 It's not the case that the database in /src/assets is getting copied
to /bin-debug/src/assets and the changes made to that copy, is it?
 Just a thought, I've not really checked your code in any detail at all.
 If you're using a db file path relative to the application and you
left the compiler settings as is then this may well be the case.
 It's worth noting that some OS's (e.g Vista) won't allow you to
change files in the application directory in any case, so you should
be copying the db to the users application storage  directory if
you're to avoid problems with a published app.
 
 
 -Original Message-
 From: flexcoders@yahoogroups.com on behalf of beriahotep
 Sent: Sat 17/01/2009 08:32
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Saving data permanently to Sqlite DB
  
 Hi, 
 
 I am having alot of trouble saving data to an Sqlite db. I have no
 trouble, loading data, however commiting changes permanently seems to
 fail. 
 
 I am using a delegate for the table. The code to execute any
 sqlStatement is:
 
 private function executeSQL(sqlStatement:SQLStatement):void{
if(sqlStatement != null){
   sqlStatement.addEventListener(SQLEvent.RESULT, responder.result);
   sqlStatement.addEventListener(SQLErrorEvent.ERROR,
responder.fault);
   sqlStatement.sqlConnection = storyHelperConn;
   sqlStatement.execute();
}
 }
 
 public function UpdateStory(story:StoryVO):void{
try{
   if(!isDBOpen){
  openDatabase();
  var sqlQuery:String = update stories set title =
:titleText,  +
 where id = :id;
 sqlStatement = new SQLStatement();
 sqlStatement.text = sqlQuery;
 sqlStatement.parameters[:titleText] = story.title;
   sqlStatement.parameters[:id] = story.id;
   sqlStatement.itemClass = StoryVO;
   executeSQL(sqlStatement);
}catch(e:Error){
   trace(Story Delegate Update Story error: +e.message +   +
 e.toString());
}
 }
 
 The database is stored in src/assets. I get no errors. When debuging i
 can view the parameters, and they contain all the correct data. 
 Ive been pouring over various help sites and tutorials without success. 
 
 Can anyone suggest anything to look for? Possible uncaught errors, etc? 
 
 Regards,
 Beriah
 
 
 
 
 
 
 __
 This communication is from Primal Pictures Ltd., a company
registered in England and Wales with registration No. 02622298 and
registered office: 4th Floor, Tennyson House, 159-165 Great Portland
Street, London, W1W 5PA, UK. VAT registration No. 648874577.
 
 This e-mail is confidential and may be privileged. It may be read,
copied and used only by the intended recipient. If you have received
it in error, please contact the sender immediately by return e-mail or
by telephoning +44(0)20 7637 1010. Please then delete the e-mail and
do not disclose its contents to any person.
 This email has been scanned for Primal Pictures by the MessageLabs
Email Security System.
 __





[flexcoders] Saving data permanently to Sqlite DB

2009-01-17 Thread beriahotep
Hi, 

I am having alot of trouble saving data to an Sqlite db. I have no
trouble, loading data, however commiting changes permanently seems to
fail. 

I am using a delegate for the table. The code to execute any
sqlStatement is:

private function executeSQL(sqlStatement:SQLStatement):void{
   if(sqlStatement != null){
  sqlStatement.addEventListener(SQLEvent.RESULT, responder.result);
  sqlStatement.addEventListener(SQLErrorEvent.ERROR, responder.fault);
  sqlStatement.sqlConnection = storyHelperConn;
  sqlStatement.execute();
   }
}

public function UpdateStory(story:StoryVO):void{
   try{
  if(!isDBOpen){
 openDatabase();
 var sqlQuery:String = update stories set title = :titleText,  +
where id = :id;
  sqlStatement = new SQLStatement();
  sqlStatement.text = sqlQuery;
  sqlStatement.parameters[:titleText] = story.title;
  sqlStatement.parameters[:id] = story.id;
  sqlStatement.itemClass = StoryVO;
  executeSQL(sqlStatement);
   }catch(e:Error){
  trace(Story Delegate Update Story error: +e.message +   +
e.toString());
   }
}

The database is stored in src/assets. I get no errors. When debuging i
can view the parameters, and they contain all the correct data. 
Ive been pouring over various help sites and tutorials without success. 

Can anyone suggest anything to look for? Possible uncaught errors, etc? 

Regards,
Beriah