So if I can sum up your email very clearly.  I'd say:

DO NOT use int, use Number, because that's what Air's database connection
layer is going to return you.

If you use int data type for fields you'll get zeros.  With Number it's will
propagate NULLs correctly.

Thanks,
Charlie

On Mon, Nov 24, 2008 at 12:18 AM, jason_williams_mm <
[EMAIL PROTECTED]> wrote:

>   --- In [email protected] <flexcoders%40yahoogroups.com>,
> "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