Home » U++ Library support » U++ SQL » Store empty string to database
Store empty string to database [message #37581] |
Sat, 20 October 2012 16:29  |
|
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 ).
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
|
|
|
Goto Forum:
Current Time: Fri May 09 08:48:20 CEST 2025
Total time taken to generate the page: 0.00373 seconds
|