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 |
|
Out of curiosity, I tried to alter String(const Nuller&) and IsNull(const String&) and compile TheIDE. It compiles well (not surprising ) and it even mostly runs (very surprising ). 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 Maybe there is hope to make the switch and start using void as null
Honza
PS: The patch (for other curios people ) :
--- 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
|
|
|
Goto Forum:
Current Time: Tue May 07 01:49:43 CEST 2024
Total time taken to generate the page: 0.02107 seconds
|