--- In [email protected], "Charlie Hubbard"
<[EMAIL PROTECTED]> wrote:
>
> I've read over all of the docs on Air, but there seems to be a missing
> discussion around NULL values in SQLLite and how those map back to
> datatypes.  What I've found is that if I have an int field type I
can't get
> a NULL value to ever get inserted into the SQLLite.  It just ends up
> inserting 0 (zero).  In Java we'd just convert to using a true
Object like
> Integer class, and that would handle this problem for us.  What is the
> equivalent with Actionscript?  If you want NULLs and numbers what is an
> object and a number, and will Air convert between the two correctly?
> 
> Thanks
> Charlie
>

It would help to see the code that you are using, however, the
following code gives the same results in both 1.5 and 1.1:


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="run()">
<mx:Script>
<![CDATA[
   import mx.utils.ObjectUtil;
                    
   private function run():void
   {
        trace(NativeApplication.nativeApplication.runtimeVersion);
        var con:SQLConnection = new SQLConnection();
 con.open(File.applicationStorageDirectory.resolvePath("nulltesting.db"));
        var sql:SQLStatement = new SQLStatement();
        sql.sqlConnection = con;
        sql.text = "CREATE TABLE test (id integer);";
        sql.execute();
                                
        sql.text = "INSERT INTO test VALUES(null);";
        sql.execute();
                                
        sql.text = "INSERT INTO test VALUES(1);";
        sql.execute();
                                
        sql.text = "INSERT INTO test VALUES(2);";
        sql.execute();
                                
        sql.text = "INSERT INTO test VALUES(3);";
        sql.execute();
                                
        sql.text = "SELECT * FROM test;";
        sql.execute();
                                 
trace(ObjectUtil.toString(sql.getResult().data));
}
]]>
</mx:Script>
</mx:WindowedApplication>

------ trace output ------

(Array)#0
  [0] (Object)#1
    id = (null)
  [1] (Object)#2
    id = 1
  [2] (Object)#3
    id = 2
  [3] (Object)#4
    id = 3

Each of the values returned in the object is a Number.  Hope that
helps some.

jw

Reply via email to