SQL Relay node.js API
|
Public Member Functions | |
SQLRConnection (var server, var port, var socket, var user, var password, var retrytime, var tries) | |
setConnectTimeout (var timeoutsec, var timeoutusec) | |
setAuthenticationTimeout (var timeoutsec, var timeoutusec) | |
setResponseTimeout (var timeoutsec, var timeoutusec) | |
function | endSession () |
var | suspendSession () |
var | getConnectionPort () |
var | getConnectionSocket () |
var | resumeSession (var port, var socket) |
var | ping () |
var | identify () |
var | dbVersion () |
var | dbHostName () |
var | dbIpAddress () |
var | serverVersion () |
var | clientVersion () |
var | bindFormat () |
var | selectDatabase (var database) |
var | getCurrentDatabase () |
var | getLastInsertId () |
var | autoCommitOn () |
var | autoCommitOff () |
var | begin () |
var | commit () |
var | rollback () |
var | errorMessage () |
var | errorNumber () |
function | debugOn () |
function | debugOff () |
var | getDebug () |
function | setDebugFile (var filename) |
function | setClientInfo (var clientinfo) |
var | getClientInfo () |
SQLRConnection::SQLRConnection | ( | var | server, |
var | port, | ||
var | socket, | ||
var | user, | ||
var | password, | ||
var | retrytime, | ||
var | tries | ||
) |
Initiates a connection to "server" on "port" or to the unix "socket" on the local machine and authenticates with "user" and "password". Failed connections will be retried for "tries" times, waiting "retrytime" seconds between each try. If "tries" is 0 then retries will continue forever. If "retrytime" is 0 then retries will be attempted on a default interval.
If the "socket" parameter is neither NULL nor "" then an attempt will be made to connect through it before attempting to connect to "server" on "port". If it is NULL or "" then no attempt will be made to connect through the socket.
var SQLRConnection::autoCommitOff | ( | ) |
Instructs the database to wait for the client to tell it when to commit.
var SQLRConnection::autoCommitOn | ( | ) |
Instructs the database to perform a commit after every successful query.
var SQLRConnection::begin | ( | ) |
Begins a transaction. Returns true if the begin succeeded, false if it failed. If the database automatically begins a new transaction when a commit or rollback is issued then this doesn't do anything unless SQL Relay is faking transaction blocks.
var SQLRConnection::bindFormat | ( | ) |
Returns a string representing the format of the bind variables used in the db.
var SQLRConnection::clientVersion | ( | ) |
Returns the version of the sqlrelay client software.
var SQLRConnection::commit | ( | ) |
Commits a transaction. Returns true if the commit succeeded, false if it failed.
var SQLRConnection::dbHostName | ( | ) |
Returns the host name of the database
var SQLRConnection::dbIpAddress | ( | ) |
Returns the ip address of the database
var SQLRConnection::dbVersion | ( | ) |
Returns the version of the database
function SQLRConnection::debugOff | ( | ) |
Turns debugging off.
function SQLRConnection::debugOn | ( | ) |
Causes verbose debugging information to be sent to standard output. Another way to do this is to start a query with "-- debug\n". Yet another way is to set the environment variable SQLR_CLIENT_DEBUG to "ON"
function SQLRConnection::endSession | ( | ) |
Ends the session.
var SQLRConnection::errorMessage | ( | ) |
If an operation failed and generated an error, the error message is available here. If there is no error then this method returns NULL.
var SQLRConnection::errorNumber | ( | ) |
If an operation failed and generated an error, the error number is available here. If there is no error then this method returns 0.
var SQLRConnection::getClientInfo | ( | ) |
Returns the string that was set by setClientInfo().
var SQLRConnection::getConnectionPort | ( | ) |
Returns the inet port that the connection is communicating over. This parameter may be passed to another connection for use in the resumeSession() method. Note: The value this method returns is only valid after a call to suspendSession().
var SQLRConnection::getConnectionSocket | ( | ) |
Returns the unix socket that the connection is communicating over. This parameter may be passed to another connection for use in the resumeSession() method. Note: The value this method returns is only valid after a call to suspendSession().
var SQLRConnection::getCurrentDatabase | ( | ) |
Returns the database/schema that is currently in use.
var SQLRConnection::getDebug | ( | ) |
Returns false if debugging is off and true if debugging is on.
var SQLRConnection::getLastInsertId | ( | ) |
Returns the value of the autoincrement column for the last insert
var SQLRConnection::identify | ( | ) |
Returns the type of database: oracle, postgresql, mysql, etc.
var SQLRConnection::ping | ( | ) |
Returns true if the database is up and false if it's down.
var SQLRConnection::resumeSession | ( | var | port, |
var | socket | ||
) |
Resumes a session previously left open using suspendSession(). Returns true on success and false on failure.
var SQLRConnection::rollback | ( | ) |
Rolls back a transaction. Returns true if the rollback succeeded, false if it failed.
var SQLRConnection::selectDatabase | ( | var | database | ) |
Sets the current database/schema to "database"
var SQLRConnection::serverVersion | ( | ) |
Returns the version of the sqlrelay server software.
SQLRConnection::setAuthenticationTimeout | ( | var | timeoutsec, |
var | timeoutusec | ||
) |
Sets the authentication timeout in seconds and milliseconds. Setting either parameter to -1 disables the timeout. You can also set this timeout using the SQLR_CLIENT_AUTHENTICATION_TIMEOUT environment variable.
function SQLRConnection::setClientInfo | ( | var | clientinfo | ) |
Allows you to set a string that will be passed to the server and ultimately included in server-side logging along with queries that were run by this instance of the client.
SQLRConnection::setConnectTimeout | ( | var | timeoutsec, |
var | timeoutusec | ||
) |
Sets the server connect timeout in seconds and milliseconds. Setting either parameter to -1 disables the timeout. You can also set this timeout using the SQLR_CLIENT_CONNECT_TIMEOUT environment variable.
function SQLRConnection::setDebugFile | ( | var | filename | ) |
Allows you to specify a file to write debug to. Setting "filename" to NULL or an empty string causes debug to be written to standard output (the default).
SQLRConnection::setResponseTimeout | ( | var | timeoutsec, |
var | timeoutusec | ||
) |
Sets the response timeout (for queries, commits, rollbacks, pings, etc.) in seconds and milliseconds. Setting either parameter to -1 disables the timeout. You can also set this timeout using the SQLR_CLIENT_RESPONSE_TIMEOUT environment variable.
var SQLRConnection::suspendSession | ( | ) |
Disconnects this connection from the current session but leaves the session open so that another connection can connect to it using resumeSession().