U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ SQL » Store empty string to database
Re: Store empty string to database [message #37584 is a reply to message #37581] Sat, 20 October 2012 18:17 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
dolik.rce wrote on Sat, 20 October 2012 10: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.



Correct. This is long running issue. Originaly, U++ inherited this from Oracle. In around 2001, we have shortly experimented with !IsNull(String()), but we have found this causing even more problem (e.g. for integer values, it is logical that "empty" EditInt yields Null. So it is sort of expected that empty EditString is Null). So we have reverted and restored IsNull(String()) behaviour.

Quote:


Is there some workaround to this? I can easily imagine cases where one needs to differentiate between NULL and "" in databases.


At this moment, no. In the past, we tried String::GetZero() as special value representing empty string in DB... Never got actually used and supported in Sql, so was removed. If we are about to restore something like this, I think it should go along this line (e.g. SqlEmptyString() and IsSqlEmptyString()).

Mirek

Mirek

[Updated on: Sat, 20 October 2012 18:18]

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: Wed Apr 29 08:47:50 GMT+2 2026

Total time taken to generate the page: 0.00432 seconds