Home » U++ Library support » U++ SQL » Column type for SQLite
Column type for SQLite [message #26822] |
Mon, 31 May 2010 12:12 |
frankdeprins
Messages: 99 Registered: September 2008 Location: Antwerp - Belgium
|
Member |
|
|
Hello,
Currently, when executing a select statement in sqlite, the column type is determined by the first row fetched. When a value in that record happens to be null, the type for that column will always be known as VOID_V.
The code in the execute procedure, responsible for this is:
case SQLITE_NULL:
field.type = VOID_V;
break;
wouldn't it be better to extend it like this:
case SQLITE_NULL:
if(coltype == "date")
field.type = DATE_V;
else
if(coltype == "datetime")
field.type = TIME_V;
else
if(coltype.Find("char") >= 0 || coltype.Find("text") >= 0 )
field.type = WSTRING_V;
else
if(coltype.Find("integer") >= 0)
field.type = INT_V;
else
if(coltype.Find("real") >= 0)
field.type = DOUBLE_V;
else
field.type = VOID_V;
break;
This same technique is already used for detecting dates and times in string fields. So I see no harm in doing the same for null values.
|
|
|
Goto Forum:
Current Time: Thu May 23 16:17:27 CEST 2024
Total time taken to generate the page: 0.01412 seconds
|