nullColumnHack parameter in insert() of SQLiteDatabase

2,664 views
Skip to first unread message

aby

unread,
Apr 21, 2009, 9:16:56 PM4/21/09
to android-platform
Hi,
Does anyone know the second parameter nullColumnHack in insert() of
SQLiteDatabase?

Android developer's define as follows:

SQL doesn't allow inserting a completely empty row, so if
initialValues is empty this column will explicitly be assigned a NULL
value.

I still don't understand after reading the explanation. Can anyone
tell me the usage of this function?

Thanks

Mark Murphy

unread,
Apr 21, 2009, 9:36:03 PM4/21/09
to android-...@googlegroups.com

For the second parameter, you need to supply the name of some column in
your database that allows NULL values, if there is one.

If you supply such a column, then SQLite will be able to handle the
situation where you have an empty ContentValues you are trying to insert
into the database.

BTW, this is a better question for [android-beginners] or
[android-developers], since this pertains to the SDK more than the
Android source code.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year

Reply all
Reply to author
Forward
0 new messages