VTK: IO/PostgreSQL/vtkPostgreSQLQuery.h Source File

| VTK 9.3.1

vtkPostgreSQLQuery.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
23 #ifndef vtkPostgreSQLQuery_h
24 #define vtkPostgreSQLQuery_h
25
26 #include "vtkIOPostgreSQLModule.h" // For export macro
27 #include "vtkSQLQuery.h"
28
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkPostgreSQLDatabase;
31 class vtkVariant;
32 class vtkVariantArray;
33 class vtkPostgreSQLQueryPrivate;
34
35 class VTKIOPOSTGRESQL_EXPORT vtkPostgreSQLQuery : public vtkSQLQuery
36 {
37 public:
38 static vtkPostgreSQLQuery* New();
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40 vtkTypeMacro(vtkPostgreSQLQuery, vtkSQLQuery);
41
47 bool Execute() override;
48
52 int GetNumberOfFields() override;
53
57 const char* GetFieldName(int i) override;
58
62 int GetFieldType(int i) override;
63
67 bool NextRow() override;
68
72 bool HasError() override;
73
75
78 bool BeginTransaction() override;
79 bool RollbackTransaction() override;
80 bool CommitTransaction() override;
82
86 vtkVariant DataValue(vtkIdType c) override;
87
91 const char* GetLastErrorText() override;
92
96 vtkStdString EscapeString(vtkStdString s, bool addSurroundingQuotes = true) override;
97
102 int GetNumberOfRows();
103
104 protected:
105 vtkPostgreSQLQuery();
106 ~vtkPostgreSQLQuery() override;
107
108 vtkSetStringMacro(LastErrorText);
109
110 bool IsColumnBinary(int whichColumn);
111 const char* GetColumnRawData(int whichColumn);
112
113 bool TransactionInProgress;
114 char* LastErrorText;
115 int CurrentRow;
116
117 vtkPostgreSQLQueryPrivate* QueryInternals;
118
119 void DeleteQueryResults();
120
121 friend class vtkPostgreSQLDatabase;
122
123 private:
124 vtkPostgreSQLQuery(const vtkPostgreSQLQuery&) = delete;
125 void operator=(const vtkPostgreSQLQuery&) = delete;
126 };
127
128 VTK_ABI_NAMESPACE_END
129 #endif // vtkPostgreSQLQuery_h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkPostgreSQLDatabase
maintain a connection to a PostgreSQL database
Definition: vtkPostgreSQLDatabase.h:45
vtkPostgreSQLDatabase::vtkPostgreSQLQuery
friend class vtkPostgreSQLQuery
Definition: vtkPostgreSQLDatabase.h:47
vtkPostgreSQLQuery
vtkSQLQuery implementation for PostgreSQL databases
Definition: vtkPostgreSQLQuery.h:36
vtkPostgreSQLQuery::EscapeString
vtkStdString EscapeString(vtkStdString s, bool addSurroundingQuotes=true) override
Escape a string for inclusion into an SQL query.
vtkPostgreSQLQuery::GetNumberOfFields
int GetNumberOfFields() override
The number of fields in the query result.
vtkPostgreSQLQuery::TransactionInProgress
bool TransactionInProgress
Definition: vtkPostgreSQLQuery.h:113
vtkPostgreSQLQuery::HasError
bool HasError() override
Return true if there is an error on the current query.
vtkPostgreSQLQuery::IsColumnBinary
bool IsColumnBinary(int whichColumn)
vtkPostgreSQLQuery::vtkPostgreSQLQuery
vtkPostgreSQLQuery()
vtkPostgreSQLQuery::GetColumnRawData
const char * GetColumnRawData(int whichColumn)
vtkPostgreSQLQuery::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPostgreSQLQuery::GetLastErrorText
const char * GetLastErrorText() override
Get the last error text from the query.
vtkPostgreSQLQuery::Execute
bool Execute() override
Execute the query.
vtkPostgreSQLQuery::QueryInternals
vtkPostgreSQLQueryPrivate * QueryInternals
Definition: vtkPostgreSQLQuery.h:117
vtkPostgreSQLQuery::GetFieldType
int GetFieldType(int i) override
Return the type of the field, using the constants defined in vtkType.h.
vtkPostgreSQLQuery::New
static vtkPostgreSQLQuery * New()
vtkPostgreSQLQuery::CurrentRow
int CurrentRow
Definition: vtkPostgreSQLQuery.h:115
vtkPostgreSQLQuery::RollbackTransaction
bool RollbackTransaction() override
Begin, abort (roll back), or commit a transaction.
vtkPostgreSQLQuery::GetNumberOfRows
int GetNumberOfRows()
Unlike some databases, Postgres can tell you right away how many rows are in the results of your quer...
vtkPostgreSQLQuery::NextRow
bool NextRow() override
Advance row, return false if past end.
vtkPostgreSQLQuery::DataValue
vtkVariant DataValue(vtkIdType c) override
Return data in current row, field c.
vtkPostgreSQLQuery::~vtkPostgreSQLQuery
~vtkPostgreSQLQuery() override
vtkPostgreSQLQuery::BeginTransaction
bool BeginTransaction() override
Begin, abort (roll back), or commit a transaction.
vtkPostgreSQLQuery::CommitTransaction
bool CommitTransaction() override
Begin, abort (roll back), or commit a transaction.
vtkPostgreSQLQuery::DeleteQueryResults
void DeleteQueryResults()
vtkPostgreSQLQuery::LastErrorText
char * LastErrorText
Definition: vtkPostgreSQLQuery.h:114
vtkPostgreSQLQuery::GetFieldName
const char * GetFieldName(int i) override
Return the name of the specified query field.
vtkSQLQuery
executes an sql query and retrieves results
Definition: vtkSQLQuery.h:60
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:47
vtkVariant
A type representing the union of many types.
Definition: vtkVariant.h:62
vtkSQLQuery.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315