00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPostgreSQLQuery.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 -------------------------------------------------------------------------*/ 00038 #ifndef __vtkPostgreSQLQuery_h 00039 #define __vtkPostgreSQLQuery_h 00040 00041 #include "vtkSQLQuery.h" 00042 00043 class vtkPostgreSQLDatabase; 00044 class vtkVariant; 00045 class vtkVariantArray; 00046 class vtkPostgreSQLQueryPrivate; 00047 00048 class VTK_IO_EXPORT vtkPostgreSQLQuery : public vtkSQLQuery 00049 { 00050 public: 00051 static vtkPostgreSQLQuery* New(); 00052 void PrintSelf( ostream& os, vtkIndent indent ); 00053 vtkTypeMacro(vtkPostgreSQLQuery, vtkSQLQuery); 00054 00057 bool Execute(); 00058 00060 int GetNumberOfFields(); 00061 00063 const char* GetFieldName( int i ); 00064 00067 int GetFieldType( int i ); 00068 00070 bool NextRow(); 00071 00073 bool HasError(); 00074 00076 00077 bool BeginTransaction(); 00078 bool RollbackTransaction(); 00079 bool CommitTransaction(); 00081 00082 //BTX 00084 00085 vtkVariant DataValue( vtkIdType c ); 00086 //ETX 00088 00090 const char* GetLastErrorText(); 00091 00092 //BTX 00094 00095 virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true ); 00096 //ETX 00098 00101 int GetNumberOfRows(); 00102 00103 protected: 00104 vtkPostgreSQLQuery(); 00105 ~vtkPostgreSQLQuery(); 00106 00107 vtkSetStringMacro(LastErrorText); 00108 00109 bool IsColumnBinary(int whichColumn); 00110 const char *GetColumnRawData(int whichColumn); 00111 00112 bool TransactionInProgress; 00113 char *LastErrorText; 00114 int CurrentRow; 00115 00116 vtkPostgreSQLQueryPrivate *QueryInternals; 00117 00118 void DeleteQueryResults(); 00119 00120 //BTX 00121 friend class vtkPostgreSQLDatabase; 00122 //ETX 00123 00124 private: 00125 vtkPostgreSQLQuery( const vtkPostgreSQLQuery& ); // Not implemented. 00126 void operator = ( const vtkPostgreSQLQuery& ); // Not implemented. 00127 }; 00128 00129 #endif // __vtkPostgreSQLQuery_h 00130