Go to the documentation of this file.
49 #ifndef vtkPostgreSQLDatabase_h
50 #define vtkPostgreSQLDatabase_h
52 #include "vtkIOPostgreSQLModule.h"
64 friend class vtkPostgreSQLQueryPrivate;
76 bool Open(
const char* password = 0 )
override;
81 void Close()
override;
109 return this->DatabaseType;
117 virtual void SetHostName(
const char* );
118 vtkGetStringMacro(HostName);
125 virtual void SetUser(
const char* );
126 vtkGetStringMacro(User);
132 virtual void SetPassword(
const char* );
138 virtual void SetDatabaseName(
const char* );
139 vtkGetStringMacro(DatabaseName);
146 virtual void SetConnectOptions(
const char* );
147 vtkGetStringMacro(ConnectOptions);
154 virtual void SetServerPort(
int );
163 vtkGetMacro(ServerPort,
int);
198 bool CreateDatabase(
const char* dbName,
bool dropExisting =
false );
204 bool DropDatabase(
const char* dbName );
240 void UpdateDataTypeMap();
242 vtkSetStringMacro(DatabaseType);
243 vtkSetStringMacro(LastErrorText);
244 void NullTrailingWhitespace(
char* msg );
245 bool OpenInternal(
const char* connectionOptions );
268 #define vtkSetStringPlusMTimeMacro(className,name,timeStamp) \
269 inline void className::Set##name (const char* _arg) \
271 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " << (_arg?_arg:"(null)") ); \
272 if ( this->name == nullptr && _arg == nullptr) { return;} \
273 if ( this->name && _arg && (!strcmp(this->name,_arg))) { return;} \
274 delete [] this->name; \
277 size_t n = strlen(_arg) + 1; \
278 char *cp1 = new char[n]; \
279 const char *cp2 = (_arg); \
281 do { *cp1++ = *cp2++; } while ( --n ); \
285 this->name = nullptr; \
288 this->timeStamp.Modified(); \
300 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting ServerPort to " << _arg );
310 #endif // vtkPostgreSQLDatabase_h
virtual vtkStringArray * GetRecord(const char *table)=0
Get the list of fields for a particular table.
internal details of a connection to a PostgreSQL database
virtual bool IsSupported(int vtkNotUsed(feature))
Return whether a feature is supported by the database.
virtual void Close()=0
Close the connection to the database.
virtual bool HasError()=0
Did the last operation generate an error.
virtual int GetServerPortMinValue()
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
record modification and/or execution time
virtual void Modified()
Update the modification time for this object.
maintain a connection to a PostgreSQL database
virtual vtkSQLQuery * GetQueryInstance()=0
Return an empty query on this database.
vtkPostgreSQLDatabasePrivate * Connection
virtual void SetServerPort(int)
The port used for connecting to the database.
virtual bool IsOpen()=0
Return whether the database has an open connection.
virtual bool Open(const char *password)=0
Open a new connection to the database.
const char * GetClassName() const
Return the class name as a string.
void Modified()
Set this objects time to the current time.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp ConnectionMTime
a simple class to control print indentation
vtkSQLQuery implementation for PostgreSQL databases
void Close() override
Close the connection to the database.
virtual int GetServerPortMaxValue()
virtual vtkStringArray * GetTables()=0
Get the list of tables from the database.
represent an SQL database schema
virtual vtkStdString GetURL()=0
Get the URL of the database.
virtual vtkStdString GetColumnSpecification(vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle)
Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement.
a vtkAbstractArray subclass for strings
const char * GetDatabaseType() override
String representing database type (e.g.
virtual bool ParseURL(const char *url)=0
Subclasses should override this method to determine connection parameters given the URL.
#define vtkSetStringPlusMTimeMacro(className, name, timeStamp)
Wrapper around std::string to keep symbols short.
virtual const char * GetLastErrorText()=0
Get the last error text from the database I'm using const so that people do NOT use the standard vtkG...
executes an sql query and retrieves results
maintain a connection to an sql database