Database pool connection unit.
This object holds a reference and a state about the connection and the state of this connection agains the connection pool.
This connections are used internally by the afgs command module to finally execute SQL statements. In fact, an AfGsConnection object have a internal reference to a AfGsDBConnection object.
On most cases, it is not needed to use this type if the following function are used:
This because these function actually do all the work needed to get the next connection available from the pool and release it when no longer needed.
However, it may turns out that it is required to share the same connection across several SQL calls, mainly because SQL transactions. In this case, it is needed to perform a call to:
Previous function will block the caller until a connection to the database from the channel pool is available. Once returned a connection from this function the caller is warranted to be the unique connection owner.
Then calls to the following functions are done to perform database work using the same context/connection:
Optionally, transaction management commands are also provided:
Finally, when the connection is no longer needed, a call to the next function should be done: