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 » Store empty string to database
Store empty string to database [message #37581] Sat, 20 October 2012 16:29 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi everyone!

Is it possible to differentiate between empty string and NULL in a database? As far as I can tell, storing "", e.g. in Insert(), always results to NULL being inserted. I believe it is because in U++ empty string is considered to be Null.

Is there some workaround to this? I can easily imagine cases where one needs to differentiate between NULL and "" in databases. So far I only came up with ugly solution of forcing the literal value of "''" into SqlVal instead of "", but that is not very nice solution (and by that I mean it is basically a hack Smile ).

Also, the same problem might arise in the Core itself. That is actually the reason why there is String::IsVoid(). So, wouldn't it be more logical to store Null in String as the "void state"? Or at least behave like this in the Sql layer, but then it would be kind of inconsistent behavior which is not very good either...

Best regards,
Honza

[Updated on: Sat, 20 October 2012 16:29]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: List DSN in ODBC
Next Topic: SQL_MySql reference example only compiles in debug mode
Goto Forum:
  


Current Time: Fri Apr 26 06:51:19 CEST 2024

Total time taken to generate the page: 0.03225 seconds