VTK  9.1.0
vtkSQLiteQuery.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSQLiteQuery.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
44#ifndef vtkSQLiteQuery_h
45#define vtkSQLiteQuery_h
46
47#include "vtkIOSQLModule.h" // For export macro
48#include "vtkSQLQuery.h"
49
51class vtkVariant;
52class vtkVariantArray;
53
54class VTKIOSQL_EXPORT vtkSQLiteQuery : public vtkSQLQuery
55{
56
57 friend class vtkSQLiteDatabase;
58
59public:
61 void PrintSelf(ostream& os, vtkIndent indent) override;
63
68 bool SetQuery(const char* query) override;
69
75 bool Execute() override;
76
80 int GetNumberOfFields() override;
81
85 const char* GetFieldName(int i) override;
86
90 int GetFieldType(int i) override;
91
95 bool NextRow() override;
96
100 bool HasError() override;
101
103
106 bool BeginTransaction() override;
107 bool RollbackTransaction() override;
108 bool CommitTransaction() override;
110
115
119 const char* GetLastErrorText() override;
120
130 bool BindParameter(int index, unsigned char value) override;
131 bool BindParameter(int index, signed char value) override;
132 bool BindParameter(int index, unsigned short value) override;
133 bool BindParameter(int index, short value) override;
134 bool BindParameter(int index, unsigned int value) override;
135
136 bool BindParameter(int index, int value) override;
137
138 bool BindParameter(int index, unsigned long value) override;
139 bool BindParameter(int index, long value) override;
140 bool BindParameter(int index, unsigned long long value) override;
141 bool BindParameter(int index, long long value) override;
142
143 bool BindParameter(int index, float value) override;
144 bool BindParameter(int index, double value) override;
148 bool BindParameter(int index, const char* stringValue) override;
152 bool BindParameter(int index, const char* stringValue, size_t length) override;
153
154 bool BindParameter(int index, const vtkStdString& string) override;
155
156 bool BindParameter(int index, vtkVariant value) override;
158
163 bool BindParameter(int index, const void* data, size_t length) override;
164 bool ClearParameterBindings() override;
166
167protected:
169 ~vtkSQLiteQuery() override;
170
171 vtkSetStringMacro(LastErrorText);
172
173private:
174 vtkSQLiteQuery(const vtkSQLiteQuery&) = delete;
175 void operator=(const vtkSQLiteQuery&) = delete;
176
177 class Priv;
178 Priv* Private;
179 bool InitialFetch;
180 int InitialFetchResult;
181 char* LastErrorText;
182 bool TransactionInProgress;
183
185
189 bool BindIntegerParameter(int index, int value);
190 bool BindDoubleParameter(int index, double value);
191 bool BindInt64Parameter(int index, vtkTypeInt64 value);
192 bool BindStringParameter(int index, const char* data, int length);
193 bool BindBlobParameter(int index, const void* data, int length);
195};
196
197#endif // vtkSQLiteQuery_h
a simple class to control print indentation
Definition: vtkIndent.h:113
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:69
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.
Definition: vtkStdString.h:105
An array holding vtkVariants.
A atomic type representing the union of many types.
Definition: vtkVariant.h:145
int vtkIdType
Definition: vtkType.h:332