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

Out of curiosity, I tried to alter String(const Nuller&) and IsNull(const String&) and compile TheIDE. It compiles well (not surprising Smile ) and it even mostly runs (very surprising Very Happy ). There are some artifacts caused by improper use of not-any-more-interchangeable calls to IsEmpty and IsNull, but most of the application somehow works. The most broken parts of U++ (with this patch) are not surprisingly CParser, CodeEditor and other classes heavily dealing with strings. I was expecting it to be much worse Smile Maybe there is hope to make the switch and start using void as null Wink

Honza


PS: The patch (for other curios people Wink ) :
--- upp-production/uppsrc/Core/String.h (revision 5441)
+++ upp-production/uppsrc/Core/String.h (working copy)
@@ -341,7 +341,7 @@
        int    GetCharCount() const;
 
        String()                                               { Zero(); }
-       String(const Nuller&)                                  { Zero(); }
+       String(const Nuller&)                                  { ptr = (char *)(voidptr + 1); LLen() = 0; SLen() = 15; chr[KIND] = 50; }
        String(const String& s)                                { String0::Set(s); }
        String(const char *s);
        String(const String& s, int n)                         { ASSERT(n >= 0 && n <= s.GetLength()); String0::Set(~s, n); }
@@ -495,7 +495,7 @@
 }
 
 template<>
-inline bool  IsNull(const String& s)       { return s.IsEmpty(); }
+inline bool  IsNull(const String& s)       { return s.IsVoid(); }
 
 template<>
 inline String AsString(const String& s)     { return s; }

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

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: Tue May 07 01:49:43 CEST 2024

Total time taken to generate the page: 0.02107 seconds