VTK  9.3.1
vtkQtSQLQuery.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
12 #ifndef vtkQtSQLQuery_h
13 #define vtkQtSQLQuery_h
14 
15 #include "vtkGUISupportQtSQLModule.h" // For export macro
16 #include "vtkSQLQuery.h"
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkVariant;
20 class vtkQtSQLQueryInternals;
21 
22 class VTKGUISUPPORTQTSQL_EXPORT vtkQtSQLQuery : public vtkSQLQuery
23 {
24 public:
25  static vtkQtSQLQuery* New();
26  vtkTypeMacro(vtkQtSQLQuery, vtkSQLQuery);
27  void PrintSelf(ostream& os, vtkIndent indent) override;
28 
34  bool Execute() override;
35 
39  int GetNumberOfFields() override;
40 
44  const char* GetFieldName(int col) override;
45 
49  int GetFieldType(int col) override;
50 
54  bool NextRow() override;
55 
59  vtkVariant DataValue(vtkIdType c) override;
60 
64  bool HasError() override;
65 
69  const char* GetLastErrorText() override;
70 
71 protected:
72  vtkQtSQLQuery();
73  ~vtkQtSQLQuery() override;
74 
75  vtkQtSQLQueryInternals* Internals;
76  friend class vtkQtSQLDatabase;
77 
78 private:
79  // Using the convenience function internally
80  vtkSetStringMacro(LastErrorText);
81 
82  char* LastErrorText;
83 
84  vtkQtSQLQuery(const vtkQtSQLQuery&) = delete;
85  void operator=(const vtkQtSQLQuery&) = delete;
86 };
87 
88 VTK_ABI_NAMESPACE_END
89 #endif // vtkQtSQLQuery_h
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool NextRow()=0
Advance row, return false if past end.
bool Execute() override=0
Execute the query.
virtual const char * GetFieldName(int i)=0
Return the name of the specified query field.
int vtkIdType
Definition: vtkType.h:315
A type representing the union of many types.
Definition: vtkVariant.h:52
virtual bool HasError()=0
Returns true if an error is set, otherwise false.
query class associated with vtkQtSQLDatabase
Definition: vtkQtSQLQuery.h:22
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int GetNumberOfFields()=0
The number of fields in the query result.
vtkQtSQLQueryInternals * Internals
Definition: vtkQtSQLQuery.h:75
virtual int GetFieldType(int i)=0
Return the type of the field, using the constants defined in vtkType.h.
virtual vtkVariant DataValue(vtkIdType c)=0
Return data in current row, field c.
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:59
virtual const char * GetLastErrorText()=0
Get the last error text from the query.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
friend class vtkQtSQLQuery
maintains a connection to an sql database