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 » SQLITE: remove case sensitive of column type name.
SQLITE: remove case sensitive of column type name. [message #26665] Tue, 18 May 2010 17:25 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello all,

I propose to remove case sensitive of column type name.
I prepared a little patch for this:

Index: uppsrc/plugin/sqlite3/Sqlite3upp.cpp
===================================================================
--- uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(revision 2404)
+++ uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(working copy)
@@ -245,7 +245,8 @@
 	}
 
 	ASSERT(got_row_data);
-	String coltype = sqlite3_column_decltype(current_stmt,i);
+	// Remove case sensitive
+	String coltype = ToLower(sqlite3_column_decltype(current_stmt,i));
 	switch (sqlite3_column_type(current_stmt,i)) {
 		case SQLITE_INTEGER:
 			f = sqlite3_column_int64(current_stmt,i);


It is useful when I create a table
"CREATE TABLE Tab1(col1 DATETIME)".
When i execute a select statement, the conversion in Time is not correct.
Re: SQLITE: remove case sensitive of column type name. [message #26672 is a reply to message #26665] Tue, 18 May 2010 20:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
OK, done.

Mirek
Re: SQLITE: remove case sensitive of column type name. [message #26768 is a reply to message #26665] Wed, 26 May 2010 17:25 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1371
Registered: December 2006
Ultimate Contributor
tojocky wrote on Tue, 18 May 2010 11:25

Hello all,

I propose to remove case sensitive of column type name.
I prepared a little patch for this:

Index: uppsrc/plugin/sqlite3/Sqlite3upp.cpp
===================================================================
--- uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(revision 2404)
+++ uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(working copy)
@@ -245,7 +245,8 @@
 	}
 
 	ASSERT(got_row_data);
-	String coltype = sqlite3_column_decltype(current_stmt,i);
+	// Remove case sensitive
+	String coltype = ToLower(sqlite3_column_decltype(current_stmt,i));
 	switch (sqlite3_column_type(current_stmt,i)) {
 		case SQLITE_INTEGER:
 			f = sqlite3_column_int64(current_stmt,i);


It is useful when I create a table
"CREATE TABLE Tab1(col1 DATETIME)".
When i execute a select statement, the conversion in Time is not correct.


There is a bug in this patch. sqlite3_column_decltype() can return NULL. ToLower() will crash in this case because it will call strlen(NULL).

I already met this problem in my app.


Regards,
Novo
Re: SQLITE: remove case sensitive of column type name. [message #26796 is a reply to message #26768] Fri, 28 May 2010 14:55 Go to previous message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
Novo wrote on Wed, 26 May 2010 11:25

tojocky wrote on Tue, 18 May 2010 11:25

Hello all,

I propose to remove case sensitive of column type name.
I prepared a little patch for this:

Index: uppsrc/plugin/sqlite3/Sqlite3upp.cpp
===================================================================
--- uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(revision 2404)
+++ uppsrc/plugin/sqlite3/Sqlite3upp.cpp	(working copy)
@@ -245,7 +245,8 @@
 	}
 
 	ASSERT(got_row_data);
-	String coltype = sqlite3_column_decltype(current_stmt,i);
+	// Remove case sensitive
+	String coltype = ToLower(sqlite3_column_decltype(current_stmt,i));
 	switch (sqlite3_column_type(current_stmt,i)) {
 		case SQLITE_INTEGER:
 			f = sqlite3_column_int64(current_stmt,i);


It is useful when I create a table
"CREATE TABLE Tab1(col1 DATETIME)".
When i execute a select statement, the conversion in Time is not correct.


There is a bug in this patch. sqlite3_column_decltype() can return NULL. ToLower() will crash in this case because it will call strlen(NULL).

I already met this problem in my app.



Yes, unforseen consequences, should have been patched already.
Previous Topic: Oracle: How can use standard OCI without install oracle client?
Next Topic: Column type for SQLite
Goto Forum:
  


Current Time: Sun Nov 10 20:50:46 CET 2024

Total time taken to generate the page: 0.01912 seconds