VTK  9.1.0
vtkMySQLQuery.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMySQLQuery.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 =========================================================================*/
36 #ifndef vtkMySQLQuery_h
37 #define vtkMySQLQuery_h
38 
39 #include "vtkIOMySQLModule.h" // For export macro
40 #include "vtkSQLQuery.h"
41 
42 class vtkMySQLDatabase;
43 class vtkVariant;
44 class vtkVariantArray;
45 class vtkMySQLQueryInternals;
46 
47 class VTKIOMYSQL_EXPORT vtkMySQLQuery : public vtkSQLQuery
48 {
49 
50  friend class vtkMySQLDatabase;
51 
52 public:
53  vtkTypeMacro(vtkMySQLQuery, vtkSQLQuery);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55  static vtkMySQLQuery* New();
56 
61  bool SetQuery(const char* query) override;
62 
68  bool Execute() override;
69 
71 
77  bool BeginTransaction() override;
78  bool CommitTransaction() override;
79  bool RollbackTransaction() override;
81 
85  int GetNumberOfFields() override;
86 
90  const char* GetFieldName(int i) override;
91 
95  int GetFieldType(int i) override;
96 
100  bool NextRow() override;
101 
105  bool HasError() override;
106 
111 
115  const char* GetLastErrorText() override;
116 
126  bool BindParameter(int index, unsigned char value) override;
127  bool BindParameter(int index, signed char value) override;
128  bool BindParameter(int index, unsigned short value) override;
129  bool BindParameter(int index, signed short value) override;
130  bool BindParameter(int index, unsigned int value) override;
131 
132  bool BindParameter(int index, int value) override;
133 
134  bool BindParameter(int index, unsigned long value) override;
135  bool BindParameter(int index, signed long value) override;
136  bool BindParameter(int index, unsigned long long value) override;
137  bool BindParameter(int index, long long value) override;
138 
139  bool BindParameter(int index, float value) override;
140  bool BindParameter(int index, double value) override;
144  bool BindParameter(int index, const char* stringValue) override;
146 
149  bool BindParameter(int index, const char* stringValue, size_t length) override;
150  bool BindParameter(int index, const vtkStdString& string) override;
152 
154 
159  bool BindParameter(int index, const void* data, size_t length) override;
160  bool ClearParameterBindings() override;
162 
166  vtkStdString EscapeString(vtkStdString src, bool addSurroundingQuotes = true) override;
167 
168 protected:
170  ~vtkMySQLQuery() override;
171 
172  vtkSetStringMacro(LastErrorText);
173 
174 private:
175  vtkMySQLQuery(const vtkMySQLQuery&) = delete;
176  void operator=(const vtkMySQLQuery&) = delete;
177 
178  vtkMySQLQueryInternals* Internals;
179  bool InitialFetch;
180  char* LastErrorText;
181 };
182 
183 #endif // vtkMySQLQuery_h
a simple class to control print indentation
Definition: vtkIndent.h:34
maintain a connection to a MySQL database
friend class vtkMySQLQuery
vtkSQLQuery implementation for MySQL databases
Definition: vtkMySQLQuery.h:48
const char * GetFieldName(int i) override
Return the name of the specified query field.
bool BindParameter(int index, int value) override
bool BindParameter(int index, unsigned int value) override
bool BindParameter(int index, double value) override
bool SetQuery(const char *query) override
Set the SQL query string.
bool BindParameter(int index, unsigned long value) override
bool BindParameter(int index, const void *data, size_t length) override
Bind a blob value.
bool BindParameter(int index, float value) override
bool BindParameter(int index, unsigned long long value) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool BindParameter(int index, unsigned char value) override
Bind a parameter to a placeholder in a query.
static vtkMySQLQuery * New()
bool BindParameter(int index, const char *stringValue, size_t length) override
Bind a string value by specifying an array and a size.
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 RollbackTransaction() override
Begin, commit, or roll back a transaction.
bool ClearParameterBindings() override
Bind a blob value.
bool BindParameter(int index, signed short value) override
~vtkMySQLQuery() override
vtkStdString EscapeString(vtkStdString src, bool addSurroundingQuotes=true) override
Escape a string for use in a query.
const char * GetLastErrorText() override
Get the last error text from the query.
bool BindParameter(int index, unsigned short value) override
bool BindParameter(int index, long long value) override
int GetNumberOfFields() override
The number of fields in the query result.
bool BindParameter(int index, signed char value) override
bool HasError() override
Return true if there is an error on the current query.
bool BindParameter(int index, const vtkStdString &string) override
Bind a string value by specifying an array and a size.
bool NextRow() override
Advance row, return false if past end.
bool BeginTransaction() override
Begin, commit, or roll back a transaction.
vtkVariant DataValue(vtkIdType c) override
Return data in current row, field c.
bool BindParameter(int index, signed long value) override
bool Execute() override
Execute the query.
int GetFieldType(int i) override
Return the type of the field, using the constants defined in vtkType.h.
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:36
An array holding vtkVariants.
A atomic type representing the union of many types.
Definition: vtkVariant.h:66
@ length
Definition: vtkX3D.h:399
@ value
Definition: vtkX3D.h:226
@ index
Definition: vtkX3D.h:252
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:332