VTK
dox/IO/vtkODBCQuery.h
Go to the documentation of this file.
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 "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   vtkTypeMacro(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 
00078   vtkVariant DataValue(vtkIdType c);
00079 
00081   const char* GetLastErrorText();
00082 
00084 
00085   bool BeginTransaction();
00086   bool CommitTransaction();
00087   bool RollbackTransaction();
00089 
00091 
00094   bool SetQuery(const char *queryString);
00095   const char *GetQuery();
00097 
00099 
00104   using vtkSQLQuery::BindParameter;
00105   bool BindParameter(int index, unsigned char value);
00106   bool BindParameter(int index, signed char value);
00107   bool BindParameter(int index, unsigned short value);
00108   bool BindParameter(int index, signed short value);
00109   bool BindParameter(int index, unsigned int value);
00110 //ETX
00111   bool BindParameter(int index, int value);
00112 //BTX
00113   bool BindParameter(int index, unsigned long value);
00114   bool BindParameter(int index, signed long value);
00115   bool BindParameter(int index, vtkTypeUInt64 value);
00116   bool BindParameter(int index, vtkTypeInt64 value);
00117 //ETX
00118   bool BindParameter(int index, float value);
00119   bool BindParameter(int index, double value);
00121 
00122   bool BindParameter(int index, const char *stringValue);
00124 
00125   bool BindParameter(int index, const char *stringValue, size_t length);
00126   bool BindParameter(int index, const vtkStdString &string);
00128 
00129 
00131   bool BindParameter(int index, const void *data, size_t length);
00132   bool ClearParameterBindings();
00134 
00135 protected:
00136   vtkODBCQuery();
00137   ~vtkODBCQuery();
00138 
00139   vtkSetStringMacro(LastErrorText);
00140   vtkSetStringMacro(QueryText);
00141   vtkGetStringMacro(QueryText);
00142 
00143   char *QueryText;
00144   
00145 private:
00146   vtkODBCQuery(const vtkODBCQuery &); // Not implemented.
00147   void operator=(const vtkODBCQuery &); // Not implemented.
00148 
00149   void ClearCurrentRow();
00150   bool CacheCurrentRow();
00151 
00152   bool CacheTimeColumn(int column);
00153   bool CacheIntervalColumn(int column);
00154   bool CacheCharColumn(int column);
00155   bool CacheLongLongColumn(int column);
00156   bool CacheBinaryColumn(int column);
00157   bool CacheBooleanColumn(int column);
00158   bool CacheStringColumn(int column);
00159   bool CacheWideStringColumn(int column);
00160   bool CacheDecimalColumn(int column);
00161   bool CacheNumericColumn(int column);
00162   bool CacheIntColumn(int column);
00163   bool CacheFloatColumn(int column);
00164   bool CacheDoubleColumn(int column);
00165 
00166   vtkODBCQueryInternals *Internals;
00167   bool InitialFetch;
00168   char *LastErrorText;
00169 };
00170 
00171 #endif // __vtkODBCQuery_h
00172