VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/SQL/vtkSQLiteQuery.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSQLiteQuery.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 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00043 #ifndef vtkSQLiteQuery_h
00044 #define vtkSQLiteQuery_h
00045 
00046 #include "vtkIOSQLModule.h" // For export macro
00047 #include "vtkSQLQuery.h"
00048 
00049 class vtkSQLiteDatabase;
00050 class vtkVariant;
00051 class vtkVariantArray;
00052 struct vtk_sqlite3_stmt;
00053 
00054 class VTKIOSQL_EXPORT vtkSQLiteQuery : public vtkSQLQuery
00055 {
00056   //BTX
00057   friend class vtkSQLiteDatabase;
00058   //ETX
00059 
00060 public:
00061   vtkTypeMacro(vtkSQLiteQuery, vtkSQLQuery);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063   static vtkSQLiteQuery *New();
00064 
00067   bool SetQuery(const char *query);
00068 
00071   bool Execute();
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 
00091   bool BeginTransaction();
00092   bool RollbackTransaction();
00093   bool CommitTransaction();
00095 
00097   vtkVariant DataValue(vtkIdType c);
00098 
00100   const char* GetLastErrorText();
00101 
00103 
00108   using vtkSQLQuery::BindParameter;
00109   bool BindParameter(int index, unsigned char value);
00110   bool BindParameter(int index, signed char value);
00111   bool BindParameter(int index, unsigned short value);
00112   bool BindParameter(int index, short value);
00113   bool BindParameter(int index, unsigned int value);
00114 //ETX
00115   bool BindParameter(int index, int value);
00116 //BTX
00117   bool BindParameter(int index, unsigned long value);
00118   bool BindParameter(int index, long value);
00119   bool BindParameter(int index, vtkTypeUInt64 value);
00120   bool BindParameter(int index, vtkTypeInt64 value);
00121 //ETX
00122   bool BindParameter(int index, float value);
00123   bool BindParameter(int index, double value);
00125 
00126   bool BindParameter(int index, const char *stringValue);
00128 
00129   bool BindParameter(int index, const char *stringValue, size_t length);
00130 //BTX
00131   bool BindParameter(int index, const vtkStdString &string);
00132 //ETX
00133   bool BindParameter(int index, vtkVariant value);
00135 
00136 
00138   bool BindParameter(int index, const void *data, size_t length);
00139   bool ClearParameterBindings();
00141 
00142 protected:
00143   vtkSQLiteQuery();
00144   ~vtkSQLiteQuery();
00145 
00146   vtkSetStringMacro(LastErrorText);
00147 
00148 private:
00149   vtkSQLiteQuery(const vtkSQLiteQuery &); // Not implemented.
00150   void operator=(const vtkSQLiteQuery &); // Not implemented.
00151 
00152   vtk_sqlite3_stmt *Statement;
00153   bool InitialFetch;
00154   int InitialFetchResult;
00155   char *LastErrorText;
00156   bool TransactionInProgress;
00157 
00159 
00161   bool BindIntegerParameter(int index, int value);
00162   bool BindDoubleParameter(int index, double value);
00163   bool BindInt64Parameter(int index, vtkTypeInt64 value);
00164   bool BindStringParameter(int index, const char *data, int length);
00165   bool BindBlobParameter(int index, const void *data, int length);
00167 
00168 };
00169 
00170 #endif // vtkSQLiteQuery_h
00171