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

Method RequestData

IO/SQL/vtkSQLDatabaseTableSource.cxx:151–264  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

149
150//------------------------------------------------------------------------------
151int vtkSQLDatabaseTableSource::RequestData(
152 vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector)
153{
154 if (this->Implementation->URL.empty())
155 return 1;
156
157 if (this->Implementation->QueryString.empty())
158 return 1;
159
160 if (!this->PedigreeIdArrayName)
161 {
162 vtkErrorMacro(<< "You must specify a pedigree id array name.");
163 return 0;
164 }
165
166 if (!this->Implementation->Database)
167 {
168 this->Implementation->Database =
169 vtkSQLDatabase::CreateFromURL(this->Implementation->URL.c_str());
170 if (!this->Implementation->Database)
171 {
172 vtkErrorMacro(<< "Error creating database using URL: " << this->Implementation->URL);
173 return 0;
174 }
175
176 if (!this->Implementation->Database->Open(this->Implementation->Password.c_str()))
177 {
178 this->Implementation->Database->Delete();
179 this->Implementation->Database = nullptr;
180
181 vtkErrorMacro(<< "Error opening database: " << this->Implementation->URL);
182 return 0;
183 }
184 }
185
186 if (!this->Implementation->Query)
187 {
188 this->Implementation->Query = this->Implementation->Database->GetQueryInstance();
189 if (!this->Implementation->Query)
190 {
191 vtkErrorMacro(<< "Internal error creating query instance.");
192 return 0;
193 }
194 }
195
196 // Set Progress Text
197 this->SetProgressText("DatabaseTableSource");
198
199 // I have a database: 5% progress
200 this->UpdateProgress(.05);
201
202 this->Implementation->Query->SetQuery(this->Implementation->QueryString.c_str());
203 if (!this->Implementation->Query->Execute())
204 {
205 vtkErrorMacro(<< "Error executing query: " << this->Implementation->QueryString);
206 return 0;
207 }
208

Callers

nothing calls this directly

Calls 15

SetProgressTextMethod · 0.80
GetInformationObjectMethod · 0.80
SetPedigreeIdsMethod · 0.80
GetRowDataMethod · 0.80
GetColumnByNameMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45
OpenMethod · 0.45
GetQueryInstanceMethod · 0.45
UpdateProgressMethod · 0.45

Tested by

no test coverage detected