VTK
vtkPostgreSQLQuery.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPostgreSQLQuery.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
39 #ifndef vtkPostgreSQLQuery_h
40 #define vtkPostgreSQLQuery_h
41 
42 #include "vtkIOPostgreSQLModule.h" // For export macro
43 #include "vtkSQLQuery.h"
44 
46 class vtkVariant;
47 class vtkVariantArray;
48 class vtkPostgreSQLQueryPrivate;
49 
50 class VTKIOPOSTGRESQL_EXPORT vtkPostgreSQLQuery : public vtkSQLQuery
51 {
52 public:
53  static vtkPostgreSQLQuery* New();
54  void PrintSelf( ostream& os, vtkIndent indent );
56 
62  bool Execute();
63 
67  int GetNumberOfFields();
68 
72  const char* GetFieldName( int i );
73 
77  int GetFieldType( int i );
78 
82  bool NextRow();
83 
87  bool HasError();
88 
90 
93  bool BeginTransaction();
94  bool RollbackTransaction();
95  bool CommitTransaction();
97 
102 
106  const char* GetLastErrorText();
107 
111  virtual vtkStdString EscapeString( vtkStdString s, bool addSurroundingQuotes = true );
112 
117  int GetNumberOfRows();
118 
119 protected:
122 
123  vtkSetStringMacro(LastErrorText);
124 
125  bool IsColumnBinary(int whichColumn);
126  const char *GetColumnRawData(int whichColumn);
127 
131 
132  vtkPostgreSQLQueryPrivate *QueryInternals;
133 
134  void DeleteQueryResults();
135 
136  friend class vtkPostgreSQLDatabase;
137 
138 private:
139  vtkPostgreSQLQuery( const vtkPostgreSQLQuery& ) VTK_DELETE_FUNCTION;
140  void operator = ( const vtkPostgreSQLQuery& ) VTK_DELETE_FUNCTION;
141 };
142 
143 #endif // vtkPostgreSQLQuery_h
144 
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:47
virtual bool NextRow()=0
Advance row, return false if past end.
An array holding vtkVariants.
maintain a connection to a PostgreSQL database
virtual const char * GetFieldName(int i)=0
Return the name of the specified query field.
virtual bool CommitTransaction()
Definition: vtkSQLQuery.h:110
int vtkIdType
Definition: vtkType.h:287
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual vtkStdString EscapeString(vtkStdString s, bool addSurroundingQuotes=true)
Escape a string for inclusion into an SQL query.
A atomic type representing the union of many types.
Definition: vtkVariant.h:75
virtual bool HasError()=0
Returns true if an error is set, otherwise false.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSQLQuery implementation for PostgreSQL databases
virtual int GetNumberOfFields()=0
The number of fields in the query result.
virtual bool RollbackTransaction()
Definition: vtkSQLQuery.h:111
virtual bool BeginTransaction()
Begin, commit, or roll back a transaction.
Definition: vtkSQLQuery.h:109
virtual int GetFieldType(int i)=0
Return the type of the field, using the constants defined in vtkType.h.
virtual bool Execute()=0
Execute the query.
virtual vtkVariant DataValue(vtkIdType c)=0
Return data in current row, field c.
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:74
virtual const char * GetLastErrorText()=0
Get the last error text from the query.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkPostgreSQLQueryPrivate * QueryInternals