Connection

- NAME
- SYNOPSIS
- DESCRIPTION
- AUTHOR

# NAME

        SQLRelay::Connection - Perl API for SQL Relay

# SYNOPSIS

            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";
            }

# DESCRIPTION

        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.

            setTimeout(timeoutsec, timeoutusec);
                # Sets the server connect timeout in seconds
                # and milliseconds.  Setting either parameter
                # to -1 disables the timeout.

            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.
                # Note: the value returned by this method is
                # only valid after a call to suspendSession().

            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.
                # Note: the value returned by this method is
                # only valid after a call to suspendSession().

            resumeSession(port,socket);
                # Resumes a session previously left open
                # using suspendSession().
                # Returns true on success and false on failure.

            ping();
                # Returns true if the database is up and false
                # if it's down.

            identify();
                # Returns the type of database:
                #   oracle8, postgresql, mysql, etc.

            dbVersion();
                # Returns the version of the database

            serverVersion();
                # Returns the version of the SQL Relay server software

            clientVersion();
                # Returns the version of the SQL Relay client software

            bindFormat();
                # Returns a string representing the format
                # of the bind variables used in the db.

            autoCommitOn();
                # Instructs the database to perform a commit
                # after every successful query.
                # Returns true if setting autocommit on succeeded
                # and false if it failed.

            autoCommitOff();
                # Instructs the database to wait for the
                # client to tell it when to commit.
                # Returns true if setting autocommit off succeeded
                # and false if it failed.

            commit();
                # Issues a commit.  Returns true if the commit
                # succeeded, false if it failed.

            rollback();
                # Issues a rollback.  Returns true if the rollback
                # succeeded, false if it failed.

            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 true if debugging is currently on and false
                # if debugging is currently off.

# AUTHOR

        David Muse
        david.muse@firstworks.com