------------------------------------------------------------------------------
| 183 | |
| 184 | //------------------------------------------------------------------------------ |
| 185 | vtkStringArray* vtkMySQLDatabase::GetTables() |
| 186 | { |
| 187 | this->Tables->Resize(0); |
| 188 | if (!this->IsOpen()) |
| 189 | { |
| 190 | vtkErrorMacro(<< "GetTables(): Database is closed!"); |
| 191 | return this->Tables; |
| 192 | } |
| 193 | else |
| 194 | { |
| 195 | MYSQL_RES* tableResult = mysql_list_tables(this->Private->Connection, nullptr); |
| 196 | |
| 197 | if (!tableResult) |
| 198 | { |
| 199 | vtkErrorMacro(<< "GetTables(): MySQL returned error: " |
| 200 | << mysql_error(this->Private->Connection)); |
| 201 | return this->Tables; |
| 202 | } |
| 203 | |
| 204 | MYSQL_ROW row; |
| 205 | int i = 0; |
| 206 | |
| 207 | while (tableResult) |
| 208 | { |
| 209 | mysql_data_seek(tableResult, i); |
| 210 | row = mysql_fetch_row(tableResult); |
| 211 | if (!row) |
| 212 | { |
| 213 | break; |
| 214 | } |
| 215 | |
| 216 | this->Tables->InsertNextValue(row[0]); |
| 217 | ++i; |
| 218 | } |
| 219 | // Done with processing so free it |
| 220 | mysql_free_result(tableResult); |
| 221 | |
| 222 | return this->Tables; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | //------------------------------------------------------------------------------ |
| 227 | vtkStringArray* vtkMySQLDatabase::GetRecord(const char* table) |
nothing calls this directly
no test coverage detected