SQL Relay C# API
Public Member Functions | Protected Member Functions | List of all members
SQLRClient.SQLRCursor Class Reference

Inherits IDisposable.

Public Member Functions

 SQLRCursor (SQLRConnection conn)
 
void Dispose ()
 
void setResultSetBufferSize (UInt64 rows)
 
UInt64 getResultSetBufferSize ()
 
void dontGetColumnInfo ()
 
void getColumnInfo ()
 
void mixedCaseColumnNames ()
 
void upperCaseColumnNames ()
 
void lowerCaseColumnNames ()
 
void cacheToFile (String filename)
 
void setCacheTtl (UInt32 ttl)
 
String getCacheFileName ()
 
void cacheOff ()
 
Boolean getDatabaseList (String wild)
 
Boolean getTableList (String wild)
 
Boolean getColumnList (String table, String wild)
 
Boolean sendQuery (String query)
 
Boolean sendQuery (String query, UInt32 length)
 
Boolean sendFileQuery (String path, String filename)
 
void prepareQuery (String query)
 
void prepareQuery (String query, UInt32 length)
 
void prepareFileQuery (String path, String filename)
 
void substitution (String variable, String val)
 
void substitution (String variable, Int64 val)
 
void substitution (String variable, Double val, UInt32 precision, UInt32 scale)
 
void substitutions (String[] variables, String[] vals)
 
void substitution (String[] variables, Int64[] vals)
 
void substitution (String[] variables, Double[] vals, UInt32[] precisions, UInt32[] scales)
 
void inputBind (String variable, String val)
 
void inputBind (String variable, String val, UInt32 vallength)
 
void inputBind (String variable, Int64 val)
 
void inputBind (String variable, Double val, UInt32 precision, UInt32 scale)
 
void inputBind (String[] variables, String[] vals)
 
void inputBind (String[] variables, Int64[] vals)
 
void inputBinds (String[] variables, Double[] vals, UInt32[] precisions, UInt32[] scales)
 
void inputBind (String variable, Int16 year, Int16 month, Int16 day, Int16 hour, Int16 minute, Int16 second, Int32 microsecond, String tz)
 
void inputBindBlob (String variable, Byte[] val, UInt32 size)
 
void inputBindClob (String variable, String val, UInt32 size)
 
void defineOutputBindString (String variable, UInt32 length)
 
void defineOutputBindInteger (String variable)
 
void defineOutputBindDouble (String variable)
 
void defineOutputBindDate (String variable)
 
void defineOutputBindBlob (String variable)
 
void defineOutputBindClob (String variable)
 
void defineOutputBindCursor (String variable)
 
void clearBinds ()
 
UInt16 countBindVariables ()
 
void validateBinds ()
 
Boolean validBind (String variable)
 
Boolean executeQuery ()
 
Boolean fetchFromBindCursor ()
 
String getOutputBindString (String variable)
 
Int64 getOutputBindInteger (String variable)
 
double getOutputBindDouble (String variable)
 
Boolean getOutputBindDate (String variable, out Int16 year, out Int16 month, out Int16 day, out Int16 hour, out Int16 minute, out Int16 second, out Int32 microsecond, out String tz)
 
Byte[] getOutputBindBlob (String variable)
 
String getOutputBindClob (String variable)
 
UInt32 getOutputBindLength (String variable)
 
SQLRCursor getOutputBindCursor (String variable)
 
Boolean openCachedResultSet (String filename)
 
UInt32 colCount ()
 
UInt64 rowCount ()
 
UInt64 totalRows ()
 
UInt64 affectedRows ()
 
UInt64 firstRowIndex ()
 
Boolean endOfResultSet ()
 
String errorMessage ()
 
Int64 errorNumber ()
 
void getNullsAsEmptyStrings ()
 
void getNullsAsNulls ()
 
String getField (UInt64 row, UInt32 col)
 
String getField (UInt64 row, String col)
 
Int64 getFieldAsInteger (UInt64 row, UInt32 col)
 
Int64 getFieldAsInteger (UInt64 row, String col)
 
Double getFieldAsDouble (UInt64 row, UInt32 col)
 
Double getFieldAsDouble (UInt64 row, String col)
 
Byte[] getFieldAsByteArray (UInt64 row, UInt32 col)
 
Byte[] getFieldAsByteArray (UInt64 row, String col)
 
UInt32 getFieldLength (UInt64 row, UInt32 col)
 
