------------------------------------------------------------------------------
| 380 | |
| 381 | //------------------------------------------------------------------------------ |
| 382 | vtkStringArray* vtkSQLiteDatabase::GetRecord(const char* table) |
| 383 | { |
| 384 | vtkSQLQuery* query = this->GetQueryInstance(); |
| 385 | std::string text("PRAGMA table_info ('"); |
| 386 | text += table; |
| 387 | text += "')"; |
| 388 | |
| 389 | query->SetQuery(text.c_str()); |
| 390 | bool status = query->Execute(); |
| 391 | if (!status) |
| 392 | { |
| 393 | vtkErrorMacro(<< "GetRecord(" << table << "): Database returned error: " |
| 394 | << sqlite3_errmsg(this->Internal->SQLiteInstance)); |
| 395 | query->Delete(); |
| 396 | return nullptr; |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | // Each row in the results that come back from this query |
| 401 | // describes a single column in the table. The format of each row |
| 402 | // is as follows: |
| 403 | // |
| 404 | // columnID columnName columnType ??? defaultValue nullForbidden |
| 405 | // |
| 406 | // (I don't know what the ??? column is. It's probably maximum |
| 407 | // length.) |
| 408 | vtkStringArray* results = vtkStringArray::New(); |
| 409 | |
| 410 | while (query->NextRow()) |
| 411 | { |
| 412 | results->InsertNextValue(query->DataValue(1).ToString()); |
| 413 | } |
| 414 | |
| 415 | query->Delete(); |
| 416 | return results; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | //------------------------------------------------------------------------------ |
| 421 | vtkStdString vtkSQLiteDatabase::GetURL() |
nothing calls this directly
no test coverage detected