SQLRelay::Connection - Perl API for SQL Relay
use SQLRelay::Connection;
use SQLRelay::Cursor;
my $sc=SQLRelay::Connection->new("testhost",9000,"",
"testuser","testpassword",0,1);
my $ss=SQLRelay::Cursor->new($sc);
$ss->sendQuery("select table_name from user_tables");
$sc->endSession();
for (my $i=0; $i<$ss->rowCount(); $i++) {
print $ss->getField($i,"table_name"), "\n";
}
SQLRelay::Connection
new(server, port, socket, user, password, retrytime, 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 on interval "retrytime".
# 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.
DESTROY();
# Disconnects and ends the session if
# it hasn't been ended already.
endSession();
# Ends the session.
suspendSession();
# Leaves the session open so another client
# can connect to it.
getConnectionPort();
# Returns the inet port that the client is
# communicating over. This parameter may be
# passed to another client for use in
# the resumeSession() command below.
getConnectionSocket();
# Returns the unix socket that the client is
# communicating over. This parameter may be
# passed to another client for use in
# the resumeSession() command below.
resumeSession(port,socket);
# Resumes a session previously left open
# using suspendSession().
# Returns 1 on success and 0 on failure.
ping();
# Returns 1 if the database is up and 0
# if it's down.
identify();
# Returns the type of database:
# oracle7, oracle8, postgresql, mysql, etc.
autoCommitOn();
# Instructs the database to perform a commit
# after every successful query.
# Returns 1 if setting autocommit on succeeded
# and 0 if it failed.
autoCommitOff();
# Instructs the database to wait for the
# client to tell it when to commit.
# Returns 1 if setting autocommit off succeeded
# and 0 if it failed.
commit();
# Issues a commit. Returns 1 if the commit
# succeeded, 0 if it failed and -1 if an
# error occurred.
rollback();
# Issues a rollback. Returns 1 if the rollback
# succeeded, 0 if it failed and -1 if an
# error occurred.
debugOn();
# Causes verbose debugging information to be
# sent to standard output. Another way to do
# this is to start a query with "-- debug\n".
debugOff();
# Turns debugging off.
getDebug();
# Returns 1 if debugging is currently on and 0
# if debugging is currently off.
David Muse
dmuse@firstworks.com