UInt32 getFieldLength (UInt64 row, String col)
 
String[] getRow (UInt64 row)
 
UInt32[] getRowLengths (UInt64 row)
 
String getColumnName (UInt32 col)
 
String getColumnType (UInt32 col)
 
String getColumnType (String col)
 
UInt32 getColumnLength (UInt32 col)
 
UInt32 getColumnLength (String col)
 
UInt32 getColumnPrecision (UInt32 col)
 
UInt32 getColumnPrecision (String col)
 
UInt32 getColumnScale (UInt32 col)
 
UInt32 getColumnScale (String col)
 
Boolean getColumnIsNullable (UInt32 col)
 
Boolean getColumnIsNullable (String col)
 
Boolean getColumnIsPrimaryKey (UInt32 col)
 
Boolean getColumnIsPrimaryKey (String col)
 
Boolean getColumnIsUnique (UInt32 col)
 
Boolean getColumnIsUnique (String col)
 
Boolean getColumnIsPartOfKey (UInt32 col)
 
Boolean getColumnIsPartOfKey (String col)
 
Boolean getColumnIsUnsigned (UInt32 col)
 
Boolean getColumnIsUnsigned (String col)
 
Boolean getColumnIsZeroFilled (UInt32 col)
 
Boolean getColumnIsZeroFilled (String col)
 
Boolean getColumnIsBinary (UInt32 col)
 
Boolean getColumnIsBinary (String col)
 
Boolean getColumnIsAutoIncrement (UInt32 col)
 
Boolean getColumnIsAutoIncrement (String col)
 
UInt32 getLongest (UInt32 col)
 
UInt32 getLongest (String col)
 
void suspendResultSet ()
 
UInt16 getResultSetId ()
 
Boolean resumeResultSet (UInt16 id)
 
Boolean resumeCachedResultSet (UInt16 id, String filename)
 
void closeResultSet ()
 

Protected Member Functions

virtual void Dispose (Boolean disposing)
 

Constructor & Destructor Documentation

SQLRClient.SQLRCursor.SQLRCursor ( SQLRConnection  conn)

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

Member Function Documentation

UInt64 SQLRClient.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. -1 is returned by databases which don't support this option.

void SQLRClient.SQLRCursor.cacheOff ( )

Sets query caching off.

