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

Method Execute

IO/SQL/vtkSQLiteQuery.cxx:169–219  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

167
168//------------------------------------------------------------------------------
169bool vtkSQLiteQuery::Execute()
170{
171
172 if (this->Query == nullptr)
173 {
174 vtkErrorMacro(<< "Cannot execute before a query has been set.");
175 return false;
176 }
177
178 if (this->Private->Statement == nullptr)
179 {
180 vtkErrorMacro(<< "Execute(): Query is not null but prepared statement is. There may have been "
181 "an error during SetQuery().");
182 this->Active = false;
183 return false;
184 }
185 else
186 {
187 sqlite3_reset(this->Private->Statement);
188 }
189
190 vtkDebugMacro(<< "Execute(): Query ready to execute.");
191
192 this->InitialFetch = true;
193 int result = sqlite3_step(this->Private->Statement);
194 this->InitialFetchResult = result;
195
196 if (result == SQLITE_DONE)
197 {
198 this->SetLastErrorText(nullptr);
199 this->Active = true;
200 return true;
201 }
202 else if (result != SQLITE_ROW)
203 {
204 vtkSQLiteDatabase* dbContainer = vtkSQLiteDatabase::SafeDownCast(this->Database);
205 assert(dbContainer != nullptr);
206
207 sqlite3* db = dbContainer->Internal->SQLiteInstance;
208
209 this->SetLastErrorText(sqlite3_errmsg(db));
210 vtkDebugMacro(<< "Execute(): sqlite3_step() returned error message "
211 << this->GetLastErrorText());
212 this->Active = false;
213 return false;
214 }
215
216 this->SetLastErrorText(nullptr);
217 this->Active = true;
218 return true;
219}
220
221//------------------------------------------------------------------------------
222int vtkSQLiteQuery::GetNumberOfFields()

Callers 11

WriteDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
EffectSchemaMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
GetTablesMethod · 0.45
GetRecordMethod · 0.45
TestSQLiteDatabaseFunction · 0.45
TestSQLiteTableReadWriteFunction · 0.45
TestSQLGraphReaderFunction · 0.45

Calls 2

GetLastErrorTextMethod · 0.95
assertFunction · 0.50

Tested by 3

TestSQLiteDatabaseFunction · 0.36
TestSQLiteTableReadWriteFunction · 0.36
TestSQLGraphReaderFunction · 0.36