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 » Some queries return incorrect datatypes with SqLite
Some queries return incorrect datatypes with SqLite [message #55728] Thu, 03 December 2020 18:56 Go to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Hello, I see some issue with SqLite3 lately that didn't exist before.

They have to do with the datatype of the results of a query.

issue 1 : SqlMax(some time column) returns WSTRING_V result instead of TIME_V
issue 2 : Selecting a BOOL column also returns WSTRING_V result instead of BOOL_V

again, it only applies to SqLite, on MySql it works correctly

I enclosed an example
Re: Some queries return incorrect datatypes with SqLite [message #55767 is a reply to message #55728] Fri, 11 December 2020 14:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Alboni wrote on Thu, 03 December 2020 18:56
Hello, I see some issue with SqLite3 lately that didn't exist before.

They have to do with the datatype of the results of a query.

issue 1 : SqlMax(some time column) returns WSTRING_V result instead of TIME_V
issue 2 : Selecting a BOOL column also returns WSTRING_V result instead of BOOL_V

again, it only applies to SqLite, on MySql it works correctly

I enclosed an example


BOOL behaviour is as expected (BOOL in .sch is always emulated by text column to be consistent across all DBs).

With SqlMax it seems we are simply out of luck:

https://www.sqlite.org/c3ref/column_decltype.html

Impossible to do better there I am afraid Sad

Mirek
Re: Some queries return incorrect datatypes with SqLite [message #55768 is a reply to message #55767] Fri, 11 December 2020 15:17 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
But regardless of implementation, with Mysql an assignment to a bool variable goes right.

I have no issue discontinuing BOOL_ and using INT_ instead if it is too tricky or not worth it to fix.
Re: Some queries return incorrect datatypes with SqLite [message #55770 is a reply to message #55768] Fri, 11 December 2020 15:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Well, that is rather nasty inconsistence with MySql.... Sorry, long time ago MySql was contributed package and I missed this one. Cannot fix that now without breaking existing code Sad

That said, maybe we could introduce a new schema type, e.g. "LOGICAL" that maps to bool and uses database 'bool' where possible and smallest number where not possible?

Mirek
Re: Some queries return incorrect datatypes with SqLite [message #55773 is a reply to message #55728] Fri, 11 December 2020 16:43 Go to previous message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
ok. Thanks.
I'll use int for now.
Previous Topic: libpq-fe.h in Alpine Linux
Next Topic: MySqlSession Close and Reconnect crashes Application
Goto Forum:
  


Current Time: Thu Jun 13 19:11:55 CEST 2024

Total time taken to generate the page: 0.02288 seconds