XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/sql

java:org.exist.xquery.modules.sql.SQLModule

A module for performing SQL queries against Databases, returning XML representations of the result sets.

execute

execute($connection-handle as xs:long, $sql-statement as xs:string, $make-node-from-column-name as xs:boolean) as element()?

Executes a prepared SQL statement against a SQL db.

Parameters:
$connection-handle The connection handle
$sql-statement The SQL statement
$make-node-from-column-name The flag that indicates whether the xml nodes should be formed from the column names (in this mode a space in a Column Name will be replaced by an underscore!)
Returns:
element()? : the results

execute

execute($connection-handle as xs:long, $statement-handle as xs:integer, $parameters as element()?, $make-node-from-column-name as xs:boolean) as element()?

Executes a prepared SQL statement against a SQL db.

Parameters:
$connection-handle The connection handle
$statement-handle The prepared statement handle
$parameters? Parameters for the prepared statement. e.g. <sql:parameters><sql:param sql:type="long">1234</sql:param><sql:param sql:type="varchar"><sql:null/></sql:param></sql:parameters>
$make-node-from-column-name The flag that indicates whether the xml nodes should be formed from the column names (in this mode a space in a Column Name will be replaced by an underscore!)
Returns:
element()? : the results

sql:get-connection

sql:get-connection($driver-classname as xs:string, $url as xs:string) as xs:long?

Opens a connection to a SQL Database

Parameters:
$driver-classname The JDBC driver classname
$url The JDBC connection URL
Returns:
xs:long? : an xs:long representing the connection handle

sql:get-connection

sql:get-connection($driver-classname as xs:string, $url as xs:string, $properties as element()?) as xs:long?

Opens a connection to a SQL Database

Parameters:
$driver-classname The JDBC driver classname
$url The JDBC connection URL
$properties? The JDBC database connection properties in the form <properties><property name="" value=""/></properties>.
Returns:
xs:long? : an xs:long representing the connection handle

sql:get-connection

sql:get-connection($driver-classname as xs:string, $url as xs:string, $username as xs:string, $password as xs:string) as xs:long?

Opens a connection to a SQL Database

Parameters:
$driver-classname The JDBC driver classname
$url The JDBC connection URL
$username The SQL database username
$password The SQL database password
Returns:
xs:long? : an xs:long representing the connection handle

sql:get-jndi-connection

sql:get-jndi-connection($jndi-name as xs:string) as xs:long?

Opens a connection to a SQL Database.

Parameters:
$jndi-name The JNDI name
Returns:
xs:long? : an xs:long representing the connection handle

sql:get-jndi-connection

sql:get-jndi-connection($jndi-name as xs:string, $username as xs:string, $password as xs:string) as xs:long?

Opens a connection to a SQL Database.

Parameters:
$jndi-name The JNDI name
$username The username
$password The password
Returns:
xs:long? : an xs:long representing the connection handle

sql:prepare

sql:prepare($handle as xs:long, $sql-statement as xs:string) as xs:long?

Prepares a SQL statement against a SQL db using the connection indicated by the connection handle.

Parameters:
$handle The connection handle
$sql-statement The SQL statement
Returns:
xs:long? : an xs:long representing the statement handle