Class | SQLRCursor
In: | sqlrelay.C
Parent: | Object

### Methods

affectedRows cacheOff cacheToFile clearBinds colCount countBindVariables defineOutputBindBlob defineOutputBindClob defineOutputBindCursor defineOutputBindDouble defineOutputBindInteger defineOutputBindString dontGetColumnInfo endOfResultSet errorMessage executeQuery fetchFromBindCursor firstRowIndex getCacheFileName getColumnInfo getColumnIsAutoIncrement getColumnIsBinary getColumnIsNullable getColumnIsPartOfKey getColumnIsPrimaryKey getColumnIsUnique getColumnIsUnsigned getColumnIsZeroFilled getColumnLength getColumnList getColumnName getColumnNames getColumnPrecision getColumnScale getColumnType getDatabaseList getField getFieldAsDouble getFieldAsInteger getFieldLength getLongest getNullsAsEmptyStrings getNullsAsNils getOutputBindBlob getOutputBindClob getOutputBindCursor getOutputBindDouble getOutputBindInteger getOutputBindLength getOutputBindString getResultSetBufferSize getResultSetId getRow getRowHash getRowLengths getRowLengthsHash getTableList inputBind inputBindBlob inputBindClob inputBinds lowerCaseColumnNames mixedCaseColumnNames new openCachedResultSet prepareFileQuery prepareQuery prepareQueryWithLength resumeCachedResultSet resumeResultSet rowCount sendFileQuery sendQuery sendQueryWithLength setCacheTtl setResultSetBufferSize substitution substitutions suspendResultSet totalRows upperCaseColumnNames validBind validateBinds

### Public Class methods

new(connection)

Creates a cursor to run queries and fetch result sets using connection "connection"

### Public Instance methods

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.

cacheOff()

Sets query caching off.

cacheToFile(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.

clearBinds()

Clears all bind variables.

colCount()

Returns the number of columns in the current result set.

countBindVariables()

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

defineOuptutBindBlob(variable)

Defines a binary lob output bind variable

defineOutputBindClob(variable)

Defines a character lob output bind variable

defineOutputBindCursor(variable)

Defines a cursor output bind variable

defineOutputBindDouble(variable)

Defines an decimal output bind variable.

defineOutputBindInteger(variable)

Defines an integer output bind variable.

defineOutputBindString(variable,length)

Defines a string output bind variable. "length" bytes will be reserved to store the value.

dontGetColumnInfo()

Tells the server not to send any column info (names, types, sizes). If you don‘t need that info, you should call this function to improve performance.

endOfResultSet()

Returns 0 if part of the result set is still pending on the server and 1 if not. This function 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 function returns a nil.

executeQuery()

Execute the query that was previously prepared and bound.

fetchFromBindCursor()

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

firstRowIndex()

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

getCacheFileName()

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

getColumnInfo()

Tells the server to send column info.

getColumnIsAutoIncrement(col)

Returns 1 if the specified column auto-increments and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsBinary(col)

Returns 1 if the specified column contains binary data and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsNullable(col)

Returns 1 if the specified column can contain nulls and 0 otherwise. "col" may be specified as the colum name or number.

getColumnIsPartOfKey(col)

Returns 1 if the specified column is part of a composite key and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsPrimaryKey(col)

Returns 1 if the specified column is a primary key and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsUnique(col)

Returns 1 if the specified column is unique and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsUnsigned(col)

Returns 1 if the specified column is an unsigned number and 0 otherwise. "col" may be specified as the column name or number.

getColumnIsZeroFilled(col)

Returns 1 if the specified column was created with the zero-fill flag and 0 otherwise. "col" may be specified as the column name or number.

getColumnLength(col)

Returns the length of the specified column. "col" may be specified as the column name or number.

getColumnList(table,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 nil then a list of all columns will be returned.

getColumnName(col)

Returns the name of the specified column.

getColumnNames()

Returns an array of the column names of the current result set.

getColumnPrecision(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. "col" may be specified as the column name or number.

getColumnScale(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. "col" may be specified as the column name or number.

getColumnType(col)

Returns the type of the specified column. "col" may be specified as the column name or number.

getDatabaseList(wild)

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

getField(row,col)

Returns the specified field as a string. "col" may be specified as the column name or number.

getFieldAsDouble(row,col)

Returns the specified field as an decimal. "col" may be specified as the column name or number.

getFieldAsInteger(row,col)

Returns the specified field as an integer. "col" may be specified as the column name or number.

getFieldLength(row,col)

Returns the length of the specified row and column. "col" may be specified as the column name or number.

getLongest(col)

Returns the length of the longest field in the specified column. "col" may be specified as the column name or number.

getNullsAsEmptyStrings()

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

getNullsAsNils()

Tells the connection to return NULL fields and output bind variables as nil‘s.

getOutputBindBlob(variable)

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

getOutputBindClob(variable)

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

getOutputBindCursor(variable)

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

getOutputBindDouble(variable)

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

getOutputBindInteger(variable)

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

getOutputBindLength(variable)

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

getOutputBindString(variable)

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

getResultSetBufferSize()

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

getResultSetId()

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

getRow(row)

Returns an array of the values of the fields in the specified row.

getRowHash(row)

Returns a hash of the values of the fields in the specified row.

getRowLengths(row)

Returns an array of the lengths of the fields in the specified row.

getRowLengthsHash(row)

Returns a hash of the lengths of the fields in the specified row.

getTableList(wild)

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

inputBind(variable,value,(precision),(scale))

Defines am input bind variable. The value may be a string, integer or decimal. If it is a decimal then the precision and scale may be specified. If you don‘t have the precision and scale then set them both to 0. However in that case you may get unexpected rounding behavior if the server is faking binds.

inputBindBlob(variable,value,size)

Defines a binary lob input bind variable.

inputBindClob(variable,value,size)

Defines a character lob input bind variable.

inputBinds(variables,values,(precisions),(scales))

Defines an array of input bind variables. The values may be strings, integers or decimals. If they are decimals then the precisions and scales may also be specified.

lowerCaseColumnNames()

Columns names are converted to lower case.

mixedCaseColumnNames()

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

openCachedResultSet(filename)

Opens a cached result set. Returns 1 on success and 0 on failure.

prepareFileQuery(path,filename)

Prepare to execute the contents of "path"/"filename".

prepareQuery(query)

Prepare to execute "query".

prepareQuery(query,length)

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

resumeCachedResultSet(id,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.

resumeResultSet(id)

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

rowCount()

Returns the number of rows in the current result set.

sendFileQuery(path,filename)

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

sendQuery(query)

Sends "query" directly and gets a result set.

sendQueryWithLength(query,length)

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

setCacheTtl(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.

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.

substitution(variable,value,(precision),(scale))

Defines a substitution variable. The value may be a string, integer or decimal. If it is a decimal then the precision and scale may be specified.

substitutions(variables,values,(precisions),(scales))

Defines an array of substitution variables. The values may be strings, integers or decimals. If they are decimals then the precisions and scales may also be specified.

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().

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.

upperCaseColumnNames()

Columns names are converted to upper case.

validBind(variable)

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

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 function

[Validate]