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 » Sqlite3 int64 / wstring support patch
Sqlite3 int64 / wstring support patch [message #4141] Tue, 25 July 2006 10:25 Go to next message
aroman is currently offline  aroman
Messages: 18
Registered: November 2005
Promising Member

Sqlite3 supports directly storing int64 values in the database. It also supports directly storing 16-bit strings. I would like to add support to UPP to handle that.

This involves patching the Value class to support int64's, along with adding the required methods in the sqlite3 value parsing. Also, it should be added to the schema.

Since Value already stores doubles, int64 does not increase size.

I also gently tweaked the storage format for time and date. The original stored time/date as:
'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
however the single quotes are not needed since the string is being bound and saved directly into the DB. (I think I messed up the order, though - please check that.)

While I was at it, I added support for "Limit(n)" to limit the number of rows returned by a query.

- Augusto

Re: Sqlite3 int64 / wstring support patch [message #4156 is a reply to message #4141] Tue, 25 July 2006 20:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
aroman wrote on Tue, 25 July 2006 04:25

Sqlite3 supports directly storing int64 values in the database. It also supports directly storing 16-bit strings. I would like to add support to UPP to handle that.

This involves patching the Value class to support int64's, along with adding the required methods in the sqlite3 value parsing. Also, it should be added to the schema.

Since Value already stores doubles, int64 does not increase size.

I also gently tweaked the storage format for time and date. The original stored time/date as:
'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
however the single quotes are not needed since the string is being bound and saved directly into the DB. (I think I messed up the order, though - please check that.)

While I was at it, I added support for "Limit(n)" to limit the number of rows returned by a query.

- Augusto




Are you sure WString support is correct? I would expect sqlite3_bind_text16 to accept 16-bit parameters...

Mirek
Re: Sqlite3 int64 / wstring support patch [message #4157 is a reply to message #4156] Tue, 25 July 2006 21:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Also, now that I had investigated the code more in depth...

The idea of "prepared statements cache" is not quite necessary.

The SqlConnection interface should keep just one prepared statement. It can easily detect which one and how long to keep it (parse flag indicates that statement should be parsed...).

Now if user wants to keep prepared statement, the simplest way is to make its variable 'static', leaving the control to the client.

Mirek
Re: Sqlite3 int64 / wstring support patch [message #4158 is a reply to message #4156] Tue, 25 July 2006 21:26 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
aroman wrote on Tue, 25 July 2006 04:25

Sqlite3 supports directly storing int64 values in the database. It also supports directly storing 16-bit strings. I would like to add support to UPP to handle that.

This involves patching the Value class to support int64's, along with adding the required methods in the sqlite3 value parsing. Also, it should be added to the schema.

Since Value already stores doubles, int64 does not increase size.

I also gently tweaked the storage format for time and date. The original stored time/date as:
'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
however the single quotes are not needed since the string is being bound and saved directly into the DB. (I think I messed up the order, though - please check that.)

While I was at it, I added support for "Limit(n)" to limit the number of rows returned by a query.

- Augusto




Are you sure WString support is correct? I would expect sqlite3_bind_text16 to accept 16-bit parameters...

UPDATE: There is also missing fetch support for WString, worse, it seems impossible. Perhaps the rigth solution is to store everything using sqlite3_bind_text16 and fetch using sqlite3_column_text16....

I am also not very happy about DATE/TIME...

Well, there is one quite dirty, but effective way. What about to represent them as some high double numbers? Nobody would really miss numbers above 1E+300 and we could use that exponent to detect date/time number (number of seconds or days since set the choosen start of era). All date/time range comparisons would work just fine (with the help of dialect test in SqlFormat).

Mirek

[Updated on: Tue, 25 July 2006 21:27]

Report message to a moderator

Previous Topic: Updated Sqlite3 plugin
Next Topic: Fields
Goto Forum:
  


Current Time: Mon Apr 29 09:46:27 CEST 2024

Total time taken to generate the page: 0.02036 seconds