MCPcopy Create free account
hub / github.com/Kitware/VTK / GetTables

Method GetTables

IO/PostgreSQL/vtkPostgreSQLDatabase.cxx:394–427  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

392
393//------------------------------------------------------------------------------
394vtkStringArray* 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//------------------------------------------------------------------------------
430vtkStringArray* vtkPostgreSQLDatabase::GetRecord(const char* table)

Callers

nothing calls this directly

Calls 10

GetLastErrorTextMethod · 0.95
GetQueryInstanceMethod · 0.95
DeleteMethod · 0.65
ResizeMethod · 0.45
SetQueryMethod · 0.45
ExecuteMethod · 0.45
NextRowMethod · 0.45
InsertNextValueMethod · 0.45
ToStringMethod · 0.45
DataValueMethod · 0.45

Tested by

no test coverage detected