VTK  9.3.20240425
vtkSQLiteQuery.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
28#ifndef vtkSQLiteQuery_h
29#define vtkSQLiteQuery_h
30
31#include "vtkIOSQLModule.h" // For export macro
32#include "vtkSQLQuery.h"
33
34VTK_ABI_NAMESPACE_BEGIN
36class vtkVariant;
37class vtkVariantArray;
38
39class VTKIOSQL_EXPORT vtkSQLiteQuery : public vtkSQLQuery
40{
41
42 friend class vtkSQLiteDatabase;
43
44public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
48
53 bool SetQuery(const char* query) override;
54
60 bool Execute() override;
61
65 int GetNumberOfFields() override;
66
70 const char* GetFieldName(int i) override;
71
75 int GetFieldType(int i) override;
76
80 bool NextRow() override;
81
85 bool HasError() override;
86
88
91 bool BeginTransaction() override;
92 bool RollbackTransaction() override;
93 bool CommitTransaction() override;
95
100
104 const char* GetLastErrorText() override;
105
115 bool BindParameter(int index, unsigned char value) override;
116 bool BindParameter(int index, signed char value) override;
117 bool BindParameter(int index, unsigned short value) override;
118 bool BindParameter(int index, short value) override;
119 bool BindParameter(int index, unsigned int value) override;
120
121 bool BindParameter(int index, int value) override;
122
123 bool BindParameter(int index, unsigned long value) override;
124 bool BindParameter(int index, long value) override;
125 bool BindParameter(int index, unsigned long long value) override;
126 bool BindParameter(int index, long long value) override;
127
128 bool BindParameter(int index, float value) override;
129 bool BindParameter(int index, double value) override;
133 bool BindParameter(int index, const char* stringValue) override;
137 bool BindParameter(int index, const char* stringValue, size_t length) override;
138
139 bool BindParameter(int index, const vtkStdString& string) override;
140
141 bool BindParameter(int index, vtkVariant value) override;
143
148 bool BindParameter(int index, const void* data, size_t length) override;
149 bool ClearParameterBindings() override;
151
152protected:
154 ~vtkSQLiteQuery() override;
155
156 vtkSetStringMacro(LastErrorText);
157
158private:
159 vtkSQLiteQuery(const vtkSQLiteQuery&) = delete;
160 void operator=(const vtkSQLiteQuery&) = delete;
161
162 class Priv;
163 Priv* Private;
164 bool InitialFetch;
165 int InitialFetchResult;
166 char* LastErrorText;
167 bool TransactionInProgress;
168
170
174 bool BindIntegerParameter(int index, int value);
175 bool BindDoubleParameter(int index, double value);
176 bool BindInt64Parameter(int index, vtkTypeInt64 value);
177 bool BindStringParameter(int index, const char* data, int length);
178 bool BindBlobParameter(int index, const void* data, int length);
180};
181
182VTK_ABI_NAMESPACE_END
183#endif // vtkSQLiteQuery_h
a simple class to control print indentation
Definition vtkIndent.h:108
executes an sql query and retrieves results
Definition vtkSQLQuery.h:60
virtual bool BindParameter(int index, unsigned char value)
Bind a parameter to a placeholder in a query.
maintain a connection to an SQLite database
vtkSQLQuery implementation for SQLite databases
int GetFieldType(int i) override
Return the type of the field, using the constants defined in vtkType.h.
bool BindParameter(int index, long value) override
bool BindParameter(int index, const void *data, size_t length) override
Bind a blob value.
~vtkSQLiteQuery() override
bool BindParameter(int index, unsigned long long value) override
bool BindParameter(int index, unsigned long value) override
bool BindParameter(int index, float value) override
bool NextRow() override
Advance row, return false if past end.
bool BindParameter(int index, unsigned int value) override
bool BindParameter(int index, const char *stringValue, size_t length) override
Bind a string value by specifying an array and a size.
static vtkSQLiteQuery * New()
bool Execute() override
Execute the query.
bool BindParameter(int index, double value) override
const char * GetLastErrorText() override
Get the last error text from the query.
bool BindParameter(int index, unsigned char value) override
Bind a parameter to a placeholder in a query.
bool ClearParameterBindings() override
Bind a blob value.
bool RollbackTransaction() override
Begin, abort (roll back), or commit a transaction.
bool SetQuery(const char *query) override
Set the SQL query string.
const char * GetFieldName(int i) override
Return the name of the specified query field.
bool CommitTransaction() override
Begin, abort (roll back), or commit a transaction.
bool BindParameter(int index, signed char value) override
bool BindParameter(int index, const char *stringValue) override
Bind a string value – string must be null-terminated.
bool BindParameter(int index, short value) override
bool BindParameter(int index, unsigned short value) override
bool BindParameter(int index, vtkVariant value) override
int GetNumberOfFields() override
The number of fields in the query result.
bool BindParameter(int index, int value) override
bool BeginTransaction() override
Begin, abort (roll back), or commit a transaction.
bool HasError() override
Return true if there is an error on the current query.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool BindParameter(int index, const vtkStdString &string) override
bool BindParameter(int index, long long value) override
vtkVariant DataValue(vtkIdType c) override
Return data in current row, field c.
Wrapper around std::string to keep symbols short.
An array holding vtkVariants.
A type representing the union of many types.
Definition vtkVariant.h:162
int vtkIdType
Definition vtkType.h:315