00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00059 #ifndef __vtkSQLQuery_h
00060 #define __vtkSQLQuery_h
00061
00062 #include "vtkRowQuery.h"
00063 #include "vtkStdString.h"
00064
00065 class vtkSQLDatabase;
00066 class vtkVariant;
00067 class vtkVariantArray;
00068
00069 class VTK_IO_EXPORT vtkSQLQuery : public vtkRowQuery
00070 {
00071 public:
00072 vtkTypeRevisionMacro(vtkSQLQuery, vtkRowQuery);
00073 void PrintSelf(ostream& os, vtkIndent indent);
00074
00076
00079 virtual bool SetQuery(const char *query);
00080 virtual const char *GetQuery();
00082
00086 bool IsActive() { return this->Active; }
00087
00090 virtual bool Execute() = 0;
00091
00093
00095 virtual bool BeginTransaction() { return true; }
00096 virtual bool CommitTransaction() { return true; }
00097 virtual bool RollbackTransaction() { return true; }
00099
00101
00102 vtkGetObjectMacro(Database, vtkSQLDatabase);
00104
00125
00126 virtual bool BindParameter(int index, unsigned char value);
00127 virtual bool BindParameter(int index, unsigned short value);
00128 virtual bool BindParameter(int index, unsigned int value);
00129 virtual bool BindParameter(int index, unsigned long value);
00130
00131
00132
00133 virtual bool BindParameter(int index, signed char value);
00134 virtual bool BindParameter(int index, short value);
00135
00136 virtual bool BindParameter(int index, int value);
00137
00138 virtual bool BindParameter(int index, long value);
00139 virtual bool BindParameter(int index, vtkTypeUInt64 value);
00140 virtual bool BindParameter(int index, vtkTypeInt64 value);
00141
00142 virtual bool BindParameter(int index, float value);
00143 virtual bool BindParameter(int index, double value);
00145
00146 virtual bool BindParameter(int index, const char *stringValue);
00147
00148
00149 virtual bool BindParameter(int index, const char *stringValue, size_t length);
00151
00152 virtual bool BindParameter(int index, const vtkStdString &string);
00153 virtual bool BindParameter(int index, vtkVariant var);
00154
00156
00158 virtual bool BindParameter(int index, const void *data, size_t length);
00159
00160
00161 virtual bool ClearParameterBindings();
00163
00164
00166
00172 virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
00173
00175
00182 char* EscapeString( const char* src, bool addSurroundingQuotes );
00183
00184 protected:
00185 vtkSQLQuery();
00186 ~vtkSQLQuery();
00187
00191 void SetDatabase(vtkSQLDatabase* db);
00192
00193 char* Query;
00194 vtkSQLDatabase* Database;
00195 bool Active;
00196
00197 private:
00198 vtkSQLQuery(const vtkSQLQuery &);
00199 void operator=(const vtkSQLQuery &);
00200 };
00201
00202 #endif // __vtkSQLQuery_h
00203