| | |
| | | return rowDataList; |
| | | } |
| | | |
| | | static Json::Value findJsonArray(string sql) { |
| | | static Json::Value findJsonArray(string sql, std::map<std::string, std::string>& whereColumns) { |
| | | sql = sql + getWhereColumnNameValuePair(whereColumns); |
| | | initConnection(); |
| | | mysqlpp::Query query = conn->query(sql); |
| | | Json::Value rowList; |
| | |
| | | rowList.append(row); |
| | | } |
| | | } else { |
| | | cout << "error " <<query.error() << endl; |
| | | cout << "query failed" << endl; |
| | | } |
| | | return rowList; |
| | |
| | | return updateSql; |
| | | } |
| | | static void doConnect() { |
| | | cout << "db_host=" << appConfig.getStringProperty("db_host").c_str() << endl; |
| | | if (conn->connect( |
| | | appConfig.getStringProperty("database").c_str(), |
| | | appConfig.getStringProperty("db_host").c_str(), |