I am having problems inserting a date into an sqlite
database. Heres what I am doing:
//Setup a connection
var conn:SQLConnection = new SQLConnection();
var dbFile:File = File.applicationDirectory.resolvePath("somedb.rsd");
conn.open(dbFile);
//Create a statement
var stmt:SQLStatement = new SQLStatement;
stmt.sqlConnection = conn;
//Begin the insert
conn.begin();
stmt.text = "INSERT INTO SomeTbl (bdate) VALUES ('2008-03-04')";
try
{
stmt.execute();
conn.commit();
}
catch(error:SQLError)
{
trace("Error Message: ", error.message);
conn.rollback();
}
//Close whatever needs to be closed and so on...
A record gets inserted into the database just fine but the data in the date field is:
2454529.5
rather then
2008-03-04
The odd thing is when I just do an insert in SQLite Manager extension for FireFox I get the expected output:
2008-03-04
Only when I am doing an insert within the AS of the AIR App do I get the numbers. I know it must be something simple I am over looking but have tried everything I can think of. Any ideas out there?
Bob
*edit* I know I shouldn't use applicationDirectory for storing anything, just did that for testing. I will change it but that isn't the issue here ;)
//Setup a connection
var conn:SQLConnection = new SQLConnection();
var dbFile:File = File.applicationDirectory.resolvePath("somedb.rsd");
conn.open(dbFile);
//Create a statement
var stmt:SQLStatement = new SQLStatement;
stmt.sqlConnection = conn;
//Begin the insert
conn.begin();
stmt.text = "INSERT INTO SomeTbl (bdate) VALUES ('2008-03-04')";
try
{
stmt.execute();
conn.commit();
}
catch(error:SQLError)
{
trace("Error Message: ", error.message);
conn.rollback();
}
//Close whatever needs to be closed and so on...
A record gets inserted into the database just fine but the data in the date field is:
2454529.5
rather then
2008-03-04
The odd thing is when I just do an insert in SQLite Manager extension for FireFox I get the expected output:
2008-03-04
Only when I am doing an insert within the AS of the AIR App do I get the numbers. I know it must be something simple I am over looking but have tried everything I can think of. Any ideas out there?
Bob
*edit* I know I shouldn't use applicationDirectory for storing anything, just did that for testing. I will change it but that isn't the issue here ;)