Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Column type for SQLite
Column type for SQLite [message #26822] Mon, 31 May 2010 12:12 Go to next message
frankdeprins is currently offline  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.
Re: Column type for SQLite [message #26825 is a reply to message #26822] Mon, 31 May 2010 21:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Makes sense, patch applied.

Mirek
Re: Column type for SQLite [message #26828 is a reply to message #26825] Tue, 01 June 2010 07:05 Go to previous message
frankdeprins is currently offline  frankdeprins
Messages: 99
Registered: September 2008
Location: Antwerp - Belgium
Member
thanks, Mirek
Previous Topic: SQLITE: remove case sensitive of column type name.
Next Topic: ParseForArguments does not take comments in account
Goto Forum:
  


Current Time: Tue Apr 16 23:07:06 CEST 2024

Total time taken to generate the page: 0.01268 seconds