VTK
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
43class vtkVariant;
44class vtkVariantArray;
45class vtkMySQLQueryInternals;
46
47class VTKIOMYSQL_EXPORT vtkMySQLQuery : public vtkSQLQuery
48{
49
50 friend class vtkMySQLDatabase;
51
52public:
53 vtkTypeMacro(vtkMySQLQuery, vtkSQLQuery);
54 void PrintSelf(ostream& os, vtkIndent indent);
55 static vtkMySQLQuery *New();
56
61 bool SetQuery(const char *query);
62
68 bool Execute();
69
71
77 virtual bool BeginTransaction();
78 virtual bool CommitTransaction();
79 virtual bool RollbackTransaction();
81
86
90 const char* GetFieldName(int i);
91
95 int GetFieldType(int i);
96
100 bool NextRow();
101
105 bool HasError();
106
111
115 const char* GetLastErrorText();
116
126 bool BindParameter(int index, unsigned char value);
127 bool BindParameter(int index, signed char value);
128 bool BindParameter(int index, unsigned short value);
129 bool BindParameter(int index, signed short value);
130 bool BindParameter(int index, unsigned int value);
131
132 bool BindParameter(int index, int value);
133
134 bool BindParameter(int index, unsigned long value);
135 bool BindParameter(int index, signed long value);
136 bool BindParameter(int index, unsigned long long value);
137 bool BindParameter(int index, long long value);
138
139 bool BindParameter(int index, float value);
140 bool BindParameter(int index, double value);
144 bool BindParameter(int index, const char *stringValue);
146
149 bool BindParameter(int index, const char *stringValue, size_t length);
150 bool BindParameter(int index, const vtkStdString &string);
152
154
159 bool BindParameter(int index, const void *data, size_t length);
162
166 virtual vtkStdString EscapeString( vtkStdString src, bool addSurroundingQuotes = true );
167
168protected:
171
172 vtkSetStringMacro(LastErrorText);
173
174private:
175 vtkMySQLQuery(const vtkMySQLQuery &) VTK_DELETE_FUNCTION;
176 void operator=(const vtkMySQLQuery &) VTK_DELETE_FUNCTION;
177
178 vtkMySQLQueryInternals *Internals;
179 bool InitialFetch;
180 char *LastErrorText;
181};
182
183#endif // vtkMySQLQuery_h
184
a simple class to control print indentation
Definition: vtkIndent.h:40
maintain a connection to a MySQL database
friend class vtkMySQLQuery
vtkSQLQuery implementation for MySQL databases
Definition: vtkMySQLQuery.h:48
bool BindParameter(int index, float value)
bool BindParameter(int index, unsigned long long value)
bool BindParameter(int index, const vtkStdString &string)
bool BindParameter(int index, double value)
bool BindParameter(int index, signed long value)
int GetNumberOfFields()
The number of fields in the query result.
bool SetQuery(const char *query)
Set the SQL query string.
int GetFieldType(int i)
Return the type of the field, using the constants defined in vtkType.h.
virtual bool BeginTransaction()
Begin, commit, or roll back a transaction.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
bool NextRow()
Advance row, return false if past end.
bool BindParameter(int index, unsigned char value)
Bind a parameter to a placeholder in a query.
bool HasError()
Return true if there is an error on the current query.
bool BindParameter(int index, signed short value)
virtual bool RollbackTransaction()
bool ClearParameterBindings()
Reset all parameter bindings to NULL.
virtual bool CommitTransaction()
bool BindParameter(int index, unsigned int value)
bool BindParameter(int index, unsigned long value)
bool BindParameter(int index, unsigned short value)
bool BindParameter(int index, long long value)
bool Execute()
Execute the query.
const char * GetFieldName(int i)
Return the name of the specified query field.
bool BindParameter(int index, const char *stringValue, size_t length)
Bind a string value by specifying an array and a size.
virtual vtkStdString EscapeString(vtkStdString src, bool addSurroundingQuotes=true)
Escape a string for use in a query.
vtkVariant DataValue(vtkIdType c)
Return data in current row, field c.
static vtkMySQLQuery * New()
bool BindParameter(int index, int value)
bool BindParameter(int index, const void *data, size_t length)
Bind a blob value.
bool BindParameter(int index, const char *stringValue)
Bind a string value – string must be null-terminated.
bool BindParameter(int index, signed char value)
const char * GetLastErrorText()
Get the last error text from the query.
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:75
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:49
An array holding vtkVariants.
A atomic type representing the union of many types.
Definition: vtkVariant.h:76
@ length
Definition: vtkX3D.h:393
@ value
Definition: vtkX3D.h:220
@ index
Definition: vtkX3D.h:246
@ data
Definition: vtkX3D.h:315
int vtkIdType
Definition: vtkType.h:287