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 =========================================================================*/
35 #ifndef __vtkMySQLQuery_h
36 #define __vtkMySQLQuery_h
37 
38 #include "vtkSQLQuery.h"
39 
40 class vtkMySQLDatabase;
41 class vtkVariant;
42 class vtkVariantArray;
43 class vtkMySQLQueryInternals;
44 
46 {
47 //BTX
48  friend class vtkMySQLDatabase;
49 //ETX
50 
51 public:
52  vtkTypeMacro(vtkMySQLQuery, vtkSQLQuery);
53  void PrintSelf(ostream& os, vtkIndent indent);
54  static vtkMySQLQuery *New();
55 
58  bool SetQuery(const char *query);
59 
62  bool Execute();
63 
65 
68  virtual bool BeginTransaction();
69  virtual bool CommitTransaction();
70  virtual bool RollbackTransaction();
72 
74  int GetNumberOfFields();
75 
77  const char* GetFieldName(int i);
78 
81  int GetFieldType(int i);
82 
84  bool NextRow();
85 
87  bool HasError();
88 
91 
93  const char* GetLastErrorText();
94 
96 
102  bool BindParameter(int index, unsigned char value);
103  bool BindParameter(int index, signed char value);
104  bool BindParameter(int index, unsigned short value);
105  bool BindParameter(int index, signed short value);
106  bool BindParameter(int index, unsigned int value);
107 //ETX
108  bool BindParameter(int index, int value);
109 //BTX
110  bool BindParameter(int index, unsigned long value);
111  bool BindParameter(int index, signed long value);
112  bool BindParameter(int index, vtkTypeUInt64 value);
113  bool BindParameter(int index, vtkTypeInt64 value);
114 //ETX
115  bool BindParameter(int index, float value);
116  bool BindParameter(int index, double value);
117  // Description:
118  // Bind a string value -- string must be null-terminated
119  bool BindParameter(int index, const char *stringValue);
120  // Description:
121  // Bind a string value by specifying an array and a size
122  bool BindParameter(int index, const char *stringValue, size_t length);
123  bool BindParameter(int index, const vtkStdString &string);
125 
127 
129  bool BindParameter(int index, const void *data, size_t length);
130  bool ClearParameterBindings();
132 
134  virtual vtkStdString EscapeString( vtkStdString src, bool addSurroundingQuotes = true );
135 
136 protected:
137  vtkMySQLQuery();
138  ~vtkMySQLQuery();
139 
140  vtkSetStringMacro(LastErrorText);
141 
142 private:
143  vtkMySQLQuery(const vtkMySQLQuery &); // Not implemented.
144  void operator=(const vtkMySQLQuery &); // Not implemented.
145 
146  vtkMySQLQueryInternals *Internals;
147  bool InitialFetch;
148  char *LastErrorText;
149 };
150 
151 #endif // __vtkMySQLQuery_h
152