• Welcome, Guest. Please login.
May 11, 2021, 08:09:45 PM


Welcome to the SQLitening support forums!

Re: SQLiteningProcs - How to check for NULL with SQLite

Started by Bern Ertl, June 03, 2009, 04:26:38 PM

Previous topic - Next topic

Bern Ertl

Similar to my BLOB storing question, I now find myself needing to test if a value is NULL or not in a Procs function using SQLite.  What is the SQLite equivalent of slIsFieldNull() ?

Fred Meier

Use the slmGetFieldType macro passing set handle and field number.  This
will call sqlite3_column_type.  If return is 5 then field is Null.  This
macro is in the sample SQLiteningProcsA.Bas, if not in your version is
will be in next version. 

Snippet from SQLiteningProcsA.Bas
Declare Function sqlite3_column_type cdecl lib "sqlite3.dll" alias "sqlite3_column_type" (byval rhSet as Dword, byval rlCol as Long) as Long
' ==========>>> Get Field Type
Macro Function slmGetFieldType(rhSet, rlField)
'     Integer=1, Float=2, Text=3, BLOB=4, Null=5
End Macro = sqlite3_column_type(rhSet, rlField - 1)

Bern Ertl

I had reviewed the macros there before posting and totally missed it!