33 #ifndef _SQL_STRING_H_ 34 #define _SQL_STRING_H_ 38 #include "build_config.h" 47 #pragma warning(disable: 4251) 57 static const size_t npos =
static_cast<std::string::size_type
>(-1);
59 static const size_t npos = std::string::npos;
68 SQLString(
const std::string & other) : realStr(other) {}
70 SQLString(
const char other[]) : realStr(other) {}
72 SQLString(
const char * s,
size_t n) : realStr(s, n) {}
75 const SQLString & operator=(
const char * s)
81 const SQLString & operator=(
const std::string & rhs)
89 realStr = rhs.realStr;
94 operator const std::string &()
const 108 return realStr.compare(str.realStr);
111 int compare(
const char * s)
const 113 return realStr.compare(s);
116 int compare(
size_t pos1,
size_t n1,
const char * s)
const 118 return realStr.compare(pos1, n1, s);
121 int caseCompare(
const SQLString &s)
const 123 std::string tmp(realStr), str(s);
124 std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
125 std::transform(str.begin(), str.end(), str.begin(), ::tolower);
126 return tmp.compare(str);
129 int caseCompare(
const char * s)
const 131 std::string tmp(realStr), str(s);
132 std::transform(str.begin(), str.end(), str.begin(), ::tolower);
133 std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
134 return tmp.compare(str);
137 int caseCompare(
size_t pos1,
size_t n1,
const char * s)
const 139 std::string tmp(realStr.c_str() + pos1, n1), str(s);
140 std::transform(str.begin(), str.end(), str.begin(), ::tolower);
141 std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
142 return tmp.compare(str);
145 const std::string & asStdString()
const 150 const char * c_str()
const 152 return realStr.c_str();
155 size_t length()
const 157 return realStr.length();
160 SQLString & append(
const std::string & str)
172 const char& operator[](
size_t pos)
const 177 size_t find(
char c,
size_t pos = 0)
const 179 return realStr.find(c, pos);
182 size_t find(
const SQLString & s,
size_t pos = 0)
const 184 return realStr.find(s.realStr, pos);
187 SQLString substr(
size_t pos = 0,
size_t n = npos)
const 189 return realStr.substr(pos, n);
194 realStr.replace(pos1, n1, s.realStr);
198 size_t find_first_of(
char c,
size_t pos = 0)
const 200 return realStr.find_first_of(c, pos);
203 size_t find_last_of(
char c,
size_t pos = npos)
const 205 return realStr.find_last_of(c, pos);
210 realStr += op2.realStr;
226 return (op1.asStdString() == op2.asStdString());
231 return (op1.asStdString() != op2.asStdString());
236 return op1.asStdString() < op2.asStdString();
246 inline ostream & operator << (ostream & os,
const sql::SQLString & str )
248 return os << str.asStdString();
std::string * operator->()
For access std::string methods.
Definition: sqlstring.h:101
Definition: sqlstring.h:243
Definition: callback.h:39
Definition: sqlstring.h:43