1010 * copies of the Software, and to permit persons to whom the Software is
1111 * furnished to do so, subject to the following conditions:
1212 *
13- * The above copyright notice and this permission notice shall be included in all
14- * copies or substantial portions of the Software.
13+ * The above copyright notice and this permission notice shall be included in
14+ *all copies or substantial portions of the Software.
1515 *
1616 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2828// ---------------------------------------------------------------------
2929// WsjcppSqlBuilder
3030
31- WsjcppSqlBuilder::WsjcppSqlBuilder (
32- WsjcppSqlBuilderType nSqlType, const std::string &sSqlTable
33- ) {
31+ WsjcppSqlBuilder::WsjcppSqlBuilder (WsjcppSqlBuilderType nSqlType,
32+ const std::string &sSqlTable ) {
3433 m_nSqlType = nSqlType;
3534 m_sSqlTable = sSqlTable ;
3635 m_bValid = true ;
@@ -59,7 +58,8 @@ bool WsjcppSqlBuilder::sel(const std::string &sColumnName) {
5958 return true ;
6059}
6160
62- bool WsjcppSqlBuilder::add (const std::string &sColumnName , const std::string &sValue ) {
61+ bool WsjcppSqlBuilder::add (const std::string &sColumnName ,
62+ const std::string &sValue ) {
6363 if (!checkName (sColumnName )) {
6464 return false ;
6565 }
@@ -87,8 +87,8 @@ bool WsjcppSqlBuilder::add(const std::string &sColumnName, const std::string &sV
8787 // /* Make the replacement. */
8888 // str.replace(index, 3, "def");
8989
90- // /* Advance index forward so the next iteration doesn't pick it up as well. */
91- // index += 3;
90+ // /* Advance index forward so the next iteration doesn't pick it up as
91+ // well. */ index += 3;
9292 // }
9393 return true ;
9494}
@@ -129,7 +129,8 @@ bool WsjcppSqlBuilder::add(const std::string &sColumnName, long nValue) {
129129 return true ;
130130}
131131
132- bool WsjcppSqlBuilder::where (const std::string &sColumnName , const std::string &sValue ) {
132+ bool WsjcppSqlBuilder::where (const std::string &sColumnName ,
133+ const std::string &sValue ) {
133134 if (!checkName (sColumnName )) {
134135 return false ;
135136 }
@@ -183,18 +184,22 @@ std::string WsjcppSqlBuilder::getTextQuery() {
183184 if (m_nSqlType == WsjcppSqlBuilderType::SELECT) {
184185 // TODO refactor this to vector and join
185186 sSqlQuery = m_sSqlQuery0;
186- if (size0 > 2 && m_sSqlQuery0[size0 - 1 ] == ' ' && m_sSqlQuery0[size0 - 2 ] == ' ,' ) {
187+ if (size0 > 2 && m_sSqlQuery0[size0 - 1 ] == ' ' &&
188+ m_sSqlQuery0[size0 - 2 ] == ' ,' ) {
187189 sSqlQuery += m_sSqlQuery0.substr (0 , size0 - 2 );
188190 }
189191 sSqlQuery += m_sSqlQuery1;
190- if (size2 > 2 && m_sSqlQuery2[size2 - 1 ] == ' ' && m_sSqlQuery2[size2 - 2 ] == ' ,' ) {
192+ if (size2 > 2 && m_sSqlQuery2[size2 - 1 ] == ' ' &&
193+ m_sSqlQuery2[size2 - 2 ] == ' ,' ) {
191194 sSqlQuery += m_sSqlQuery2.substr (0 , size2 - 2 );
192195 }
193196 } else if (m_nSqlType == WsjcppSqlBuilderType::INSERT) {
194- if (size0 > 2 && m_sSqlQuery0[size0 - 1 ] == ' ' && m_sSqlQuery0[size0 - 2 ] == ' ,' ) {
197+ if (size0 > 2 && m_sSqlQuery0[size0 - 1 ] == ' ' &&
198+ m_sSqlQuery0[size0 - 2 ] == ' ,' ) {
195199 sSqlQuery += m_sSqlQuery0.substr (0 , size0 - 2 );
196200 }
197- if (size1 > 2 && m_sSqlQuery1[size1 - 1 ] == ' ' && m_sSqlQuery1[size1 - 2 ] == ' ,' ) {
201+ if (size1 > 2 && m_sSqlQuery1[size1 - 1 ] == ' ' &&
202+ m_sSqlQuery1[size1 - 2 ] == ' ,' ) {
198203 sSqlQuery += m_sSqlQuery1.substr (0 , size1 - 2 );
199204 }
200205 sSqlQuery += m_sSqlQuery2;
@@ -210,7 +215,8 @@ std::string WsjcppSqlBuilder::getErrorMessage() { return m_sErrorMessage; }
210215
211216bool WsjcppSqlBuilder::checkName (const std::string &sColumnName ) {
212217 if (sColumnName .size () < 2 ) {
213- m_sErrorMessage = " Parameter '" + sColumnName + " ' must more than 2 characters" ;
218+ m_sErrorMessage =
219+ " Parameter '" + sColumnName + " ' must more than 2 characters" ;
214220 m_bValid = false ;
215221 return false ;
216222 }
@@ -264,16 +270,16 @@ std::string WsjcppSqlBuilder::prepareStringValue(const std::string &sValue) {
264270// WsjcppSqlBuilderSelect
265271
266272WsjcppSqlBuilderSelect::WsjcppSqlBuilderSelect (const std::string &sSqlTable )
267- : WsjcppSqlBuilder(WsjcppSqlBuilderType::SELECT, sSqlTable ) {}
273+ : WsjcppSqlBuilder(WsjcppSqlBuilderType::SELECT, sSqlTable ) {}
268274
269275// ---------------------------------------------------------------------
270276// WsjcppSqlBuilderInsert
271277
272278WsjcppSqlBuilderInsert::WsjcppSqlBuilderInsert (const std::string &sSqlTable )
273- : WsjcppSqlBuilder(WsjcppSqlBuilderType::INSERT, sSqlTable ) {}
279+ : WsjcppSqlBuilder(WsjcppSqlBuilderType::INSERT, sSqlTable ) {}
274280
275281// ---------------------------------------------------------------------
276282// WsjcppSqlBuilderUpdate
277283
278284WsjcppSqlBuilderUpdate::WsjcppSqlBuilderUpdate (const std::string &sSqlTable )
279- : WsjcppSqlBuilder(WsjcppSqlBuilderType::UPDATE, sSqlTable ) {}
285+ : WsjcppSqlBuilder(WsjcppSqlBuilderType::UPDATE, sSqlTable ) {}
0 commit comments