 |
VTK
9.0.1
|
Go to the documentation of this file.
46 #ifndef vtkPostgreSQLDatabase_h
47 #define vtkPostgreSQLDatabase_h
49 #include "vtkIOPostgreSQLModule.h"
61 friend class vtkPostgreSQLQueryPrivate;
73 bool Open(
const char* password = 0)
override;
112 vtkGetStringMacro(HostName);
120 vtkGetStringMacro(User);
133 vtkGetStringMacro(DatabaseName);
141 vtkGetStringMacro(ConnectOptions);
148 virtual void SetServerPort(
int);
151 vtkGetMacro(ServerPort,
int);
230 vtkSetStringMacro(DatabaseType);
231 vtkSetStringMacro(LastErrorText);
256 #define vtkSetStringPlusMTimeMacro(className, name, timeStamp) \
257 inline void className::Set##name(const char* _arg) \
259 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting " << #name " to " \
260 << (_arg ? _arg : "(null)")); \
261 if (this->name == nullptr && _arg == nullptr) \
265 if (this->name && _arg && (!strcmp(this->name, _arg))) \
269 delete[] this->name; \
272 size_t n = strlen(_arg) + 1; \
273 char* cp1 = new char[n]; \
274 const char* cp2 = (_arg); \
283 this->name = nullptr; \
286 this->timeStamp.Modified(); \
298 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting ServerPort to " << _arg);
308 #endif // vtkPostgreSQLDatabase_h
internal details of a connection to a PostgreSQL database
virtual bool HasError() override
Did the last operation generate an error.
static vtkPostgreSQLDatabase * New()
bool ParseURL(const char *url) override
Overridden to determine connection parameters given the URL.
vtkSQLQuery * GetQueryInstance() override
Return an empty query on this database.
virtual void SetPassword(const char *)
The user's password for connecting to the database server.
virtual int GetServerPortMinValue()
vtkStdString GetURL() override
Get a URL referencing the current database connection.
record modification and/or execution time
virtual void Modified()
Update the modification time for this object.
maintain a connection to a PostgreSQL database
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool OpenInternal(const char *connectionOptions)
const char * GetLastErrorText() override
Get the last error text from the database.
vtkPostgreSQLDatabasePrivate * Connection
virtual void SetServerPort(int)
The port used for connecting to the database.
bool Open(const char *password=0) override
Open a new connection to the database.
const char * GetClassName() const
Return the class name as a string.
virtual void SetConnectOptions(const char *)
Additional options for the database.
void Modified()
Set this objects time to the current time.
vtkTimeStamp ConnectionMTime
bool CreateDatabase(const char *dbName, bool dropExisting=false)
Create a new database, optionally dropping any existing database of the same name.
a simple class to control print indentation
vtkSQLQuery implementation for PostgreSQL databases
void Close() override
Close the connection to the database.
vtkStringArray * GetDatabases()
Return a list of databases on the server.
virtual int GetServerPortMaxValue()
void NullTrailingWhitespace(char *msg)
~vtkPostgreSQLDatabase() override
bool IsOpen() override
Return whether the database has an open connection.
represent an SQL database schema
bool IsSupported(int feature) override
Return whether a feature is supported by the database.
void UpdateDataTypeMap()
Create or refresh the map from Postgres column types to VTK array types.
vtkStringArray * GetRecord(const char *table) override
Get the list of fields for a particular table.
a vtkAbstractArray subclass for strings
bool DropDatabase(const char *dbName)
Drop a database if it exists.
const char * GetDatabaseType() override
String representing database type (e.g.
#define vtkSetStringPlusMTimeMacro(className, name, timeStamp)
Wrapper around std::string to keep symbols short.
virtual void SetDatabaseName(const char *)
The name of the database to connect to.
virtual void SetUser(const char *)
The user name for connecting to the database server.
executes an sql query and retrieves results
vtkStringArray * GetTables() override
Get the list of tables from the database.
virtual void SetHostName(const char *)
The database server host name.
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.
maintain a connection to an sql database