Changes

Jump to navigation Jump to search
721 bytes added ,  12:56, 23 November 2017
no edit summary
|-
| '''Errors'''
|{{Error|error|#Errors}} an SQL exception occurs, e.g. missing JDBC driver or not existing relationoccurred when connecting to the database.
|-
| '''Examples'''
==sql:execute==
{{Mark|Updated with Version 9.0}}: Return update count for updating statements. {{Code|$options}} argument added.
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|sql:execute|$id as xs:anyURI, $statement as xs:string|item()*}}<br/>{{Func|sql:execute|$id as xs:anyURI, $statement as xs:string, $options as map(*)|item()*}}
|-
| '''Summary'''
* If an update statement was executed, the number of updated rows will be returned as integer.
* Otherwise, an XML representation of all results will be returned.
With {{Code|$options}}, the following parameter can be set:
* {{Code|timeout}}: query execution will be interrupted after the specified number of seconds.
|-
| '''Errors'''
|{{Error|error|#Errors}} an error occurred while executing SQL exception occurs, e.g. not existing relation is retrieved.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/>{{Error|timeout|#Errors}} query execution exceeded timeout.<br/ >
|}
|-
| width='120' | '''Signatures'''
|{{Func|sql:execute-prepared|$id as xs:anyURI, $params as element(sql:parameters)|item()*}}<br/>{{Func|sql:execute-prepared|$id as xs:anyURI, $params as element(sql:parameters), $options as map(*)|item()*}}
|-
| '''Summary'''
| This function executes a prepared statement:* with the specified {{Code|$id}}. The output format is identical to [[#sql:execute|sql:execute]].* The parameter {{Code|$id}} refers to the prepared statement.* The optional parameter {{Code|$params}} is an element {{Code|<sql:parameters/>}} representing the parameters for a prepared statement along with their types and values. The following schema shall be used:<br/ >
<pre class="brush:xquery">
element sql:parameters {
}?
</pre>
With {{Code|$options}}, the following parameter can be set:
* {{Code|timeout}}: query execution will be interrupted after the specified number of seconds.
|-
| '''Errors'''
|{{Error|attribute|#Errors}} an attribute different from {{Code|type}} and {{Code|null}} is set for a {{Code|<sql:parameter/>}} element.<br/ >{{Error|error|#Errors}} an error occurred while executing SQL exception occurs, e.g. not existing relation is retrieved.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/ >{{Error|parameters|#Errors}} wrong number of {{Code|<sql:parameter/>}} elements, or parameter type is not specified.<br/>{{Error|timeout|#Errors}} query execution exceeded timeout.<br/>{{Error|type|#Errors}} the value of a parameter cannot be converted to the specified format.
|}
|-
| '''Errors'''
|{{Error|error|#Errors}} an error occurred while executing SQL exception occurs.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/ >
|}
|-
| '''Errors'''
|{{Error|error|#Errors}} an error occurred while executing SQL exception occurs.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/ >
|}
|-
| '''Errors'''
|{{Error|error|#Errors}} an error occurred while executing SQL exception occurs.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/ >
|}
|-
| '''Errors'''
|{{Error|error|#Errors}} an error occurred while executing SQL exception occurs.<br/ >{{Error|id|#Errors}} the specified connection does not exist.<br/ >
|}
|{{Code|parameters}}
|Wrong number of {{Code|&lt;sql:parameter/&gt;}} elements, or parameter type is not specified.
|-
|{{Code|timeout}}
|Query execution exceeded timeout.
|-
|{{Code|type}}
;Version 9.0
* Updated: [[#sql:execute|sql:execute]], [[#sql:execute-prepared|sql:execute-prepared]]: Return update count for updating statements. {{Code|$options}} argument added.
* Updated: Connection ids are URIs now.
* Updated: error codes updated; errors now use the module namespace
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu