VTK
dox/IO/vtkPostgreSQLQuery.h
Go to the documentation of this file.
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 
00083   vtkVariant DataValue( vtkIdType c );
00084 
00086   const char* GetLastErrorText();
00087 
00089   virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
00090 
00093   int GetNumberOfRows();
00094 
00095 protected:
00096   vtkPostgreSQLQuery();
00097   ~vtkPostgreSQLQuery();
00098 
00099   vtkSetStringMacro(LastErrorText);
00100 
00101   bool IsColumnBinary(int whichColumn);
00102   const char *GetColumnRawData(int whichColumn);
00103 
00104   bool TransactionInProgress;
00105   char *LastErrorText;
00106   int CurrentRow;
00107 
00108   vtkPostgreSQLQueryPrivate *QueryInternals;
00109 
00110   void DeleteQueryResults();
00111 
00112   //BTX
00113   friend class vtkPostgreSQLDatabase;
00114   //ETX
00115 
00116 private:
00117   vtkPostgreSQLQuery( const vtkPostgreSQLQuery& ); // Not implemented.
00118   void operator = ( const vtkPostgreSQLQuery& ); // Not implemented.
00119 };
00120 
00121 #endif // __vtkPostgreSQLQuery_h
00122