VTK
|
00001 /* -*- Mode: C++; -*- */ 00002 /*========================================================================= 00003 00004 Program: Visualization Toolkit 00005 Module: vtkODBCQuery.h 00006 00007 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00016 /*------------------------------------------------------------------------- 00017 Copyright 2008 Sandia Corporation. 00018 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00019 the U.S. Government retains certain rights in this software. 00020 -------------------------------------------------------------------------*/ 00021 00035 #ifndef vtkODBCQuery_h 00036 #define vtkODBCQuery_h 00037 00038 #include "vtkIOODBCModule.h" // For export macro 00039 #include "vtkSQLQuery.h" 00040 00041 class vtkODBCDatabase; 00042 class vtkVariant; 00043 class vtkVariantArray; 00044 class vtkODBCInternals; 00045 class vtkODBCQueryInternals; 00046 00047 class VTKIOODBC_EXPORT vtkODBCQuery : public vtkSQLQuery 00048 { 00049 //BTX 00050 friend class vtkODBCDatabase; 00051 //ETX 00052 00053 public: 00054 vtkTypeMacro(vtkODBCQuery, vtkSQLQuery); 00055 void PrintSelf(ostream& os, vtkIndent indent); 00056 static vtkODBCQuery *New(); 00057 00060 bool Execute(); 00061 00063 int GetNumberOfFields(); 00064 00066 const char* GetFieldName(int i); 00067 00070 int GetFieldType(int i); 00071 00073 bool NextRow(); 00074 00076 bool HasError(); 00077 00079 vtkVariant DataValue(vtkIdType c); 00080 00082 const char* GetLastErrorText(); 00083 00085 00086 bool BeginTransaction(); 00087 bool CommitTransaction(); 00088 bool RollbackTransaction(); 00090 00092 00095 bool SetQuery(const char *queryString); 00096 const char *GetQuery(); 00098 00100 00105 using vtkSQLQuery::BindParameter; 00106 bool BindParameter(int index, unsigned char value); 00107 bool BindParameter(int index, signed char value); 00108 bool BindParameter(int index, unsigned short value); 00109 bool BindParameter(int index, signed short value); 00110 bool BindParameter(int index, unsigned int value); 00111 //ETX 00112 bool BindParameter(int index, int value); 00113 //BTX 00114 bool BindParameter(int index, unsigned long value); 00115 bool BindParameter(int index, signed long value); 00116 bool BindParameter(int index, vtkTypeUInt64 value); 00117 bool BindParameter(int index, vtkTypeInt64 value); 00118 //ETX 00119 bool BindParameter(int index, float value); 00120 bool BindParameter(int index, double value); 00122 00123 bool BindParameter(int index, const char *stringValue); 00125 00126 bool BindParameter(int index, const char *stringValue, size_t length); 00127 bool BindParameter(int index, const vtkStdString &string); 00129 00130 00132 bool BindParameter(int index, const void *data, size_t length); 00133 bool ClearParameterBindings(); 00135 00136 protected: 00137 vtkODBCQuery(); 00138 ~vtkODBCQuery(); 00139 00140 vtkSetStringMacro(LastErrorText); 00141 vtkSetStringMacro(QueryText); 00142 vtkGetStringMacro(QueryText); 00143 00144 char *QueryText; 00145 00146 private: 00147 vtkODBCQuery(const vtkODBCQuery &); // Not implemented. 00148 void operator=(const vtkODBCQuery &); // Not implemented. 00149 00150 void ClearCurrentRow(); 00151 bool CacheCurrentRow(); 00152 00153 bool CacheTimeColumn(int column); 00154 bool CacheIntervalColumn(int column); 00155 bool CacheCharColumn(int column); 00156 bool CacheLongLongColumn(int column); 00157 bool CacheBinaryColumn(int column); 00158 bool CacheBooleanColumn(int column); 00159 bool CacheStringColumn(int column); 00160 bool CacheWideStringColumn(int column); 00161 bool CacheDecimalColumn(int column); 00162 bool CacheNumericColumn(int column); 00163 bool CacheIntColumn(int column); 00164 bool CacheFloatColumn(int column); 00165 bool CacheDoubleColumn(int column); 00166 00167 vtkODBCQueryInternals *Internals; 00168 bool InitialFetch; 00169 char *LastErrorText; 00170 }; 00171 00172 #endif // vtkODBCQuery_h 00173