VTK
|
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 "vtkSQLQuery.h" 00039 00040 class vtkMySQLDatabase; 00041 class vtkVariant; 00042 class vtkVariantArray; 00043 class vtkMySQLQueryInternals; 00044 00045 class VTK_IO_EXPORT vtkMySQLQuery : public vtkSQLQuery 00046 { 00047 //BTX 00048 friend class vtkMySQLDatabase; 00049 //ETX 00050 00051 public: 00052 vtkTypeMacro(vtkMySQLQuery, vtkSQLQuery); 00053 void PrintSelf(ostream& os, vtkIndent indent); 00054 static vtkMySQLQuery *New(); 00055 00058 bool SetQuery(const char *query); 00059 00062 bool Execute(); 00063 00065 00068 virtual bool BeginTransaction(); 00069 virtual bool CommitTransaction(); 00070 virtual bool RollbackTransaction(); 00072 00074 int GetNumberOfFields(); 00075 00077 const char* GetFieldName(int i); 00078 00081 int GetFieldType(int i); 00082 00084 bool NextRow(); 00085 00087 bool HasError(); 00088 00090 vtkVariant DataValue(vtkIdType c); 00091 00093 const char* GetLastErrorText(); 00094 00096 00101 using vtkSQLQuery::BindParameter; 00102 bool BindParameter(int index, unsigned char value); 00103 bool BindParameter(int index, signed char value); 00104 bool BindParameter(int index, unsigned short value); 00105 bool BindParameter(int index, signed short value); 00106 bool BindParameter(int index, unsigned int value); 00107 //ETX 00108 bool BindParameter(int index, int value); 00109 //BTX 00110 bool BindParameter(int index, unsigned long value); 00111 bool BindParameter(int index, signed long value); 00112 bool BindParameter(int index, vtkTypeUInt64 value); 00113 bool BindParameter(int index, vtkTypeInt64 value); 00114 //ETX 00115 bool BindParameter(int index, float value); 00116 bool BindParameter(int index, double value); 00118 00119 bool BindParameter(int index, const char *stringValue); 00121 00122 bool BindParameter(int index, const char *stringValue, size_t length); 00123 bool BindParameter(int index, const vtkStdString &string); 00125 00127 00129 bool BindParameter(int index, const void *data, size_t length); 00130 bool ClearParameterBindings(); 00132 00134 virtual vtkStdString EscapeString( vtkStdString src, bool addSurroundingQuotes = true ); 00135 00136 protected: 00137 vtkMySQLQuery(); 00138 ~vtkMySQLQuery(); 00139 00140 vtkSetStringMacro(LastErrorText); 00141 00142 private: 00143 vtkMySQLQuery(const vtkMySQLQuery &); // Not implemented. 00144 void operator=(const vtkMySQLQuery &); // Not implemented. 00145 00146 vtkMySQLQueryInternals *Internals; 00147 bool InitialFetch; 00148 char *LastErrorText; 00149 }; 00150 00151 #endif // __vtkMySQLQuery_h 00152