Changes

Jump to navigation Jump to search
600 bytes added ,  19:07, 16 May 2017
no edit summary
==sql:execute==
 
{{Mark|Updated with Version 8.7}}: Return update count for updating statements.
Once a connection is established, the returned connection handle can be used to execute queries on the database. Our SQL module supports both direct queries and prepared statements.
|-
| width='120' | '''Signatures'''
|{{Func|sql:execute|$connection as xs:integer, $query as xs:string|elementitem()*}}
|-
| '''Summary'''
| This function executes a query or update statement. The parameter {{Code|$connection}} specifies a connection handle. The parameter {{Code|$query}} is a string representing an SQL statement. The returned result depends on the kind of statement:* If the result is updating, the number of updated rows will be returned as integer.* Otherwise, an XML representation of all results will be returned.
|-
| '''Errors'''
==sql:execute-prepared==
 
{{Mark|Updated with Version 8.7}}: Return update count for updating statements.
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|sql:execute-prepared|$id as xs:integer, $params as element(sql:parameters)|elementitem()*}}
|-
| '''Summary'''
| This function executes a prepared statement:* The output format is identical to [[#sql:execute|sql:execute]]. * The parameter {{Code|$id}} specifies a prepared statement handle. * 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:xml">
element sql:parameters {
element sql:parameter { attribute type { "int"|"string"|"boolean"|"date"|"double"|"float"|"short"|"time"|"timestamp"|"sqlxml" }, attribute null { "true"|"false" }?, text text }+ }?
</pre>
|-
==Prepared Statements==
 
A prepared select statement can be executed in the following way:
=Changelog=
 
;Version 8.7
* Updated: [[#sql:execute|sql:execute]], [[#sql:execute-prepared|sql:execute-prepared]]: Return update count for updating statements.
;Version 7.5
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu