| 137 | } |
| 138 | |
| 139 | int MySQLCommand::GetResults(vector<vector<string> > *results, vector<string> *fields) { |
| 140 | MYSQL_RES *result = mysql_store_result(mysql_); |
| 141 | if (NULL != result) { |
| 142 | int row_count = result->row_count; |
| 143 | int field_count = result->field_count; |
| 144 | if (fields) { |
| 145 | for (int i = 0; i < field_count; ++i) { |
| 146 | fields->push_back(result->fields[i].name); |
| 147 | } |
| 148 | } |
| 149 | for (int i = 0; i < row_count; ++i) { |
| 150 | MYSQL_ROW row = mysql_fetch_row(result); |
| 151 | |
| 152 | if (NULL != row) { |
| 153 | vector < string > result_row; |
| 154 | for (int j = 0; j < field_count; ++j) { |
| 155 | result_row.push_back(row[j] ? row[j] : ""); |
| 156 | } |
| 157 | results->push_back(result_row); |
| 158 | |
| 159 | } else { |
| 160 | break; |
| 161 | } |
| 162 | } |
| 163 | mysql_free_result(result); |
| 164 | } else { |
| 165 | return OK; |
| 166 | } |
| 167 | |
| 168 | return OK; |
| 169 | } |
| 170 | |
| 171 | } |
| 172 |
nothing calls this directly
no outgoing calls
no test coverage detected