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 int GetNumberOfFields(); 00066 00068 const char* GetFieldName(int i); 00069 00072 int GetFieldType(int i); 00073 00075 bool NextRow(); 00076 00078 bool HasError(); 00079 00080 //BTX 00082 00083 vtkVariant DataValue(vtkIdType c); 00084 //ETX 00086 00088 const char* GetLastErrorText(); 00089 00091 00096 using vtkSQLQuery::BindParameter; 00097 bool BindParameter(int index, unsigned char value); 00098 bool BindParameter(int index, signed char value); 00099 bool BindParameter(int index, unsigned short value); 00100 bool BindParameter(int index, signed short value); 00101 bool BindParameter(int index, unsigned int value); 00103 //ETX 00104 bool BindParameter(int index, int value); 00105 //BTX 00106 bool BindParameter(int index, unsigned long value); 00107 bool BindParameter(int index, signed long value); 00108 bool BindParameter(int index, vtkTypeUInt64 value); 00109 bool BindParameter(int index, vtkTypeInt64 value); 00110 //ETX 00111 bool BindParameter(int index, float value); 00112 bool BindParameter(int index, double value); 00114 00115 bool BindParameter(int index, const char *stringValue); 00116 // Description: 00117 // Bind a string value by specifying an array and a size 00118 bool BindParameter(int index, const char *stringValue, size_t length); 00120 //BTX 00121 bool BindParameter(int index, const vtkStdString &string); 00122 //ETX 00124 00126 bool BindParameter(int index, const void *data, size_t length); 00127 bool ClearParameterBindings(); 00129 00130 //BTX 00132 00133 virtual vtkStdString EscapeString( vtkStdString src, bool addSurroundingQuotes = true ); 00134 //ETX 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