25 typedef boost::tokenizer<boost::char_separator<char> > Tokeniser_T;
30 const boost::char_separator<char>
31 lSepatorList(
" .,;:|+-*/_=!@#$%`~^&(){}[]?'<>\"");
34 Tokeniser_T lTokens (iPhrase, lSepatorList);
35 for (Tokeniser_T::const_iterator tok_iter = lTokens.begin();
36 tok_iter != lTokens.end(); ++tok_iter) {
37 const std::string& lTerm = *tok_iter;
38 ioWordList.push_back (lTerm);
45 const bool iFromBeginningFlag) {
46 std::ostringstream oStr;
50 WordList_T::const_iterator itWord = iWordList.begin();
51 for ( ; itWord != iWordList.end(); ++itWord, ++idx) {
53 if (iFromBeginningFlag ==
true) {
58 if (iSplitIdx != 0 && idx >= iSplitIdx) {
67 const std::string& lWord = *itWord;
75 if (iSplitIdx == 0 || idx >= iSplitIdx) {
82 if (iFromBeginningFlag ==
true) {
87 assert (iFromBeginningFlag ==
false);
90 for ( ; itWord != iWordList.end(); ++itWord, ++idx) {
94 if (idx > iSplitIdx) {
98 const std::string& lWord = *itWord;
110 std::stringstream lConnStream (iSQLDBConnStr);
112 std::vector<std::string> kvList;
113 unsigned short keyDBName = 0;
114 unsigned short keyDBUser = 0;
115 unsigned short keyDBPasswd = 0;
116 unsigned short lastKey = 0;
118 while (std::getline (lConnStream, kvStr,
' ')) {
119 std::stringstream kvStream (kvStr);
122 while (std::getline (kvStream, keyStr,
'=')) {
123 if (keyStr ==
"db") {
128 }
else if (keyStr ==
"user") {
133 }
else if (keyStr ==
"password") {
135 keyDBPasswd = lastKey;
138 }
else if (lastKey == keyDBName) {
139 const bool isSuccess =
140 oStrMap.insert (std::make_pair (
"db", keyStr)).second;
141 if (isSuccess ==
false) {
142 std::ostringstream errStr;
143 errStr <<
"Internal error while inserting the SQL database name ('"
144 << keyDBName <<
"') into the internal STL map";
147 assert (isSuccess ==
true);
150 }
else if (lastKey == keyDBUser) {
151 const bool isSuccess =
152 oStrMap.insert (std::make_pair (
"user", keyStr)).second;
153 if (isSuccess ==
false) {
154 std::ostringstream errStr;
155 errStr <<
"Internal error while inserting the SQL database user ('"
156 << keyDBUser <<
"') into the internal STL map";
159 assert (isSuccess ==
true);
162 }
else if (lastKey == keyDBPasswd) {
163 const bool isSuccess =
164 oStrMap.insert (std::make_pair (
"password", keyStr)).second;
165 if (isSuccess ==
false) {
166 std::ostringstream errStr;
167 errStr <<
"Internal error while inserting the SQL database password "
168 <<
" into the internal STL map";
171 assert (isSuccess ==
true);
181 const StringMap_T::const_iterator itDBName = oStrMap.find (
"db");
182 if (itDBName == oStrMap.end()) {
183 std::ostringstream errStr;
184 errStr <<
"Error when parsing the SQL database connection string ('"
185 << iSQLDBConnStr <<
"'), the 'db' value cannot be found";
191 const StringMap_T::const_iterator itDBUser = oStrMap.find (
"user");
192 if (itDBUser == oStrMap.end()) {
193 std::ostringstream errStr;
194 errStr <<
"Error when parsing the SQL database connection string ('"
195 << iSQLDBConnStr <<
"'), the 'user' value cannot be found";
201 const StringMap_T::const_iterator itDBPasswd = oStrMap.find (
"password");
202 if (itDBPasswd == oStrMap.end()) {
203 std::ostringstream errStr;
204 errStr <<
"Error when parsing the SQL database connection string ('"
205 << iSQLDBConnStr <<
"'), the 'password' value cannot be found";
217 std::ostringstream oStr;
220 const StringMap_T::const_iterator itDBName = iStringMap.find (
"db");
221 assert (itDBName != iStringMap.end());
222 const std::string& lDBName = itDBName->second;
225 const StringMap_T::const_iterator itDBUser = iStringMap.find (
"user");
226 assert (itDBUser != iStringMap.end());
227 const std::string& lDBUser = itDBUser->second;
230 const StringMap_T::const_iterator itDBPasswd = iStringMap.find (
"password");
231 assert (itDBPasswd != iStringMap.end());
232 const std::string& lDBPasswd = itDBPasswd->second;
235 oStr <<
"db=" << lDBName;
236 if (lDBName !=
"mysql") {
237 oStr << iDeploymentNumber;
241 oStr <<
" user=" << lDBUser;
244 oStr <<
" password=" << lDBPasswd;