Module: DB Interface Module Group: Data Type
RWDBMBString RWCString
#include <rw/db/mbstring.h> RWDBMBString a;
Some databases require different handling of single byte character sets (SBCS), like ASCII or ISO Latin-1, and multibyte character sets (MBCS). Writing applications using class RWDBMBString for MBCS strings and class RWCString for SBCS strings allows the DB Interface Module to make the critical differentiation.
RWDBMBString derives publicly from RWCString, such that all the facilities and functions of RWCString are available. For a complete description of those functions, see the Essential Tools Module documentation for class RWCString.
We recommend that you do not derive from RWDBMBString.
Simple
#include <iostream.h> #include <rw/db/mbstring.h> void outputTest(RWDBDatabase& aDB){ RWDBInserter ins = aDB.table("t1").inserter(); RWDBMBString mbstring("\346\202\250\345\245\275"); ins << mbstring; cout << ins.asString() << endl; }
Oracle treats multibyte and single byte strings differently. If aDB represents an Oracle database and the proper character set is loaded on the machine, the output is:
INSERT INTO T1 VALUES (N'')
Sybase does not differentiate multibyte and single byte strings. If aDB represents a Sybase database and the proper character set is loaded on the machine, the output is:
INSERT INTO T1 VALUES ('')
RWDBMBString(const RWDBMBString& str);
Copy constructor. The created string copies str's data.
RWDBMBString(); RWDBMBString(const char* cs); RWDBMBString(const char* cs, size_t N); RWDBMBString(RWSize_T ic); RWDBMBString(const RWCString& str); RWDBMBString(const RWCSubString& ss); RWDBMBString(char c); RWDBMBString(char c, size_t N);
Each of the above constructors calls the corresponding constructor of RWCString.
RWDBMBString& operator=(const char* cs);
Assignment operator. Copies the null-terminated character string pointed to by cs into self. Returns a reference to self. This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.
RWDBMBString& operator=(const RWCString& str);
Assignment operator. The string copies str's data. Returns a reference to self.
RWDBMBString& operator=(const RWDBMBString& str);
Assignment operator. The string copies str's data. Returns a reference to self.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.