void SQLRClient.SQLRCursor.cacheToFile ( String  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 sqlrcur_cacheToFile() is called, the result sets of all future queries will be cached to that file until another call to sqlrcur_cacheToFile() changes which file to cache to or a call to sqlrcur_cacheOff() turns off caching.

void SQLRClient.SQLRCursor.clearBinds ( )

Clears all bind variables.

void SQLRClient.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.

UInt32 SQLRClient.SQLRCursor.colCount ( )

Returns the number of columns in the current result set.

UInt16 SQLRClient.SQLRCursor.countBindVariables ( )

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

void SQLRClient.SQLRCursor.defineOutputBindBlob ( String  variable)

Defines a binary lob output bind variable

void SQLRClient.SQLRCursor.defineOutputBindClob ( String  variable)

Defines a character lob output bind variable

void SQLRClient.SQLRCursor.defineOutputBindCursor ( String  variable)

Defines a cursor output bind variable

void SQLRClient.SQLRCursor.defineOutputBindDate ( String  variable)

Defines an date output bind variable.

void SQLRClient.SQLRCursor.defineOutputBindDouble ( String  variable)

Defines an decimal output bind variable.

void SQLRClient.SQLRCursor.defineOutputBindInteger ( String  variable)

Defines an integer output bind variable.

void SQLRClient.SQLRCursor.defineOutputBindString ( String  variable,
UInt32  length 
)

Defines a String output bind variable. "length" Bytes will be reserved to store the value.

void SQLRClient.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 function to improve performance.

Boolean SQLRClient.SQLRCursor.endOfResultSet ( )

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

String SQLRClient.SQLRCursor.errorMessage ( )

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

Int64 SQLRClient.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.

Boolean SQLRClient.SQLRCursor.executeQuery ( )

Execute the query that was previously prepared and bound.

Boolean SQLRClient.SQLRCursor.fetchFromBindCursor ( )

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

UInt64 SQLRClient.SQLRCursor.firstRowIndex ( )

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

String SQLRClient.SQLRCursor.getCacheFileName ( )

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

void SQLRClient.SQLRCursor.getColumnInfo ( )

Tells the server to send column info.

Boolean SQLRClient.SQLRCursor.getColumnIsAutoIncrement ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsAutoIncrement ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsBinary ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsBinary ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsNullable ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsNullable ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsPartOfKey ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsPartOfKey ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsPrimaryKey ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsPrimaryKey ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsUnique ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsUnique ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsUnsigned ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsUnsigned ( String  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsZeroFilled ( UInt32  col)

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

Boolean SQLRClient.SQLRCursor.getColumnIsZeroFilled ( String  col)

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

UInt32 SQLRClient.SQLRCursor.getColumnLength ( UInt32  col)

Returns the length of the specified column.

UInt32 SQLRClient.SQLRCursor.getColumnLength ( String  col)

Returns the length of the specified column.

Boolean SQLRClient.SQLRCursor.getColumnList ( String  table,
String  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.

String SQLRClient.SQLRCursor.getColumnName ( UInt32  col)

Returns the name of the specified column.

UInt32 SQLRClient.SQLRCursor.getColumnPrecision ( UInt32  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.

UInt32 SQLRClient.SQLRCursor.getColumnPrecision ( String  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.

UInt32 SQLRClient.SQLRCursor.getColumnScale ( UInt32  col)

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

UInt32 SQLRClient.SQLRCursor.getColumnScale ( String  col)

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

String SQLRClient.SQLRCursor.getColumnType ( UInt32  col)

Returns the type of the specified column.

String SQLRClient.SQLRCursor.getColumnType ( String  col)

Returns the type of the specified column.

Boolean SQLRClient.SQLRCursor.getDatabaseList ( String  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.

String SQLRClient.SQLRCursor.getField ( UInt64  row,
UInt32  col 
)

Returns the specified field as a string.

String SQLRClient.SQLRCursor.getField ( UInt64  row,
String  col 
)

Returns the specified field as a string.

Byte [] SQLRClient.SQLRCursor.getFieldAsByteArray ( UInt64  row,
UInt32  col 
)

Returns the specified field as a string.

Byte [] SQLRClient.SQLRCursor.getFieldAsByteArray ( UInt64  row,
String  col 
)

Returns the specified field as a string.

Double SQLRClient.SQLRCursor.getFieldAsDouble ( UInt64  row,
UInt32  col 
)

Returns the specified field as an decimal.

Double SQLRClient.SQLRCursor.getFieldAsDouble ( UInt64  row,
String  col 
)

Returns the specified field as an decimal.

Int64 SQLRClient.SQLRCursor.getFieldAsInteger ( UInt64  row,
UInt32  col 
)

Returns the specified field as an integer.

Int64 SQLRClient.SQLRCursor.getFieldAsInteger ( UInt64  row,
String  col 
)

Returns the specified field as an integer.

UInt32 SQLRClient.SQLRCursor.getFieldLength ( UInt64  row,
UInt32  col 
)

Returns the length of the specified row and column.

UInt32 SQLRClient.SQLRCursor.getFieldLength ( UInt64  row,
String  col 
)

Returns the length of the specified row and column.

UInt32 SQLRClient.SQLRCursor.getLongest ( UInt32  col)

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

UInt32 SQLRClient.SQLRCursor.getLongest ( String  col)

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

void SQLRClient.SQLRCursor.getNullsAsEmptyStrings ( )

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

void SQLRClient.SQLRCursor.getNullsAsNulls ( )

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

Byte [] SQLRClient.SQLRCursor.getOutputBindBlob ( String  variable)

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

String SQLRClient.SQLRCursor.getOutputBindClob ( String  variable)

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

SQLRCursor SQLRClient.SQLRCursor.getOutputBindCursor ( String  variable)

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

Boolean SQLRClient.SQLRCursor.getOutputBindDate ( String  variable,
out Int16  year,
out Int16  month,
out Int16  day,
out Int16  hour,
out Int16  minute,
out Int16  second,
out Int32  microsecond,
out String  tz 
)

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

double SQLRClient.SQLRCursor.getOutputBindDouble ( String  variable)

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

Int64 SQLRClient.SQLRCursor.getOutputBindInteger ( String  variable)

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

UInt32 SQLRClient.SQLRCursor.getOutputBindLength ( String  variable)

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

String SQLRClient.SQLRCursor.getOutputBindString ( String  variable)

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

UInt64 SQLRClient.SQLRCursor.getResultSetBufferSize ( )

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

UInt16 SQLRClient.SQLRCursor.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().

String [] SQLRClient.SQLRCursor.getRow ( UInt64  row)

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

UInt32 [] SQLRClient.SQLRCursor.getRowLengths ( UInt64  row)

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

Boolean SQLRClient.SQLRCursor.getTableList ( String  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.

void SQLRClient.SQLRCursor.inputBind ( String  variable,
String  val 
)

Defines a String input bind variable.

void SQLRClient.SQLRCursor.inputBind ( String  variable,
String  val,
UInt32  vallength 
)

Defines a String input bind variable.

void SQLRClient.SQLRCursor.inputBind ( String  variable,
Int64  val 
)

Defines a integer input bind variable.

void SQLRClient.SQLRCursor.inputBind ( String  variable,
Double  val,
UInt32  precision,
UInt32  scale 
)

Defines a decimal input bind variable. (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.)

void SQLRClient.SQLRCursor.inputBind ( String[]  variables,
String[]  vals 
)

Defines an array of String input bind variables.

void SQLRClient.SQLRCursor.inputBind ( String[]  variables,
Int64[]  vals 
)

Defines an array of integer input bind variables.

void SQLRClient.SQLRCursor.inputBind ( String  variable,
Int16  year,
Int16  month,
Int16  day,
Int16  hour,
Int16  minute,
Int16  second,
Int32  microsecond,
String  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".

void SQLRClient.SQLRCursor.inputBindBlob ( String  variable,
Byte[]  val,
UInt32  size 
)

Defines a binary lob input bind variable.

void SQLRClient.SQLRCursor.inputBindClob ( String  variable,
String  val,
UInt32  size 
)

Defines a character lob input bind variable.

void SQLRClient.SQLRCursor.inputBinds ( String[]  variables,
Double[]  vals,
UInt32[]  precisions,
UInt32[]  scales 
)

Defines an array of decimal input bind variables. (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.)

void SQLRClient.SQLRCursor.lowerCaseColumnNames ( )

Columns names are converted to lower case.

void SQLRClient.SQLRCursor.mixedCaseColumnNames ( )

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

Boolean SQLRClient.SQLRCursor.openCachedResultSet ( String  filename)

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

void SQLRClient.SQLRCursor.prepareFileQuery ( String  path,
String  filename 
)

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

void SQLRClient.SQLRCursor.prepareQuery ( String  query)

Prepare to execute "query".

void SQLRClient.SQLRCursor.prepareQuery ( String  query,
UInt32  length 
)

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

Boolean SQLRClient.SQLRCursor.resumeCachedResultSet ( UInt16  id,
String  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.

Boolean SQLRClient.SQLRCursor.resumeResultSet ( UInt16  id)

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

UInt64 SQLRClient.SQLRCursor.rowCount ( )

Returns the number of rows in the current result set.

Boolean SQLRClient.SQLRCursor.sendFileQuery ( String  path,
String  filename 
)

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

Boolean SQLRClient.SQLRCursor.sendQuery ( String  query)

Sends "query" directly and gets a result set.

Boolean SQLRClient.SQLRCursor.sendQuery ( String  query,
UInt32  length 
)

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

void SQLRClient.SQLRCursor.setCacheTtl ( UInt32  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.

void SQLRClient.SQLRCursor.setResultSetBufferSize ( UInt64  rows)

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

void SQLRClient.SQLRCursor.substitution ( String  variable,
String  val 
)

Defines a String substitution variable.

void SQLRClient.SQLRCursor.substitution ( String  variable,
Int64  val 
)

Defines a integer substitution variable.

void SQLRClient.SQLRCursor.substitution ( String  variable,
Double  val,
UInt32  precision,
UInt32  scale 
)

Defines a decimal substitution variable.

void SQLRClient.SQLRCursor.substitution ( String[]  variables,
Int64[]  vals 
)

Defines an array of integer substitution variable.

void SQLRClient.SQLRCursor.substitution ( String[]  variables,
Double[]  vals,
UInt32[]  precisions,
UInt32[]  scales 
)

Defines an array of decimal substitution variable.

void SQLRClient.SQLRCursor.substitutions ( String[]  variables,
String[]  vals 
)

Defines an array of String substitution variable.

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

UInt64 SQLRClient.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. -1 is returned by databases which don't support this option.

void SQLRClient.SQLRCursor.upperCaseColumnNames ( )

Columns names are converted to upper case.

void SQLRClient.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 function

Boolean SQLRClient.SQLRCursor.validBind ( String  variable)

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