VTK: IO/ODBC/vtkODBCQuery.h Source File

| VTK 9.3.1

vtkODBCQuery.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
18 #ifndef vtkODBCQuery_h
19 #define vtkODBCQuery_h
20
21 #include "vtkIOODBCModule.h" // For export macro
22 #include "vtkSQLQuery.h"
23
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkODBCDatabase;
26 class vtkVariant;
27 class vtkVariantArray;
28 class vtkODBCInternals;
29 class vtkODBCQueryInternals;
30
31 class VTKIOODBC_EXPORT vtkODBCQuery : public vtkSQLQuery
32 {
33
34 friend class vtkODBCDatabase;
35
36 public:
37 vtkTypeMacro(vtkODBCQuery, vtkSQLQuery);
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39 static vtkODBCQuery* New();
40
46 bool Execute() override;
47
51 int GetNumberOfFields() override;
52
56 const char* GetFieldName(int i) override;
57
61 int GetFieldType(int i) override;
62
66 bool NextRow() override;
67
71 bool HasError() override;
72
76 vtkVariant DataValue(vtkIdType c) override;
77
81 const char* GetLastErrorText() override;
82
84
87 bool BeginTransaction() override;
88 bool CommitTransaction() override;
89 bool RollbackTransaction() override;
91
93
98 bool SetQuery(const char* queryString) override;
99 const char* GetQuery() override;
101
110 using vtkSQLQuery::BindParameter;
111 bool BindParameter(int index, unsigned char value) override;
112 bool BindParameter(int index, signed char value) override;
113 bool BindParameter(int index, unsigned short value) override;
114 bool BindParameter(int index, signed short value) override;
115 bool BindParameter(int index, unsigned int value) override;
116
117 bool BindParameter(int index, int value) override;
118
119 bool BindParameter(int index, unsigned long value) override;
120 bool BindParameter(int index, signed long value) override;
121 bool BindParameter(int index, unsigned long long value) override;
122 bool BindParameter(int index, long long value) override;
123
124 bool BindParameter(int index, float value) override;
125 bool BindParameter(int index, double value) override;
129 bool BindParameter(int index, const char* stringValue) override;
131
134 bool BindParameter(int index, const char* stringValue, size_t length) override;
135 bool BindParameter(int index, const vtkStdString& string) override;
138
143 bool BindParameter(int index, const void* data, size_t length) override;
144 bool ClearParameterBindings() override;
146
147 protected:
148 vtkODBCQuery();
149 ~vtkODBCQuery() override;
150
151 vtkSetStringMacro(LastErrorText);
152 vtkSetStringMacro(QueryText);
153 vtkGetStringMacro(QueryText);
154
155 char* QueryText;
156
157 private:
158 vtkODBCQuery(const vtkODBCQuery&) = delete;
159 void operator=(const vtkODBCQuery&) = delete;
160
161 void ClearCurrentRow();
162 bool CacheCurrentRow();
163
164 bool CacheTimeColumn(int column);
165 bool CacheIntervalColumn(int column);
166 bool CacheCharColumn(int column);
167 bool CacheLongLongColumn(int column);
168 bool CacheBinaryColumn(int column);
169 bool CacheBooleanColumn(int column);
170 bool CacheStringColumn(int column);
171 bool CacheWideStringColumn(int column);
172 bool CacheDecimalColumn(int column);
173 bool CacheNumericColumn(int column);
174 bool CacheIntColumn(int column);
175 bool CacheFloatColumn(int column);
176 bool CacheDoubleColumn(int column);
177
178 vtkODBCQueryInternals* Internals;
179 bool InitialFetch;
180 char* LastErrorText;
181 };
182
183 VTK_ABI_NAMESPACE_END
184 #endif // vtkODBCQuery_h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkODBCDatabase
maintain an ODBC connection to a SQL database
Definition: vtkODBCDatabase.h:70
vtkODBCDatabase::vtkODBCQuery
friend class vtkODBCQuery
Definition: vtkODBCDatabase.h:72
vtkODBCInternals
Simple class to hide ODBC structures.
Definition: vtkODBCInternals.h:26
vtkODBCQuery
vtkSQLQuery implementation for ODBC connections to databases
Definition: vtkODBCQuery.h:32
vtkODBCQuery::BindParameter
bool BindParameter(int index, int value) override
vtkODBCQuery::BindParameter
bool BindParameter(int index, unsigned short value) override
vtkODBCQuery::vtkODBCQuery
vtkODBCQuery()
vtkODBCQuery::HasError
bool HasError() override
Return true if there is an error on the current query.
vtkODBCQuery::BindParameter
bool BindParameter(int index, float value) override
vtkODBCQuery::BindParameter
bool BindParameter(int index, double value) override
vtkODBCQuery::BindParameter
bool BindParameter(int index, signed char value) override
vtkODBCQuery::BindParameter
bool BindParameter(int index, unsigned long value) override
vtkODBCQuery::GetLastErrorText
const char * GetLastErrorText() override
Get the last error text from the query.
vtkODBCQuery::GetFieldType
int GetFieldType(int i) override
Return the type of the field, using the constants defined in vtkType.h.
vtkODBCQuery::BindParameter
bool BindParameter(int index, long long value) override
vtkODBCQuery::BeginTransaction
bool BeginTransaction() override
Begin, commit, or roll back a transaction.
vtkODBCQuery::New
static vtkODBCQuery * New()
vtkODBCQuery::GetFieldName
const char * GetFieldName(int i) override
Return the name of the specified query field.
vtkODBCQuery::BindParameter
bool BindParameter(int index, unsigned long long value) override
vtkODBCQuery::CommitTransaction
bool CommitTransaction() override
Begin, commit, or roll back a transaction.
vtkODBCQuery::BindParameter
bool BindParameter(int index, const char *stringValue) override
Bind a string value – string must be null-terminated.
vtkODBCQuery::BindParameter
bool BindParameter(int index, signed short value) override
vtkODBCQuery::~vtkODBCQuery
~vtkODBCQuery() override
vtkODBCQuery::GetQuery
const char * GetQuery() override
Set the query string to be used.
vtkODBCQuery::BindParameter
bool BindParameter(int index, unsigned char value) override
Bind a parameter to a placeholder in a query.
vtkODBCQuery::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkODBCQuery::Execute
bool Execute() override
Execute the query.
vtkODBCQuery::ClearParameterBindings
bool ClearParameterBindings() override
Bind a blob value.
vtkODBCQuery::BindParameter
bool BindParameter(int index, unsigned int value) override
vtkODBCQuery::SetQuery
bool SetQuery(const char *queryString) override
Set the query string to be used.
vtkODBCQuery::BindParameter
bool BindParameter(int index, const vtkStdString &string) override
Bind a string value by specifying an array and a size.
vtkODBCQuery::RollbackTransaction
bool RollbackTransaction() override
Begin, commit, or roll back a transaction.
vtkODBCQuery::BindParameter
bool BindParameter(int index, const char *stringValue, size_t length) override
Bind a string value by specifying an array and a size.
vtkODBCQuery::DataValue
vtkVariant DataValue(vtkIdType c) override
Return data in current row, field c.
vtkODBCQuery::NextRow
bool NextRow() override
Advance row, return false if past end.
vtkODBCQuery::QueryText
char * QueryText
Definition: vtkODBCQuery.h:153
vtkODBCQuery::GetNumberOfFields
int GetNumberOfFields() override
The number of fields in the query result.
vtkODBCQuery::BindParameter
bool BindParameter(int index, const void *data, size_t length) override
Bind a blob value.
vtkODBCQuery::BindParameter
bool BindParameter(int index, signed long value) override
vtkSQLQuery
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:60
vtkSQLQuery::BindParameter
virtual bool BindParameter(int index, unsigned char value)
Bind a parameter to a placeholder in a query.
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:47
vtkVariant
A type representing the union of many types.
Definition: vtkVariant.h:62
vtkX3D::length
@ length
Definition: vtkX3D.h:393
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkSQLQuery.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315