A class that implements a connection to a PostgreSQL database.
More...
#include <Connection.h>
|
| void | execute (const std::string &command) |
| | It executes the given SQL command and throws away the result.
|
| |
| PGconn * | getConn () const |
| | It gets the underlying PGconn object.
|
| |
| ConnectionPool * | getPool () const |
| | It gets the associated connection pool.
|
| |
| PGresult * | query (const std::string &query) |
| | It queries the database.
|
| |
| | ~Connection () |
| | Destructor.
|
| |
|
| int | m_id |
| | The connection Id.
|
| |
| bool | m_inuse |
| | Tells if the connection is in use or not.
|
| |
| boost::posix_time::ptime | m_lastuse |
| | It marks the last time this connection was used.
|
| |
| PGconn * | m_pgconn |
| | The PostgreSQL real connection handle.
|
| |
| ConnectionPool * | m_pool |
| | The connection pool associated to the connection.
|
| |
|
| | Connection (ConnectionPool *pool, const std::string &conninfo, const std::string &cencoding, bool inuse=false) |
| | Constructor.
|
| |
A class that implements a connection to a PostgreSQL database.
This class models a physical connection to a PostgreSQL data source. It is designed to work with the connection pool.
- See also
- ConnectionPool
Definition at line 68 of file Connection.h.
◆ ~Connection()
| te::pgis::Connection::~Connection |
( |
| ) |
|
◆ Connection()
| te::pgis::Connection::Connection |
( |
ConnectionPool * |
pool, |
|
|
const std::string & |
conninfo, |
|
|
const std::string & |
cencoding, |
|
|
bool |
inuse = false |
|
) |
| |
|
private |
Constructor.
- Parameters
-
| pool | The associated connection pool. |
| conninfo | A coonection string as undertood by libpq. |
| cecoding | The character encoding used by application. |
| inuse | A marker that tells if the connection is in use or not. |
◆ execute()
| void te::pgis::Connection::execute |
( |
const std::string & |
command | ) |
|
It executes the given SQL command and throws away the result.
- Parameters
-
- Exceptions
-
| Exception | It throws an exception if the query execution fails. |
◆ getConn()
| PGconn * te::pgis::Connection::getConn |
( |
| ) |
const |
|
inline |
It gets the underlying PGconn object.
- Returns
- The underlying PGconn object.
Definition at line 97 of file Connection.h.
◆ getPool()
It gets the associated connection pool.
- Returns
- The associated connection pool.
Definition at line 107 of file Connection.h.
◆ query()
| PGresult * te::pgis::Connection::query |
( |
const std::string & |
query | ) |
|
It queries the database.
- Parameters
-
| query | A SQL Select command. |
- Returns
- A resultset. The caller of this method will take its ownership.
- Exceptions
-
| Exception | It throws an exception if the query execution fails. |
◆ ConnectionPool
◆ m_id
| int te::pgis::Connection::m_id |
◆ m_inuse
| bool te::pgis::Connection::m_inuse |
Tells if the connection is in use or not.
Definition at line 132 of file Connection.h.
◆ m_lastuse
| boost::posix_time::ptime te::pgis::Connection::m_lastuse |
It marks the last time this connection was used.
Definition at line 133 of file Connection.h.
◆ m_pgconn
| PGconn* te::pgis::Connection::m_pgconn |
The PostgreSQL real connection handle.
Definition at line 131 of file Connection.h.
◆ m_pool
The connection pool associated to the connection.
Definition at line 130 of file Connection.h.
The documentation for this class was generated from the following file:
- /home/castejon/castejon_files/develop/terralib5/git_release/src/terralib/postgis/Connection.h