VTK  9.1.0
vtkODBCQuery.h
Go to the documentation of this file.
1/* -*- Mode: C++; -*- */
2/*=========================================================================
3
4 Program: Visualization Toolkit
5 Module: vtkODBCQuery.h
6
7 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8 All rights reserved.
9 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16/*-------------------------------------------------------------------------
17 Copyright 2008 Sandia Corporation.
18 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
19 the U.S. Government retains certain rights in this software.
20-------------------------------------------------------------------------*/
21
36#ifndef vtkODBCQuery_h
37#define vtkODBCQuery_h
38
39#include "vtkIOODBCModule.h" // For export macro
40#include "vtkSQLQuery.h"
41
42class vtkODBCDatabase;
43class vtkVariant;
44class vtkVariantArray;
46class vtkODBCQueryInternals;
47
48class VTKIOODBC_EXPORT vtkODBCQuery : public vtkSQLQuery
49{
50
51 friend class vtkODBCDatabase;
52
53public:
54 vtkTypeMacro(vtkODBCQuery, vtkSQLQuery);
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56 static vtkODBCQuery* New();
57
63 bool Execute() override;
64
68 int GetNumberOfFields() override;
69
73 const char* GetFieldName(int i) override;
74
78 int GetFieldType(int i) override;
79
83 bool NextRow() override;
84
88 bool HasError() override;
89
94
98 const char* GetLastErrorText() override;
99
101
104 bool BeginTransaction() override;
105 bool CommitTransaction() override;
106 bool RollbackTransaction() override;
108
110
115 bool SetQuery(const char* queryString) override;
116 const char* GetQuery() override;
118
128 bool BindParameter(int index, unsigned char value) override;
129 bool BindParameter(int index, signed char value) override;
130 bool BindParameter(int index, unsigned short value) override;
131 bool BindParameter(int index, signed short value) override;
132 bool BindParameter(int index, unsigned int value) override;
133
134 bool BindParameter(int index, int value) override;
135
136 bool BindParameter(int index, unsigned long value) override;
137 bool BindParameter(int index, signed long value) override;
138 bool BindParameter(int index, unsigned long long value) override;
139 bool BindParameter(int index, long long value) override;
140
141 bool BindParameter(int index, float value) override;
142 bool BindParameter(int index, double value) override;
146 bool BindParameter(int index, const char* stringValue) override;
148
151 bool BindParameter(int index, const char* stringValue, size_t length) override;
152 bool BindParameter(int index, const vtkStdString& string) override;
155
160 bool BindParameter(int index, const void* data, size_t length) override;
161 bool ClearParameterBindings() override;
163
164protected:
166 ~vtkODBCQuery() override;
167
168 vtkSetStringMacro(LastErrorText);
169 vtkSetStringMacro(QueryText);
170 vtkGetStringMacro(QueryText);
171
173
174private:
175 vtkODBCQuery(const vtkODBCQuery&) = delete;
176 void operator=(const vtkODBCQuery&) = delete;
177
178 void ClearCurrentRow();
179 bool CacheCurrentRow();
180
181 bool CacheTimeColumn(int column);
182 bool CacheIntervalColumn(int column);
183 bool CacheCharColumn(int column);
184 bool CacheLongLongColumn(int column);
185 bool CacheBinaryColumn(int column);
186 bool CacheBooleanColumn(int column);
187 bool CacheStringColumn(int column);
188 bool CacheWideStringColumn(int column);
189 bool CacheDecimalColumn(int column);
190 bool CacheNumericColumn(int column);
191 bool CacheIntColumn(int column);
192 bool CacheFloatColumn(int column);
193 bool CacheDoubleColumn(int column);
194
195 vtkODBCQueryInternals* Internals;
196 bool InitialFetch;
197 char* LastErrorText;
198};
199
200#endif // vtkODBCQuery_h
a simple class to control print indentation
Definition: vtkIndent.h:113
maintain an ODBC connection to a SQL database
Simple class to hide ODBC structures.
vtkSQLQuery implementation for ODBC connections to databases
Definition: vtkODBCQuery.h:49
bool BindParameter(int index, int value) override
bool BindParameter(int index, unsigned short value) override
bool HasError() override
Return true if there is an error on the current query.
bool BindParameter(int index, float value) override
bool BindParameter(int index, double value) override
bool BindParameter(int index, signed char value) override
bool BindParameter(int index, unsigned long value) override
static vtkODBCQuery * New()
int GetFieldType(int i) override
Return the type of the field, using the constants defined in vtkType.h.
bool BindParameter(int index, long long value) override
bool BeginTransaction() override
Begin, commit, or roll back a transaction.
bool BindParameter(int index, unsigned long long value) override
bool CommitTransaction() override
Begin, commit, or roll back a transaction.
bool BindParameter(int index, const char *stringValue) override
Bind a string value – string must be null-terminated.
bool BindParameter(int index, signed short value) override
~vtkODBCQuery() override
bool BindParameter(int index, unsigned char value) override
Bind a parameter to a placeholder in a query.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Execute() override
Execute the query.
bool ClearParameterBindings() override
Bind a blob value.
bool BindParameter(int index, unsigned int value) override
bool SetQuery(const char *queryString) override
Set the query string to be used.
const char * GetQuery() override
Set the query string to be used.
bool BindParameter(int index, const vtkStdString &string) override
Bind a string value by specifying an array and a size.
bool RollbackTransaction() override
Begin, commit, or roll back a transaction.
const char * GetLastErrorText() override
Get the last error text from the query.
bool BindParameter(int index, const char *stringValue, size_t length) override
Bind a string value by specifying an array and a size.
vtkVariant DataValue(vtkIdType c) override
Return data in current row, field c.
bool NextRow() override
Advance row, return false if past end.
char * QueryText
Definition: vtkODBCQuery.h:172
int GetNumberOfFields() override
The number of fields in the query result.
bool BindParameter(int index, const void *data, size_t length) override
Bind a blob value.
const char * GetFieldName(int i) override
Return the name of the specified query field.
bool BindParameter(int index, signed long value) override
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.
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