2013-12-04T01:28:38.942159+01:001.0http://www.zorba-xquery.com/modules/jdbcjdbc This module contains functions to connect to any JDBC datasource
using jvm-util module to handle Java interaction.
Rodolfo OchoaDB Drivers/JDBCxquery3.0utf-8jdbc:NOT-SUPPORTED This variable represents the NOT-SUPPORTED level for Isolation Levels in $options for 2.2 connect function.
jdbc:READ-COMMITTED This variable represents the READ-COMMITTED level for Isolation Levels in $options for 2.2 connect function.
jdbc:READ-UNCOMMITTED This variable represents the READ-UNCOMMITTED level for Isolation Levels in $options for 2.2 connect function.
jdbc:REPEATABLE-READ This variable represents the REPEATABLE-READ level for Isolation Levels in $options for 2.2 connect function.
jdbc:SERIALIZABLE This variable represents the SERIALIZABLE level for Isolation Levels in $options for 2.2 connect function.
Opens a connection to a database.
Returns a URI identifying the connection that has been opened. The implementing code determines from the $connection-config either explicitly (interpreting the driver attribute) or implicitly (using the type attribute) which driver it has to load.
$connection-config json object that has the host and user informations.Return an identifier that represents the connection to the server. Connection coonfiguration example: { "url" : "jdbc:mysql://localhost/", "user" : "root", "password" : "" }SQL28000 Authentication failed.SQL08001 Connection error.SQL40003 Isolation level not supported.SQL001 Descriptive error, see attached message.jdbc:connectdeclare %an:sequential function jdbc:connect($connection-config as object()) as xs:anyURI externalconnection-configobject()xs:anyURI Opens a connection to a database with specified options.
Returns a URI identifying the connection that has been opened. The implementing code determines from the $connection-config either explicitly (interpreting the driver attribute) or implicitly (using the type attribute) which driver it has to load.
$connection-config json object that has the host and user informations.$options json object that specifies the connection options.Return an identifier that represents the connection to the server. Connection options example: { "autocommit" : false, "readonly"? : true, "isolation-level"? : $jdbc:READ-COMMITTED }SQL28000 Authentication failed.SQL08001 Connection error.SQL40003 Isolation level not supported.SQL001 Descriptive error, see error in attached message.jdbc:connectdeclare %an:sequential function jdbc:connect($connection-config as object(), $options as object()?) as xs:anyURI externalconnection-configobject()optionsobject()xs:anyURI Verify if a connection is still active.
$connection-id The identifier to the connection to be verify.Returns true if connected.SQL08003 Connection doesn't existSQL001 Descriptive error, see error in attached messagejdbc:is-connecteddeclare function jdbc:is-connected($connection-id as xs:anyURI) as xs:boolean externalconnection-idxs:anyURIxs:boolean Returns a set with options for a specified connection.
$connection-id The identifier to the connection to be verify.Returns and object with the connection options. The returned options are equal to the options specified in function jdbc:connect. Consequently, the options are specified as follows: { "autocommit" : xs:boolean, "readonly" : xs:boolean, "isolation-level" : xs:string }SQL08003 Connection doesn't existSQL08000 Connection is closedSQL001 Descriptive error, see error in attached messagejdbc:connection-optionsdeclare function jdbc:connection-options($connection-id as xs:anyURI) as object() externalconnection-idxs:anyURIobject() Commit current transaction from an active connection.
$connection-id The identifier to the connection to be commited.This function returns an empty-sequence()SQL08003 Connection doesn't existSQL08000 Connection is closedSQL001 Descriptive error, see error in attached messagejdbc:commitdeclare %an:sequential function jdbc:commit($connection-id as xs:anyURI) as empty-sequence() externalconnection-idxs:anyURIempty-sequence() Rollback the current transaction of a connection.
$connection-id The identifier to the connection to be rollbacked.This function returns an empty-sequence()SQL08003 Connection doesn't existSQL08000 Connection is closedSQL001 Descriptive error, see error in attached messagejdbc:rollbackdeclare %an:sequential function jdbc:rollback($connection-id as xs:anyURI) as empty-sequence() externalconnection-idxs:anyURIempty-sequence() Executes any kind of SQL statement.
$connection-id The identifier to an active connection.$sql The query string to be executed.Return an identifier that represents a DataSet.SQL08003 Connection doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:executedeclare %an:sequential function jdbc:execute($connection-id as xs:anyURI, $sql as xs:string) as xs:anyURI externalconnection-idxs:anyURIsqlxs:stringxs:anyURI Executes non-updating SQL statements.
$connection-id The identifier to an active connection.$sql The query string to be executed.Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.SQL08003 Connection doesn't exist.SQL08000 Connection is closed.SQL005 The statement is Updating type.SQL001 Descriptive error, see error in attached message.jdbc:execute-querydeclare function jdbc:execute-query($connection-id as xs:anyURI, $sql as xs:string) as object()* externalconnection-idxs:anyURIsqlxs:stringobject()* Executes updating SQL statements.
$connection-id The identifier to an active connection.$sql The query string to be executed.Returns an xs:integer with the number of affected rows.SQL08003 Connection doesn't exist.SQL08000 Connection is closed.SQL005 The statement is Read-only type.SQL001 Descriptive error, see error in attached message.jdbc:execute-updatedeclare function jdbc:execute-update($connection-id as xs:anyURI, $sql as xs:string) as xs:integer externalconnection-idxs:anyURIsqlxs:stringxs:integer Creates a prepared statement for multiple executions with diferent values.
$connection-id The identifier to an active connection.$sql The query string to be executed.Return an identifier that represents the prepared statement. Example: jsql:prepare-statement($connection, "SELECT * FROM users WHERE id=? AND age>?")SQL08003 Connection doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:prepare-statementdeclare %an:sequential function jdbc:prepare-statement($connection-id as xs:anyURI, $sql as xs:string) as xs:anyURI externalconnection-idxs:anyURIsqlxs:stringxs:anyURI Set the value of the designated parameter with the given value, this function will assign only numeric values.
$prepared-statement The identifier to a prepared statement.$parameter-index The index from the parameter to be set.$value The value to be set.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL007 Parameter casting error.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:set-numericdeclare %an:sequential function jdbc:set-numeric($prepared-statement as xs:anyURI, $parameter-index as xs:decimal, $value as xs:anyAtomicType) as empty-sequence() externalprepared-statementxs:anyURIparameter-indexxs:decimalvaluexs:anyAtomicTypeempty-sequence() Set the value of the designated parameter with the given value, this function will assign only string values.
$prepared-statement The identifier to a prepared statement.$parameter-index The index from the parameter to be set.$value The value to be set.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL007 Parameter casting error.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:set-stringdeclare %an:sequential function jdbc:set-string($prepared-statement as xs:anyURI, $parameter-index as xs:integer, $value as xs:string) as empty-sequence() externalprepared-statementxs:anyURIparameter-indexxs:integervaluexs:stringempty-sequence() Set the value of the designated parameter with the given value, this function will assign only boolean values.
$prepared-statement The identifier to a prepared statement.$parameter-index The index from the parameter to be set.$value The value to be set.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL007 Parameter casting error.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:set-booleandeclare %an:sequential function jdbc:set-boolean($prepared-statement as xs:anyURI, $parameter-index as xs:integer, $value as xs:boolean) as empty-sequence() externalprepared-statementxs:anyURIparameter-indexxs:integervaluexs:booleanempty-sequence() Set the value of the designated parameter with the given value, this function will assign only null values if possible.
$prepared-statement The identifier to a prepared statement.$parameter-index The index from the parameter to be set.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL007 Parameter casting error.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:set-nulldeclare %an:sequential function jdbc:set-null($prepared-statement as xs:anyURI, $parameter-index as xs:integer) as empty-sequence() externalprepared-statementxs:anyURIparameter-indexxs:integerempty-sequence() Set the value of the designated parameter with the given value,
this function will assign any value you send
and it will try to cast to the correct type.
$prepared-statement The identifier to a prepared statement.$parameter-index The index from the parameter to be set.$value The value to be set.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL007 Parameter casting error.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:set-valuedeclare %an:sequential function jdbc:set-value($prepared-statement as xs:anyURI, $parameter-index as xs:decimal, $value as xs:anyAtomicType) as empty-sequence() externalprepared-statementxs:anyURIparameter-indexxs:decimalvaluexs:anyAtomicTypeempty-sequence() Clears the current parameter values immediately.
$prepared-statement The identifier to a prepared statement.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:clear-paramsdeclare %an:sequential function jdbc:clear-params($prepared-statement as xs:anyURI) as empty-sequence() externalprepared-statementxs:anyURIempty-sequence() Retrieves the number, types and properties of the prepared statement parameters.
$prepared-statement The identifier to a prepared statement.This function returns the parameters metadata associated with a prepared statement. In other words, it returns information about the column name associated with the parameter, the type, etc. The metadata node returned by this function is defined as follows: { columns: [{ "name": xs:string, "type": xs:string }] }SQL003 Prepared statement doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:parameter-metadatadeclare function jdbc:parameter-metadata($prepared-statement as xs:anyURI) as object() externalprepared-statementxs:anyURIobject() Executes SQL statements prepared with 5.1 jsql:prepare-statement with values set
and returns an identifier to a Dataset.
$prepared-statement The identifier to a prepared statement.Return an identifier that represents a DataSet.SQL003 Prepared statement doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:execute-prepareddeclare %an:sequential function jdbc:execute-prepared($prepared-statement as xs:anyURI) as xs:anyURI externalprepared-statementxs:anyURIxs:anyURI Executes a non-updating SQL statement prepared with 5.1 jsql:prepare-statement.
$prepared-statement The identifier to a prepared statement.Return an object with the result data rows from the query processed with the parameter values provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.SQL003 Prepared statement doesn't exist.SQL005 The prepared statement is an updating query.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:execute-query-prepareddeclare function jdbc:execute-query-prepared($prepared-statement as xs:anyURI) as object()* externalprepared-statementxs:anyURIobject()* Executes an updating SQL statement prepared with 5.1 jsql:prepare-statement.
$prepared-statement The identifier to a prepared statement.Returns an xs:integer with the number of affected rows.SQL003 Prepared statement doesn't exist.SQL006 The prepared statement is a non-updating query.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:execute-update-prepareddeclare function jdbc:execute-update-prepared($prepared-statement as xs:anyURI) as xs:integer externalprepared-statementxs:anyURIxs:integer Closes and frees from memory any prepared SQL statement created with jdbc:prepare-statement
$prepared-statement The identifier to a prepared statement.This function returns an empty-sequence()SQL003 Prepared statement doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:close-prepareddeclare %an:sequential function jdbc:close-prepared($prepared-statement as xs:anyURI) as empty-sequence() externalprepared-statementxs:anyURIempty-sequence() This function returns a sequence of objects representing the rows of data from a non-updating query.
$dataset-id The identifier to a DataSet.Return an object with the result data rows from the DataSet provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.SQL008 DataSet doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:result-setdeclare function jdbc:result-set($dataset-id as xs:anyURI) as object()* externaldataset-idxs:anyURIobject()* Return the metadata of the result of a particular DataSet.
$dataset-id The identifier to a DataSet.This function returns the metadata associated with an executed DataSet. More in detail, it returns information about column names, types, and whether a column can contain a null value. The metadata information can only be returned for DataSets that have been executed explicitly using the jsql:execute function. The metadata node returned by this function is defined as follows: { "columns": [ { "name": xs:string, "type": xs:string, "autoincrement"? = xs:boolean, "nillable"? = xs:boolean } * ] }SQL008 DataSet doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:metadatadeclare function jdbc:metadata($dataset-id as xs:anyURI) as object() externaldataset-idxs:anyURIobject() Return the number of affected rows of a particular DataSet.
$dataset-id The identifier to a DataSet.Returns an xs:integer with the number of affected rows.SQL008 DataSet doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:affected-rowsdeclare function jdbc:affected-rows($dataset-id as xs:anyURI) as xs:integer externaldataset-idxs:anyURIxs:integer Closes and free resources from a particular DataSet.
$dataset-id The identifier to a DataSet.This function returns an empty-sequence()SQL008 DataSet doesn't exist.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:close-datasetdeclare %an:sequential function jdbc:close-dataset($dataset-id as xs:anyURI) as empty-sequence() externaldataset-idxs:anyURIempty-sequence() Return the list of tables from a connection
$connection-id The identifier to a connection.$catalog A filter of the catalog name of the tables. Send empty-sequence for all tables.$schema A filter of the schema name of the tables. Send empty-sequence for all tables.$table A filter of the name of the tables. Send empty-sequence for all tables.Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:tablesdeclare %an:sequential function jdbc:tables($connection-id as xs:anyURI, $catalog as xs:string?, $schema as xs:string?, $table as xs:string?) as object()* externalconnection-idxs:anyURIcatalogxs:stringschemaxs:stringtablexs:stringobject()* Return the list of tables from a connection
$connection-id The identifier to a connection.Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.SQL08000 Connection is closed.SQL001 Descriptive error, see error in attached message.jdbc:tablesdeclare %an:sequential function jdbc:tables($connection-id as xs:anyURI) as object()*connection-idxs:anyURIobject()*http://www.zorba-xquery.com/modules/jdbctables