Google


NAME

    Firstworks::SQLRCursor - Perl API for SQL Relay


SYNOPSIS

        use Firstworks::SQLRConnection;
        use Firstworks::SQLRCursor;
        my $sc=Firstworks::SQLRConnection->new("testhost",9000,"",
                                          "testuser","testpassword",0,1);
        my $ss=Firstworks::SQLRCursor->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

    Firstworks::SQLRCursor
        new(sqlrclient);
        DESTROY();
        setResultSetBufferSize(rows);
            # Sets the number of rows of the result set
            # to buffer at a time.  0 (the default)
            # means buffer the entire result set.
        getResultSetBufferSize();
            # Returns the number of result set rows that 
            # will be buffered at a time or 0 for the
            # entire result set.
        dontGetColumnInfo();
            # Tells the server not to send any column
            # info (names, types, sizes).  If you don't
            # need that info, you should call this
            # method to improve performance.
        getColumnInfo();
            # Tells the server to send column info.
        cacheToFile(char *filename);
            # Sets query caching on.  Future queries
            # will be cached to the file "filename".
            #
            # A default time-to-live of 10 minutes is
            # also set.
            #
            # Note that once cacheToFile() is called,
            # the result sets of all future queries will
            # be cached to that file until another call 
            # to cacheToFile() changes which file to
            # cache to or a call to cacheOff() turns off
            # caching.
        setCacheTtl(int ttl);
            # Sets the time-to-live for cached result
            # sets. The sqlr-cachemanger will remove each 
            # cached result set "ttl" seconds after it's 
            # created, provided it's scanning the directory
            # containing the cache files.
        getCacheFileName();
            # Returns the name of the file containing the
            # cached result set.
        cacheOff();
            # Sets query caching off.
        # If you don't need to use substitution or bind variables
        # in your queries, use these two methods.
        sendQuery(query);
            # Sends "query" and gets a result set.
        sendFileQuery(path,filename);
            # Sends the query in file "path"/"filename" 
            # and gets a result set.
        # If you need to use substitution or bind variables, in your
        # queries use the following methods.  See the API documentation
        # for more information about substitution and bind variables.
        prepareQuery(query);
            # Prepare to execute "query".
        prepareFileQuery(path,filename);
            # Prepare to execute the contents 
            # of "path"/"filename".
        substitution(variable,value);
            # Define a substitution variable.
        clearBinds();
            # Clear all bind variables.
        inputBind(variable,value);
            # Define an input bind variable.
        defineOutputBind(variable,bufferlength);
            # Define an output bind variable.
        substitutions(variables,values);
            # Define an array of substitution variables.
        inputBinds(variables,values);
            # Define an array of input bind variables.
        validateBinds();
            # If you are binding to any variables that 
            # might not actually be in your query, call 
            # this to ensure that the database won't try 
            # to bind them unless they really are in the 
            # query.
        executeQuery();
            # Execute the query that was previously 
            # prepared and bound.
        getOutputBind(variable);
            # Get the value stored in a previously
            # defined output bind variable.
        openCachedResultSet(filename);
            # Opens a cached result set as if a query that
            # would have generated it had been executed.
            # Returns 1 on success and 0 on failure.
        colCount();
            # Returns the number of columns in the current
            # result set.
        rowCount();
            # Returns the number of rows in the current 
            # result set.
        totalRows();
            # Returns the total number of rows that will 
            # be returned in the result set.  Not all 
            # databases support this call.  Don't use it 
            # for applications which are designed to be 
            # portable across databases.  -1 is returned
            # by databases which don't support this option.
        affectedRows();
            # Returns the number of rows that were 
            # updated, inserted or deleted by the query.
            # Not all databases support this call.  Don't 
            # use it for applications which are designed 
            # to be portable across databases.  -1 is 
            # returned by databases which don't support 
            # this option.
        firstRowIndex();
            # Returns the index of the first buffered row.
            # This is useful when bufferning only part of the
            # result set at a time.
        endOfResultSet();
            # Returns 0 if part of the result set is still
            # pending on the server and 1 if not.  This
            # method can only return 0 if 
            # setResultSetBufferSize() has been called
            # with a parameter other than 0.
        errorMessage();
            # If a query failed and generated an error, the
            # error message is available here.  If the 
            # query succeeded then this method returns a 
            # NULL.
        getNullsAsEmptyStrings();
            # Tells the client to return NULL fields and 
            # output bind variables as empty strings.
            # This is the default.
        getNullsAsUndefined();
            # Tells the client to return NULL fields and 
            # output bind variables as undefined.
        getField(row, col);
            # Returns a pointer to the value of the 
            # specified row and column.
        getFieldLength(row, col);
            # Returns a the length of the 
            # specified row and column.
        getRow(row);
            # Returns a null terminated array of the 
            # values of the specified row.
        getRowHash(row);
            # Returns the requested row as values in a
            # hash with column names for keys.
        getRowLengths(row);
            # Returns a null terminated array of the 
            # lengths of the specified row.
        getRowLengthsHash(row);
            # Returns the requested row lengths as values 
            # in a hash with column names for keys.
        getColumnNames();
            # Returns a null terminated array of the 
            # column names of the current result set.
        getColumnName(col);
            # Returns the name of the specified column.
        getColumnType(col);
            # Returns the type of the specified column.
        getColumnLength(col);
            # Returns the length of the specified column.
        getLongest(col);
            # Returns the length of the longest field
            # in the specified column.
        getResultSetId();
            # Returns the internal ID of this result set.
            # This parameter may be passed to another 
            # statement for use in the resumeResultSet() 
            # method.
        suspendResultSet();
            # Tells the server to leave this result
            # set open when the client calls 
            # suspendSession() so that another client can 
            # connect to it using resumeResultSet() after 
            # it calls resumeSession().
        resumeResultSet(int id);
            # Resumes a result set previously left open 
            # using suspendSession().
            # Returns 1 on success and 0 on failure.
        resumeCachedResultSet(int id, char *filename);
            # Resumes a result set previously left open
            # using suspendSession() and continues caching
            # the result set to "filename".
            # Returns 1 on success and 0 on failure.


AUTHOR

    David Muse
    mused@firstworks.com