32#ifndef vtkPostgreSQLDatabase_h
33#define vtkPostgreSQLDatabase_h
35#include "vtkIOPostgreSQLModule.h"
38VTK_ABI_NAMESPACE_BEGIN
48 friend class vtkPostgreSQLQueryPrivate;
60 bool Open(
const char* password =
nullptr)
override;
99 vtkGetStringMacro(HostName);
107 vtkGetStringMacro(User);
120 vtkGetStringMacro(DatabaseName);
128 vtkGetStringMacro(ConnectOptions);
135 virtual void SetServerPort(
int);
138 vtkGetMacro(ServerPort,
int);
219 vtkSetStringMacro(DatabaseType);
220 vtkSetStringMacro(LastErrorText);
245#define vtkSetStringPlusMTimeMacro(className, name, timeStamp) \
246 inline void className::Set##name(const char* _arg) \
248 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " \
249 << (_arg ? _arg : "(null)")); \
250 if (this->name == nullptr && _arg == nullptr) \
254 if (this->name && _arg && (!strcmp(this->name, _arg))) \
258 delete[] this->name; \
261 size_t n = strlen(_arg) + 1; \
262 char* cp1 = new char[n]; \
263 const char* cp2 = (_arg); \
272 this->name = nullptr; \
275 this->timeStamp.Modified(); \
287 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting ServerPort to " << _arg);
a simple class to control print indentation
const char * GetClassName() const
Return the class name as a string.
virtual void Modified()
Update the modification time for this object.
internal details of a connection to a PostgreSQL database
maintain a connection to a PostgreSQL database
virtual int GetServerPortMinValue()
The port used for connecting to the database.
bool Open(const char *password=nullptr) override
Open a new connection to the database.
vtkSQLQuery * GetQueryInstance() override
Return an empty query on this database.
bool IsOpen() override
Return whether the database has an open connection.
virtual void SetServerPort(int)
The port used for connecting to the database.
virtual void SetConnectOptions(const char *)
Additional options for the database.
virtual void SetDatabaseName(const char *)
The name of the database to connect to.
bool HasError() override
Did the last operation generate an error.
void NullTrailingWhitespace(char *msg)
~vtkPostgreSQLDatabase() override
void UpdateDataTypeMap()
Create or refresh the map from Postgres column types to VTK array types.
bool IsSupported(int feature) override
Return whether a feature is supported by the database.
virtual void SetHostName(const char *)
The database server host name.
const char * GetDatabaseType() override
String representing database type (e.g.
static vtkPostgreSQLDatabase * New()
bool ParseURL(const char *url) override
Overridden to determine connection parameters given the URL.
vtkStdString GetColumnSpecification(vtkSQLDatabaseSchema *schema, int tblHandle, int colHandle) override
Return the SQL string with the syntax to create a column inside a "CREATE TABLE" SQL statement.
virtual void SetUser(const char *)
The user name for connecting to the database server.
vtkStringArray * GetRecord(const char *table) override
Get the list of fields for a particular table.
vtkStringArray * GetDatabases()
Return a list of databases on the server.
bool DropDatabase(const char *dbName)
Drop a database if it exists.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool OpenInternal(const char *connectionOptions)
virtual int GetServerPortMaxValue()
The port used for connecting to the database.
const char * GetLastErrorText() override
Get the last error text from the database.
void Close() override
Close the connection to the database.
vtkStdString GetURL() override
Get a URL referencing the current database connection.
vtkPostgreSQLDatabasePrivate * Connection
bool CreateDatabase(const char *dbName, bool dropExisting=false)
Create a new database, optionally dropping any existing database of the same name.
vtkTimeStamp ConnectionMTime
vtkStringArray * GetTables() override
Get the list of tables from the database.
virtual void SetPassword(const char *)
The user's password for connecting to the database server.
vtkSQLQuery implementation for PostgreSQL databases
represent an SQL database schema
maintain a connection to an sql database
executes an sql query and retrieves results
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
record modification and/or execution time
void Modified()
Set this objects time to the current time.
#define vtkSetStringPlusMTimeMacro(className, name, timeStamp)