SQL Relay node.js API

- Main Page
- Classes

- Class List
- Class Members

Public Member Functions | List of all members
SQLRCursor Class Reference

## Public Member Functions
| SQLRCursor (var sqlrc)
function | setResultSetBufferSize (var rows)
var | getResultSetBufferSize ()
function | dontGetColumnInfo ()
function | getColumnInfo ()
function | mixedCaseColumnNames ()
function | upperCaseColumnNames ()
function | lowerCaseColumnNames ()
function | cacheToFile (var filename)
function | setCacheTtl (var ttl)
var | getCacheFileName ()
function | cacheOff ()
var | getDatabaseList (var wild)
var | getTableList (var wild)
var | getColumnList (var table, var wild)
var | sendQuery (var query)
var | sendQuery (var query, var length)
var | sendFileQuery (var path, var filename)
function | prepareQuery (var query)
function | prepareQuery (var query, var length)
var | prepareFileQuery (var path, var filename)
function | substitution (var variable, var value)
function | substitution (var variable, var value)
function | substitution (var variable, var value, var precision, var scale)
function | substitutions (var variables, var values)
function | substitutions (var variables, var values)
function | substitutions (var variables, var values, var precisions, var scales)
function | inputBind (var variable, var value)
function | inputBind (var variable, var value, var valuelength)
function | inputBind (var variable, var value)
function | inputBind (var variable, var value, var precision, var scale)
function | inputBind (var variable, var year, var month, var day, var hour, var minute, var second, var microsecond, var tz)
function | inputBindBlob (var variable, var value, var size)
function | inputBindClob (var variable, var value, var size)
function | inputBinds (var variables, var values)
function | inputBinds (var variables, const var values)
function | inputBinds (var variables, const var values, const var precisions, const var scales)
function | defineOutputBindString (var variable, var bufferlength)
function | defineOutputBindInteger (var variable)
function | defineOutputBindDouble (var variable)
function | defineOutputBindDate (var variable)
function | defineOutputBindBlob (var variable)
function | defineOutputBindClob (var variable)
function | defineOutputBindCursor (var variable)
function | clearBinds ()
var | countBindVariables () const
function | validateBinds ()
var | validBind (var variable)
var | executeQuery ()
var | fetchFromBindCursor ()
var | getOutputBindString (var variable)
var | getOutputBindInteger (var variable)
var | getOutputBindDouble (var variable)
var | getOutputBindDate (var variable, var year, var month, var day, var hour, var minute, var second, var microsecond, var tz)
var | getOutputBindBlob (var variable)
var | getOutputBindClob (var variable)
var | getOutputBindLength (var variable)
var | getOutputBindCursor (var variable)
var | openCachedResultSet (var filename)
var | colCount ()
var | rowCount ()
var | totalRows ()
var | affectedRows ()
var | firstRowIndex ()
var | endOfResultSet ()
var | errorMessage ()
var | errorNumber ()
function | getNullsAsEmptyStrings ()
function | getNullsAsNulls ()
var | getField (var row, var col)
var | getField (var row, var col)
var | getFieldAsInteger (var row, var col)
var | getFieldAsInteger (var row, var col)
var | getFieldAsDouble (var row, var col)
var | getFieldAsDouble (var row, var col)
var | getFieldLength (var row, var col)
var | getFieldLength (var row, var col)
var | getRow (var row)
var | getRowLengths (var row)
var | getColumnNames ()
var | getColumnName (var col)
var | getColumnType (var col)
var | getColumnType (var col)
var | getColumnLength (var col)
var | getColumnLength (var col)
var | getColumnPrecision (var col)
var | getColumnPrecision (var col)
var | getColumnScale (var col)
var | getColumnScale (var col)
var | getColumnIsNullable (var col)
var | getColumnIsNullable (var col)
var | getColumnIsPrimaryKey (var col)
var | getColumnIsPrimaryKey (var col)
var | getColumnIsUnique (var col)
var | getColumnIsUnique (var col)
var | getColumnIsPartOfKey (var col)
var | getColumnIsPartOfKey (var col)
var | getColumnIsUnsigned (var col)
var | getColumnIsUnsigned (var col)
var | getColumnIsZeroFilled (var col)
var | getColumnIsZeroFilled (var col)
var | getColumnIsBinary (var col)
var | getColumnIsBinary (var col)
var | getColumnIsAutoIncrement (var col)
var | getColumnIsAutoIncrement (var col)
var | getLongest (var col)
var | getLongest (var col)
function | suspendResultSet ()
var | getResultSetId ()
var | resumeResultSet (var id)
var | resumeCachedResultSet (var id, var filename)
function | closeResultSet ()

