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

Method GetTables

IO/MySQL/vtkMySQLDatabase.cxx:185–224  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

183
184//------------------------------------------------------------------------------
185vtkStringArray* 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//------------------------------------------------------------------------------
227vtkStringArray* vtkMySQLDatabase::GetRecord(const char* table)

Callers

nothing calls this directly

Calls 3

IsOpenMethod · 0.95
ResizeMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected