VTK
dox/IO/MySQL/vtkMySQLQuery.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkMySQLQuery.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00035 #ifndef __vtkMySQLQuery_h
00036 #define __vtkMySQLQuery_h
00037 
00038 #include "vtkIOMySQLModule.h" // For export macro
00039 #include "vtkSQLQuery.h"
00040 
00041 class vtkMySQLDatabase;
00042 class vtkVariant;
00043 class vtkVariantArray;
00044 class vtkMySQLQueryInternals;
00045 
00046 class VTKIOMYSQL_EXPORT vtkMySQLQuery : public vtkSQLQuery
00047 {
00048 //BTX
00049   friend class vtkMySQLDatabase;
00050 //ETX
00051 
00052 public:
00053   vtkTypeMacro(vtkMySQLQuery, vtkSQLQuery);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055   static vtkMySQLQuery *New();
00056 
00059   bool SetQuery(const char *query);
00060 
00063   bool Execute();
00064 
00066 
00069   virtual bool BeginTransaction();
00070   virtual bool CommitTransaction();
00071   virtual bool RollbackTransaction();
00073 
00075   int GetNumberOfFields();
00076 
00078   const char* GetFieldName(int i);
00079 
00082   int GetFieldType(int i);
00083 
00085   bool NextRow();
00086 
00088   bool HasError();
00089 
00091   vtkVariant DataValue(vtkIdType c);
00092 
00094   const char* GetLastErrorText();
00095 
00097 
00102   using vtkSQLQuery::BindParameter;
00103   bool BindParameter(int index, unsigned char value);
00104   bool BindParameter(int index, signed char value);
00105   bool BindParameter(int index, unsigned short value);
00106   bool BindParameter(int index, signed short value);
00107   bool BindParameter(int index, unsigned int value);
00108 //ETX
00109   bool BindParameter(int index, int value);
00110 //BTX
00111   bool BindParameter(int index, unsigned long value);
00112   bool BindParameter(int index, signed long value);
00113   bool BindParameter(int index, vtkTypeUInt64 value);
00114   bool BindParameter(int index, vtkTypeInt64 value);
00115 //ETX
00116   bool BindParameter(int index, float value);
00117   bool BindParameter(int index, double value);
00119 
00120   bool BindParameter(int index, const char *stringValue);
00122 
00123   bool BindParameter(int index, const char *stringValue, size_t length);
00124   bool BindParameter(int index, const vtkStdString &string);
00126 
00128 
00130   bool BindParameter(int index, const void *data, size_t length);
00131   bool ClearParameterBindings();
00133 
00135   virtual vtkStdString EscapeString( vtkStdString src, bool addSurroundingQuotes = true );
00136 
00137 protected:
00138   vtkMySQLQuery();
00139   ~vtkMySQLQuery();
00140 
00141   vtkSetStringMacro(LastErrorText);
00142 
00143 private:
00144   vtkMySQLQuery(const vtkMySQLQuery &); // Not implemented.
00145   void operator=(const vtkMySQLQuery &); // Not implemented.
00146 
00147   vtkMySQLQueryInternals *Internals;
00148   bool InitialFetch;
00149   char *LastErrorText;
00150 };
00151 
00152 #endif // __vtkMySQLQuery_h
00153