## Constructor & Destructor Documentation

SQLRCursor::SQLRCursor | ( | var | sqlrc | ) |

Creates a cursor to run queries and fetch result sets using connecton "sqlrc".

## Member Function Documentation

var SQLRCursor::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. 0 is returned by databases which don't support this option.

function SQLRCursor::cacheOff | ( |  | ) |

Sets query caching off.

function SQLRCursor::cacheToFile | ( | var | 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.

function SQLRCursor::clearBinds | ( |  | ) |

Clears all bind variables.

function SQLRCursor::closeResultSet | ( |  | ) |

Closes the current result set, if one is open. Data that has been fetched already is still available but no more data may be fetched. Server side resources for the result set are freed as well.

var SQLRCursor::colCount | ( |  | ) |

Returns the number of columns in the current result set.

var SQLRCursor::countBindVariables | ( |  | ) | const

Parses the previously prepared query, counts the number of bind variables defined in it and returns that number.

function SQLRCursor::defineOutputBindBlob | ( | var | variable | ) |

Defines a binary lob output bind variable.

function SQLRCursor::defineOutputBindClob | ( | var | variable | ) |

Defines a character lob output bind variable.

function SQLRCursor::defineOutputBindCursor | ( | var | variable | ) |

Defines a cursor output bind variable.

function SQLRCursor::defineOutputBindDate | ( | var | variable | ) |

Defines a date output bind variable.

function SQLRCursor::defineOutputBindDouble | ( | var | variable | ) |

Defines a decimal output bind variable.

function SQLRCursor::defineOutputBindInteger | ( | var | variable | ) |

Defines an integer output bind variable.

function SQLRCursor::defineOutputBindString | ( | var | variable,
|  | var | bufferlength
| ) |  |

Defines an output bind variable. "bufferlength" bytes will be reserved to store the value.

function SQLRCursor::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.

var SQLRCursor::endOfResultSet | ( |  | ) |

Returns false if part of the result set is still pending on the server and true if not. This method can only return false if setResultSetBufferSize() has been called with a parameter other than 0.

var SQLRCursor::errorMessage | ( |  | ) |

If a query failed and generated an error, the error message is available here. If the query succeeded then this method returns NULL.

var SQLRCursor::errorNumber | ( |  | ) |

If a query failed and generated an error, the error number is available here. If there is no error then this method returns 0.

var SQLRCursor::executeQuery | ( |  | ) |

Execute the query that was previously prepared and bound.

var SQLRCursor::fetchFromBindCursor | ( |  | ) |

Fetch from a cursor that was returned as an output bind variable.

var SQLRCursor::firstRowIndex | ( |  | ) |

Returns the index of the first buffered row. This is useful when buffering only part of the result set at a time.

var SQLRCursor::getCacheFileName | ( |  | ) |

Returns the name of the file containing the cached result set.

function SQLRCursor::getColumnInfo | ( |  | ) |

Tells the server to send column info.

var SQLRCursor::getColumnIsAutoIncrement | ( | var | col | ) |

Returns true if the specified column auto-increments and false otherwise.

var SQLRCursor::getColumnIsAutoIncrement | ( | var | col | ) |

Returns true if the specified column auto-increments and false otherwise.

var SQLRCursor::getColumnIsBinary | ( | var | col | ) |

Returns true if the specified column contains binary data and false otherwise.

var SQLRCursor::getColumnIsBinary | ( | var | col | ) |

Returns true if the specified column contains binary data and false otherwise.

var SQLRCursor::getColumnIsNullable | ( | var | col | ) |

Returns true if the specified column can contain nulls and false otherwise.

var SQLRCursor::getColumnIsNullable | ( | var | col | ) |

Returns true if the specified column can contain nulls and false otherwise.

var SQLRCursor::getColumnIsPartOfKey | ( | var | col | ) |

Returns true if the specified column is part of a composite key and false otherwise.

var SQLRCursor::getColumnIsPartOfKey | ( | var | col | ) |

Returns true if the specified column is part of a composite key and false otherwise.

var SQLRCursor::getColumnIsPrimaryKey | ( | var | col | ) |

Returns true if the specified column is a primary key and false otherwise.

var SQLRCursor::getColumnIsPrimaryKey | ( | var | col | ) |

Returns true if the specified column is a primary key and false otherwise.

var SQLRCursor::getColumnIsUnique | ( | var | col | ) |

Returns true if the specified column is unique and false otherwise.

var SQLRCursor::getColumnIsUnique | ( | var | col | ) |

Returns true if the specified column is unique and false otherwise.

var SQLRCursor::getColumnIsUnsigned | ( | var | col | ) |

Returns true if the specified column is an unsigned number and false otherwise.

var SQLRCursor::getColumnIsUnsigned | ( | var | col | ) |

Returns true if the specified column is an unsigned number and false otherwise.

var SQLRCursor::getColumnIsZeroFilled | ( | var | col | ) |

Returns true if the specified column was created with the zero-fill flag and false otherwise.

var SQLRCursor::getColumnIsZeroFilled | ( | var | col | ) |

Returns true if the specified column was created with the zero-fill flag and false otherwise.

var SQLRCursor::getColumnLength | ( | var | col | ) |

Returns the number of bytes required on the server to store the data for the specified column

var SQLRCursor::getColumnLength | ( | var | col | ) |

Returns the number of bytes required on the server to store the data for the specified column

var SQLRCursor::getColumnList | ( | var | table,
|  | var | wild
| ) |  |

Sends a query that returns a list of columns in the table specified by the "table" parameter matching "wild". If wild is empty or NULL then a list of all columns will be returned.

var SQLRCursor::getColumnName | ( | var | col | ) |

Returns the name of the specified column.

var SQLRCursor::getColumnNames | ( |  | ) |

Returns a null terminated array of the column names of the current result set.

var SQLRCursor::getColumnPrecision | ( | var | col | ) |

Returns the precision of the specified column. Precision is the total number of digits in a number. eg: 123.45 has a precision of 5. For non-numeric types, it's the number of characters in the string.

var SQLRCursor::getColumnPrecision | ( | var | col | ) |

Returns the precision of the specified column. Precision is the total number of digits in a number. eg: 123.45 has a precision of 5. For non-numeric types, it's the number of characters in the string.

var SQLRCursor::getColumnScale | ( | var | col | ) |

Returns the scale of the specified column. Scale is the total number of digits to the right of the decimal point in a number. eg: 123.45 has a scale of 2.

var SQLRCursor::getColumnScale | ( | var | col | ) |

Returns the scale of the specified column. Scale is the total number of digits to the right of the decimal point in a number. eg: 123.45 has a scale of 2.

var SQLRCursor::getColumnType | ( | var | col | ) |

Returns the type of the specified column.

var SQLRCursor::getColumnType | ( | var | col | ) |

Returns the type of the specified column.

var SQLRCursor::getDatabaseList | ( | var | wild | ) |

Sends a query that returns a list of databases/schemas matching "wild". If wild is empty or NULL then a list of all databases/schemas will be returned.

var SQLRCursor::getField | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as a string.

var SQLRCursor::getField | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as a string

var SQLRCursor::getFieldAsDouble | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as a decimal.

var SQLRCursor::getFieldAsDouble | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as a decimal.

var SQLRCursor::getFieldAsInteger | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as an integer.

var SQLRCursor::getFieldAsInteger | ( | var | row,
|  | var | col
| ) |  |

Returns the specified field as an integer.

var SQLRCursor::getFieldLength | ( | var | row,
|  | var | col
| ) |  |

Returns the length of the specified field.

var SQLRCursor::getFieldLength | ( | var | row,
|  | var | col
| ) |  |

Returns the length of the specified field.

var SQLRCursor::getLongest | ( | var | col | ) |

Returns the length of the longest field in the specified column.

var SQLRCursor::getLongest | ( | var | col | ) |

Returns the length of the longest field in the specified column.

function SQLRCursor::getNullsAsEmptyStrings | ( |  | ) |

Tells the connection to return NULL fields and output bind variables as empty strings. This is the default.

function SQLRCursor::getNullsAsNulls | ( |  | ) |

Tells the connection to return NULL fields and output bind variables as NULL's rather than as empty strings.

var SQLRCursor::getOutputBindBlob | ( | var | variable | ) |

Get the value stored in a previously defined binary lob output bind variable.

var SQLRCursor::getOutputBindClob | ( | var | variable | ) |

Get the value stored in a previously defined character lob output bind variable.

var SQLRCursor::getOutputBindCursor | ( | var | variable | ) |

Get the cursor associated with a previously defined output bind variable.

var SQLRCursor::getOutputBindDate | ( | var | variable,
|  | var | year,
|  | var | month,
|  | var | day,
|  | var | hour,
|  | var | minute,
|  | var | second,
|  | var | microsecond,
|  | var | tz
| ) |  |

Get the value stored in a previously defined date output bind variable.

var SQLRCursor::getOutputBindDouble | ( | var | variable | ) |

Get the value stored in a previously defined decimal output bind variable.

var SQLRCursor::getOutputBindInteger | ( | var | variable | ) |

Get the value stored in a previously defined integer output bind variable.

var SQLRCursor::getOutputBindLength | ( | var | variable | ) |

Get the length of the value stored in a previously defined output bind variable.

var SQLRCursor::getOutputBindString | ( | var | variable | ) |

Get the value stored in a previously defined string output bind variable.

var SQLRCursor::getResultSetBufferSize | ( |  | ) |

Returns the number of result set rows that will be buffered at a time or 0 for the entire result set.

var SQLRCursor::getResultSetId | ( |  | ) |

Returns the internal ID of this result set. This parameter may be passed to another cursor for use in the resumeResultSet() method. Note: The value this method returns is only valid after a call to suspendResultSet().

var SQLRCursor::getRow | ( | var | row | ) |

Returns a null terminated array of the values of the fields in the specified row.

var SQLRCursor::getRowLengths | ( | var | row | ) |

Returns a null terminated array of the lengths of the fields in the specified row.

var SQLRCursor::getTableList | ( | var | wild | ) |

Sends a query that returns a list of tables matching "wild". If wild is empty or NULL then a list of all tables will be returned.

function SQLRCursor::inputBind | ( | var | variable,
|  | var | value
| ) |  |

Defines a string input bind variable.

function SQLRCursor::inputBind | ( | var | variable,
|  | var | value,
|  | var | valuelength
| ) |  |

Defines a string input bind variable.

function SQLRCursor::inputBind | ( | var | variable,
|  | var | value
| ) |  |

Defines a integer input bind variable.

function SQLRCursor::inputBind | ( | var | variable,
|  | var | value,
|  | var | precision,
|  | var | scale
| ) |  |

Defines a decimal input bind variable. (If you don't have the precision and scale then set them both 0. However in that case you may get unexpected rounding behavior if the server is faking binds.)

function SQLRCursor::inputBind | ( | var | variable,
|  | var | year,
|  | var | month,
|  | var | day,
|  | var | hour,
|  | var | minute,
|  | var | second,
|  | var | microsecond,
|  | var | tz
| ) |  |

Defines a date input bind variable. "day" should be 1-31 and "month" should be 1-12. "tz" may be left NULL. Most databases ignore "tz".

function SQLRCursor::inputBindBlob | ( | var | variable,
|  | var | value,
|  | var | size
| ) |  |

Defines a binary lob input bind variable.

function SQLRCursor::inputBindClob | ( | var | variable,
|  | var | value,
|  | var | size
| ) |  |

Defines a character lob input bind variable.

function SQLRCursor::inputBinds | ( | var | variables,
|  | var | values
| ) |  |

Defines an array of string input bind variables.

function SQLRCursor::inputBinds | ( | var | variables,
|  | const var | values
| ) |  |

Defines an array of integer input bind variables.

function SQLRCursor::inputBinds | ( | var | variables,
|  | const var | values,
|  | const var | precisions,
|  | const var | scales
| ) |  |

Defines an array of decimal input bind variables.

function SQLRCursor::lowerCaseColumnNames | ( |  | ) |

Columns names are converted to lower case.

function SQLRCursor::mixedCaseColumnNames | ( |  | ) |

Columns names are returned in the same case as they are defined in the database. This is the default.

var SQLRCursor::openCachedResultSet | ( | var | filename | ) |

Opens a cached result set. Returns true on success and false on failure.

var SQLRCursor::prepareFileQuery | ( | var | path,
|  | var | filename
| ) |  |

Prepare to execute the contents of "path"/"filename". Returns false if the // file couldn't be opened.

function SQLRCursor::prepareQuery | ( | var | query | ) |

Prepare to execute "query".

function SQLRCursor::prepareQuery | ( | var | query,
|  | var | length
| ) |  |

Prepare to execute "query" with length "length". This method must be used if the query contains binary data.

var SQLRCursor::resumeCachedResultSet | ( | var | id,
|  | var | filename
| ) |  |

Resumes a result set previously left open using suspendSession() and continues caching the result set to "filename". Returns true on success and false on failure.

var SQLRCursor::resumeResultSet | ( | var | id | ) |

Resumes a result set previously left open using suspendSession(). Returns true on success and false on failure.

var SQLRCursor::rowCount | ( |  | ) |

Returns the number of rows in the current result set (if the result set is being stepped through, this returns the number of rows processed so far).

var SQLRCursor::sendFileQuery | ( | var | path,
|  | var | filename
| ) |  |

Sends the query in file "path"/"filename" directly and gets a result set.

var SQLRCursor::sendQuery | ( | var | query | ) |

Sends "query" directly and gets a result set.

var SQLRCursor::sendQuery | ( | var | query,
|  | var | length
| ) |  |

Sends "query" with length "length" directly and gets a result set. This method must be used if the query contains binary data.

function SQLRCursor::setCacheTtl | ( | var | 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.

function SQLRCursor::setResultSetBufferSize | ( | var | rows | ) |

Sets the number of rows of the result set to buffer at a time. 0 (the default) means buffer the entire result set.

function SQLRCursor::substitution | ( | var | variable,
|  | var | value
| ) |  |

Defines a string substitution variable.

function SQLRCursor::substitution | ( | var | variable,
|  | var | value
| ) |  |

Defines an integer substitution variable.

function SQLRCursor::substitution | ( | var | variable,
|  | var | value,
|  | var | precision,
|  | var | scale
| ) |  |

Defines a decimal substitution variable.

function SQLRCursor::substitutions | ( | var | variables,
|  | var | values
| ) |  |

Defines an array of string substitution variables.

function SQLRCursor::substitutions | ( | var | variables,
|  | var | values
| ) |  |

Defines an array of integer substitution variables.

function SQLRCursor::substitutions | ( | var | variables,
|  | var | values,
|  | var | precisions,
|  | var | scales
| ) |  |

Defines an array of decimal substitution variables.

function SQLRCursor::suspendResultSet | ( |  | ) |

Tells the server to leave this result set open when the connection calls suspendSession() so that another connection can connect to it using resumeResultSet() after it calls resumeSession().

var SQLRCursor::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. 0 is returned by databases which don't support this option.

function SQLRCursor::upperCaseColumnNames | ( |  | ) |

Columns names are converted to upper case.

function SQLRCursor::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. There is a performance penalty for calling this method.

var SQLRCursor::validBind | ( | var | variable | ) |

Returns true if "variable" was a valid bind variable of the query.