11xquery version "3.1" ;
22
33(:~
4- : A module for performing SQL queries against MySQL Databases, returning XML representations of the result sets.
4+ : A module for performing SQL queries against mssql Databases, returning XML representations of the result sets.
55 :)
6- module namespace mysql = "https://exist-db.org/exist-db/ns/app/mysql " ;
6+ module namespace mssql = "https://exist-db.org/exist-db/ns/app/mssql " ;
77import module namespace sql="http://exist-db.org/xquery/sql" ;
88
9- declare variable $mysql :classpath := "com.mysql.cj .jdbc.Driver " ;
9+ declare variable $mssql :classpath := "com.microsoft.sqlserver .jdbc.SQLServerDriver " ;
1010
1111(:~
12- : Opens a connection to a MySQL Database
12+ : Opens a connection to a mssql Database
1313 : @param $url The JDBC connection URL
1414 : @return an xs:long representing the connection handle
1515 :)
16- declare function mysql :get-connection ($url as xs:string)
16+ declare function mssql :get-connection ($url as xs:string)
1717as xs:long?
1818{
19- sql:get-connection ($mysql :classpath, $url)
19+ sql:get-connection ($mssql :classpath, $url)
2020};
2121
2222(:~
23- : Opens a connection to a MySQL Database
23+ : Opens a connection to a mssql Database
2424 : @param $url The JDBC connection URL
2525 : @param $properties The JDBC database connection properties in the form <properties><property name="" value=""/></properties>
2626 : @return an xs:long representing the connection handle
2727 :)
28- declare function mysql :get-connection ($url as xs:string, $properties as element ()?)
28+ declare function mssql :get-connection ($url as xs:string, $properties as element ()?)
2929as xs:long?
3030{
31- sql:get-connection ($mysql :classpath, $url, $properties)
31+ sql:get-connection ($mssql :classpath, $url, $properties)
3232};
3333
3434(:~
35- : Opens a connection to a MySQL Database
35+ : Opens a connection to a mssql Database
3636 : @param $url The JDBC connection URL
37- : @param $username The MySQL database username
38- : @param $password The MySQL database password
37+ : @param $username The mssql database username
38+ : @param $password The mssql database password
3939 : @return an xs:long representing the connection handle
4040 :)
41- declare function mysql :get-connection ($url as xs:string, $username as xs:string, $password as xs:string)
41+ declare function mssql :get-connection ($url as xs:string, $username as xs:string, $password as xs:string)
4242as xs:long?
4343{
44- sql:get-connection ($mysql :classpath, $url, $username, $password)
44+ sql:get-connection ($mssql :classpath, $url, $username, $password)
4545};
4646
4747(:~
48- : Prepares a SQL statement against a MySQL db using the connection indicated by the connection handle.
48+ : Prepares a SQL statement against a mssql db using the connection indicated by the connection handle.
4949 : @param $handle The connection handle
5050 : @param $sql-statement The SQL statement
5151 : @return an xs:long representing the statement handle
5252 :)
53- declare function mysql :prepare ($handle as xs:long, $sql-statement as xs:string)
53+ declare function mssql :prepare ($handle as xs:long, $sql-statement as xs:string)
5454as xs:long?
5555{
5656 sql:prepare ($handle, $sql-statement)
5757};
5858
5959(:~
60- : Executes a SQL statement against a MySQL database.
60+ : Executes a SQL statement against a mssql database.
6161 : @param $connection-handle The connection handle
6262 : @param $sql-statement The SQL statement
6363 : @param $make-node-from-column-name
@@ -66,7 +66,7 @@ as xs:long?
6666 : will be replaced by an underscore!)
6767 : @return the results
6868 :)
69- declare function mysql :execute (
69+ declare function mssql :execute (
7070 $connection-handle as xs:long,
7171 $sql-statement as xs:string,
7272 $make-node-from-column-name as xs:boolean
@@ -77,7 +77,7 @@ as element()?
7777};
7878
7979(:~
80- : Executes a prepared SQL statement against a MySQL database.
80+ : Executes a prepared SQL statement against a mssql database.
8181 : @param $connection-handle The connection handle
8282 : @param $statement-handle The prepared statement handle
8383 : @param $parameters Parameters for the prepared statement.
@@ -94,7 +94,7 @@ as element()?
9494 : will be replaced by an underscore!)
9595 : @return the results
9696 :)
97- declare function mysql :execute (
97+ declare function mssql :execute (
9898 $connection-handle as xs:long,
9999 $statement-handle as xs:long,
100100 $parameters as element ()?,
0 commit comments