------------------------------------------------------------------------------
| 392 | |
| 393 | //------------------------------------------------------------------------------ |
| 394 | vtkStringArray* vtkPostgreSQLDatabase::GetTables() |
| 395 | { |
| 396 | this->Tables->Resize(0); |
| 397 | if (!this->Connection) |
| 398 | { |
| 399 | vtkErrorMacro(<< this->GetLastErrorText()); |
| 400 | return this->Tables; |
| 401 | } |
| 402 | |
| 403 | // NB: Other columns of interest include table_catalog, table_schema, table_type, |
| 404 | // self_referencing_column_name, reference_generation, user_defined_type_catalog, |
| 405 | // user_defined_type_schema, user_defined_type_name, is_insertable_into, is_typed, |
| 406 | // commit_action |
| 407 | vtkSQLQuery* query = this->GetQueryInstance(); |
| 408 | query->SetQuery("SELECT table_name FROM information_schema.tables" |
| 409 | " WHERE table_schema='public' and table_type='BASE TABLE'"); |
| 410 | bool status = query->Execute(); |
| 411 | |
| 412 | if (!status) |
| 413 | { |
| 414 | vtkErrorMacro(<< "Database returned error: " << query->GetLastErrorText()); |
| 415 | this->SetLastErrorText(query->GetLastErrorText()); |
| 416 | query->Delete(); |
| 417 | return this->Tables; |
| 418 | } |
| 419 | vtkDebugMacro(<< "GetTables(): SQL query succeeded."); |
| 420 | while (query->NextRow()) |
| 421 | { |
| 422 | this->Tables->InsertNextValue(query->DataValue(0).ToString()); |
| 423 | } |
| 424 | query->Delete(); |
| 425 | this->SetLastErrorText(nullptr); |
| 426 | return this->Tables; |
| 427 | } |
| 428 | |
| 429 | //------------------------------------------------------------------------------ |
| 430 | vtkStringArray* vtkPostgreSQLDatabase::GetRecord(const char* table) |
nothing calls this directly
no test coverage detected