00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkSQLiteQuery.h,v $ 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 "vtkSQLQuery.h" 00047 00048 class vtkSQLiteDatabase; 00049 class vtkVariant; 00050 class vtkVariantArray; 00051 struct vtk_sqlite3_stmt; 00052 00053 class VTK_IO_EXPORT vtkSQLiteQuery : public vtkSQLQuery 00054 { 00055 //BTX 00056 friend class vtkSQLiteDatabase; 00057 //ETX 00058 00059 public: 00060 vtkTypeRevisionMacro(vtkSQLiteQuery, vtkSQLQuery); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00062 static vtkSQLiteQuery *New(); 00063 00066 bool Execute(); 00067 00069 int GetNumberOfFields(); 00070 00072 const char* GetFieldName(int i); 00073 00076 int GetFieldType(int i); 00077 00079 bool NextRow(); 00080 00082 bool HasError(); 00083 00085 00086 bool BeginTransaction(); 00087 bool RollbackTransaction(); 00088 bool CommitTransaction(); 00090 00091 //BTX 00093 00094 vtkVariant DataValue(vtkIdType c); 00095 //ETX 00097 00099 const char* GetLastErrorText(); 00100 00101 protected: 00102 vtkSQLiteQuery(); 00103 ~vtkSQLiteQuery(); 00104 00105 vtkSetStringMacro(LastErrorText); 00106 00107 private: 00108 vtkSQLiteQuery(const vtkSQLiteQuery &); // Not implemented. 00109 void operator=(const vtkSQLiteQuery &); // Not implemented. 00110 00111 vtk_sqlite3_stmt *Statement; 00112 bool InitialFetch; 00113 int InitialFetchResult; 00114 char *LastErrorText; 00115 bool TransactionInProgress; 00116 }; 00117 00118 #endif // __vtkSQLiteQuery_h 00119