VTK
|
00001 /* -*- Mode: C++; -*- */ 00002 /*========================================================================= 00003 00004 Program: Visualization Toolkit 00005 Module: $RCSfile: vtkODBCQuery.h,v $ 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 "vtkSQLQuery.h" 00039 00040 class vtkODBCDatabase; 00041 class vtkVariant; 00042 class vtkVariantArray; 00043 class vtkODBCInternals; 00044 class vtkODBCQueryInternals; 00045 00046 class VTK_IO_EXPORT vtkODBCQuery : public vtkSQLQuery 00047 { 00048 //BTX 00049 friend class vtkODBCDatabase; 00050 //ETX 00051 00052 public: 00053 vtkTypeRevisionMacro(vtkODBCQuery, vtkSQLQuery); 00054 void PrintSelf(ostream& os, vtkIndent indent); 00055 static vtkODBCQuery *New(); 00056 00059 bool Execute(); 00060 00062 int GetNumberOfFields(); 00063 00065 const char* GetFieldName(int i); 00066 00069 int GetFieldType(int i); 00070 00072 bool NextRow(); 00073 00075 bool HasError(); 00076 00077 //BTX 00079 vtkVariant DataValue(vtkIdType c); 00080 //ETX 00081 00083 const char* GetLastErrorText(); 00084 00086 00087 bool BeginTransaction(); 00088 bool CommitTransaction(); 00089 bool RollbackTransaction(); 00091 00093 00096 bool SetQuery(const char *queryString); 00097 const char *GetQuery(); 00099 00101 00106 using vtkSQLQuery::BindParameter; 00107 bool BindParameter(int index, unsigned char value); 00108 bool BindParameter(int index, signed char value); 00109 bool BindParameter(int index, unsigned short value); 00110 bool BindParameter(int index, signed short value); 00111 bool BindParameter(int index, unsigned int value); 00113 //ETX 00114 bool BindParameter(int index, int value); 00115 //BTX 00116 bool BindParameter(int index, unsigned long value); 00117 bool BindParameter(int index, signed long value); 00118 bool BindParameter(int index, vtkTypeUInt64 value); 00119 bool BindParameter(int index, vtkTypeInt64 value); 00120 //ETX 00121 bool BindParameter(int index, float value); 00122 bool BindParameter(int index, double value); 00124 00125 bool BindParameter(int index, const char *stringValue); 00126 // Description: 00127 // Bind a string value by specifying an array and a size 00128 bool BindParameter(int index, const char *stringValue, size_t length); 00130 //BTX 00131 bool BindParameter(int index, const vtkStdString &string); 00132 //ETX 00134 00136 bool BindParameter(int index, const void *data, size_t length); 00137 bool ClearParameterBindings(); 00139 00140 protected: 00141 vtkODBCQuery(); 00142 ~vtkODBCQuery(); 00143 00144 vtkSetStringMacro(LastErrorText); 00145 vtkSetStringMacro(QueryText); 00146 vtkGetStringMacro(QueryText); 00147 00148 char *QueryText; 00149 00150 private: 00151 vtkODBCQuery(const vtkODBCQuery &); // Not implemented. 00152 void operator=(const vtkODBCQuery &); // Not implemented. 00153 00154 void ClearCurrentRow(); 00155 bool CacheCurrentRow(); 00156 00157 bool CacheTimeColumn(int column); 00158 bool CacheIntervalColumn(int column); 00159 bool CacheCharColumn(int column); 00160 bool CacheLongLongColumn(int column); 00161 bool CacheBinaryColumn(int column); 00162 bool CacheBooleanColumn(int column); 00163 bool CacheStringColumn(int column); 00164 bool CacheWideStringColumn(int column); 00165 bool CacheDecimalColumn(int column); 00166 bool CacheNumericColumn(int column); 00167 bool CacheIntColumn(int column); 00168 bool CacheFloatColumn(int column); 00169 bool CacheDoubleColumn(int column); 00170 00171 vtkODBCQueryInternals *Internals; 00172 bool InitialFetch; 00173 char *LastErrorText; 00174 }; 00175 00176 #endif // __vtkODBCQuery_h 00177