zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #26691
[Merge] lp:~zorba-coders/zorba/jdbc_connect-scripting-bug into lp:zorba/jdbc-module
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/jdbc_connect-scripting-bug into lp:zorba/jdbc-module.
Commit message:
fix "[SQL08003] There is no connection to any valid source" bug that occurrs when
not binding a connection to a scripting variable.
Requested reviews:
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/jdbc_connect-scripting-bug/+merge/205686
--
https://code.launchpad.net/~zorba-coders/zorba/jdbc_connect-scripting-bug/+merge/205686
Your team Zorba Coders is subscribed to branch lp:zorba/jdbc-module.
=== modified file 'include/jdbc.h'
--- include/jdbc.h 2013-06-11 20:47:52 +0000
+++ include/jdbc.h 2014-02-11 03:58:32 +0000
@@ -22,7 +22,7 @@
#include "JavaVMSingleton.h"
#include "sqltypes.h"
-#define JDBC_MODULE_NAMESPACE "http://www.zorba-xquery.com/modules/jdbc"
+#define JDBC_MODULE_NAMESPACE "http://zorba.io/modules/jdbc"
#define INSTANCE_MAP_CONNECTIONS "JdbcInstanceMapConnections"
#define INSTANCE_MAP_STATEMENTS "JdbcInstanceMapStatements"
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2012-11-23 00:45:06 +0000
+++ src/CMakeLists.txt 2014-02-11 03:58:32 +0000
@@ -27,7 +27,7 @@
INCLUDE_DIRECTORIES (${JAVA_INCLUDE_PATH})
DECLARE_ZORBA_MODULE (
- URI "http://www.zorba-xquery.com/modules/jdbc"
+ URI "http://zorba.io/modules/jdbc"
VERSION 1.0
FILE "jdbc.xq"
LINK_LIBRARIES "${JAVA_JVM_LIBRARY}" ${zorba_util-jvm_module_LIBRARIES})
=== modified file 'src/jdbc.xq'
--- src/jdbc.xq 2013-08-09 09:37:05 +0000
+++ src/jdbc.xq 2014-02-11 03:58:32 +0000
@@ -1,7 +1,7 @@
-xquery version "3.0";
+jsoniq version "1.0";
(:
- : Copyright 2006-2012 The FLWOR Foundation.
+ : Copyright 2006-2013 The FLWOR Foundation.
:
: Licensed under the Apache License, Version 2.0 (the "License");
: you may not use this file except in compliance with the License.
@@ -17,14 +17,19 @@
:)
(:~
- : This module contains functions to connect to any JDBC datasource
- : using jvm-util module to handle Java interaction.
+ : This module provides functions to communicate to JDBC datasources.
+ : For example, it provides functions to execute queries or updates
+ : using SQL.
+ : <p/>
+ : Results of queries are returned as sequences of JSON objects,
+ : one object per row. Basic SQL types are mapped to JSONiq types.
+ : All other types are mapped to string or base64Binary.
:
: @author Rodolfo Ochoa
: @project DB Drivers/JDBC
:)
-module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+module namespace jdbc = "http://zorba.io/modules/jdbc";
declare namespace err = "http://www.w3.org/2005/xqt-errors";
declare namespace ver = "http://zorba.io/options/versioning";
@@ -32,38 +37,61 @@
declare option ver:module-version "1.0";
(:~
- : This variable represents the NOT-SUPPORTED level for Isolation Levels in $options for 2.2 connect function.
+ : This variable represents the NOT-SUPPORTED level for Isolation Levels
+ : that can be passed as $options parameter to the connect function.
:)
declare variable $jdbc:NOT-SUPPORTED := "NOT-SUPPORTED";
+
(:~
- : This variable represents the READ-COMMITTED level for Isolation Levels in $options for 2.2 connect function.
+ : This variable represents the READ-COMMITTED level for Isolation Levels
+ : that can be passed as $options parameter to the connect function.
:)
declare variable $jdbc:READ-COMMITTED := "READ-COMMITTED";
+
(:~
- : This variable represents the READ-UNCOMMITTED level for Isolation Levels in $options for 2.2 connect function.
+ : This variable represents the READ-UNCOMMITTED level for Isolation Levels
+ : that can be passed as $options parameter to the connect function.
:)
declare variable $jdbc:READ-UNCOMMITTED := "READ-UNCOMMITTED";
+
(:~
- : This variable represents the REPEATABLE-READ level for Isolation Levels in $options for 2.2 connect function.
+ : This variable represents the REPEATABLE-READ level for Isolation Levels
+ : that can be passed as $options parameter to the connect function.
:)
declare variable $jdbc:REPEATABLE-READ := "REPEATABLE-READ";
+
(:~
- : This variable represents the SERIALIZABLE level for Isolation Levels in $options for 2.2 connect function.
+ : This variable represents the SERIALIZABLE level for Isolation Levels
+ : that can be passed as $options parameter to the connect function.
:)
declare variable $jdbc:SERIALIZABLE := "SERIALIZABLE";
-(:
- : 2 CONNECTION HANDLING
- :)
-
(:~
- : 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.
- :
- : @param $connection-config json object that has the host and user informations.
- : @option "url" URL of the server, this option must be specified and should be declared according to JDBC specification.
- : @option "user" username for the server, this is optional.
- : @option "password" password for the server, this is optional.
+ : Opens a connection to a database with specified options.
+ : <p/>
+ : Returns a URI identifying the connection that has been opened. The
+ : JDBC driver to be used is either determined either from the
+ : connection string or the explicit type attribute.
+ : <p/>
+ :
+ : $config:
+ : <ul>
+ : <li>url: JDBC connection information</li>
+ : <li>user: name of the user used to connect</li>
+ : <li>password: password used to conect</li>
+ : </ul>
+ : <p/>
+ :
+ : Connection configuration example:
+ : <pre>
+ : {
+ : "url" : "jdbc:mysql://localhost/",
+ : "user" : "root",
+ : "password" : ""
+ : }</pre>
+ :
+ :
+ : @param $config object containing the connection and user information.
:
: @error SQL28000 Authentication failed.
: @error SQL08001 Connection error.
@@ -71,129 +99,108 @@
: @error SQL001 Descriptive error, see attached message.
:
: @return Return an identifier that represents the connection to the server.
- :
- : Connection coonfiguration example:
- : { "url" : "jdbc:mysql://localhost/",
- : "user" : "root",
- : "password" : "" }
- :
:)
-declare %an:sequential function jdbc:connect(
- $connection-config as object() ) as xs:anyURI external;
+declare %an:nondeterministic function jdbc:connect($config as object)
+ as anyURI external;
(:~
: 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.
- :
- : @param $connection-config json object that has the host and user informations.
- : @option "url" URL of the server, this option must be specified and should be declared according to JDBC specification.
- : @option "user" username for the server, this option is optional.
- : @option "password" password for the server, this option is optional.
- : @param $options json object that specifies the connection options.
- : @option "autocommit" The created connection will have autocommit turned on if the value the attribute is set to "true".
- : @option "readonly" The created connection will be readonly if the value of the attribute is set to "true".
- : @option "isolation-level" The created connection will have the specified transaction isolation level,
- : the following string typed in-scope variables represent the different transaction isolation levels
- : that this attribute can be set to:
- : - $jsql:READ-COMMITTED
- : - $jsql:READ-UNCOMMITTED
- : - $jsql:REPEATABLE-READ
- : - $jsql:SERIALIZABLE
- : if no isolation level is provided by the user the connection will be created with the default
- : isolation level of the database.
- :
+ : <p/>
+ : Returns a URI identifying the connection that has been opened. The
+ : JDBC driver to be used is either determined either from the
+ : connection string or the explicit type attribute.
+ : <p/>
+ :
+ : $config:
+ : <ul>
+ : <li>url: JDBC connection information</li>
+ : <li>user: name of the user used to connect</li>
+ : <li>password: password used to connect</li>
+ : </ul>
+ : <p/>
+ :
+ : $options:
+ : <ul>
+ : <li>autocommit: boolean indicating whether autocommit is turned on or off</li>
+ : <li>readonly: boolean whether the connection is read only or not</li>
+ : <li>isolation-level: specify the isolation level for all transactions on
+ : the connection.</li>
+ : </ul>
+ :
+ : @param $config object containing the connection and user information.
+ : @param $options object that specifies the connection options.
:
: @error SQL28000 Authentication failed.
: @error SQL08001 Connection error.
: @error SQL40003 Isolation level not supported.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return Return an identifier that represents the connection to the server.
- :
- : Connection options example:
- : { "autocommit" : false,
- : "readonly"? : true,
- : "isolation-level"? : $jdbc:READ-COMMITTED }
- :
- :)
-declare %an:sequential function jdbc:connect(
- $connection-config as object(),
- $options as object()?) as xs:anyURI external;
-
-(:~
- : Verify if a connection is still active.
- :
- : @param $connection-id The identifier to the connection to be verify.
- :
- : @error SQL08003 Connection doesn't exist
- : @error SQL001 Descriptive error, see error in attached message
- :
- : @return Returns true if connected.
- :)
-declare function jdbc:is-connected(
- $connection-id as xs:anyURI) as xs:boolean external;
-
-(:~
- : Returns a set with options for a specified connection.
- :
- : @param $connection-id The identifier to the connection to be verify.
- :
- : @error SQL08003 Connection doesn't exist
- : @error SQL08000 Connection is closed
- : @error SQL001 Descriptive error, see error in attached message
- :
- : @return 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 }
- :
- :)
-declare function jdbc:connection-options(
- $connection-id as xs:anyURI) as object() external;
-
-(:
- : 3 TRANSACTIONS
- :)
-
-(:~
- : Commit current transaction from an active connection.
- :
- : @param $connection-id The identifier to the connection to be commited.
- :
- : @error SQL08003 Connection doesn't exist
- : @error SQL08000 Connection is closed
- : @error SQL001 Descriptive error, see error in attached message
- :
- : @return This function returns an empty-sequence()
- :)
-declare %an:sequential function jdbc:commit(
- $connection-id as xs:anyURI) as empty-sequence() external;
-
-(:~
- : Rollback the current transaction of a connection.
- :
- : @param $connection-id The identifier to the connection to be rollbacked.
- :
- : @error SQL08003 Connection doesn't exist
- : @error SQL08000 Connection is closed
- : @error SQL001 Descriptive error, see error in attached message
- :
- : @return This function returns an empty-sequence()
- :)
-declare %an:sequential function jdbc:rollback(
- $connection-id as xs:anyURI) as empty-sequence() external;
-
-
-(:
- : 4 SIMPLE STATEMENTS
- :)
-
-(:~
- : Executes any kind of SQL statement.
- :
- : @param $connection-id The identifier to an active connection.
+ : @return an identifier that represents the connection to the server.
+ :)
+declare %an:nondeterministic function jdbc:connect(
+ $config as object,
+ $options as object?) as anyURI external;
+
+(:~
+ : Verify if a connection identified by the given URI exists
+ : and is active.
+ :
+ : @param $conn The identifier to the connection to be verified.
+ :
+ : @error SQL08003 Connection doesn't exist
+ : @error SQL001 Descriptive error, see error in attached message
+ :
+ : @return true if connected.
+ :)
+declare function jdbc:is-connected($conn as anyURI)
+ as boolean external;
+
+(:~
+ : Return the set of options for the specified connection.
+ :
+ : @param $conn The identifier to the connection.
+ :
+ : @error SQL08003 Connection doesn't exist
+ : @error SQL08000 Connection is closed
+ : @error SQL001 Descriptive error, see error in attached message
+ :
+ : @return object describing the connection options.
+ :)
+declare function jdbc:connection-options($conn as anyURI)
+ as object external;
+
+(:~
+ : Commit the current transaction.
+ :
+ : @param $conn The identifier to the connection to be committed.
+ :
+ : @error SQL08003 Connection doesn't exist
+ : @error SQL08000 Connection is closed
+ : @error SQL001 Descriptive error, see error in attached message
+ :
+ : @return This function returns the empty-sequence.
+ :)
+declare %an:sequential function jdbc:commit($conn as anyURI)
+ as () external;
+
+(:~
+ : Rollback the current transaction.
+ :
+ : @param $conn The identifier to the connection to be rolled back.
+ :
+ : @error SQL08003 Connection doesn't exist
+ : @error SQL08000 Connection is closed
+ : @error SQL001 Descriptive error, see error in attached message
+ :
+ : @return This function returns the empty-sequence.
+ :)
+declare %an:sequential function jdbc:rollback($conn as anyURI)
+ as () external;
+
+(:~
+ : Executes any kind (updating and non-updating) of SQL query.
+ :
+ : @param $conn The identifier to an active connection.
: @param $sql The query string to be executed.
:
: @error SQL08003 Connection doesn't exist.
@@ -203,13 +210,13 @@
: @return Return an identifier that represents a DataSet.
:)
declare %an:sequential function jdbc:execute(
- $connection-id as xs:anyURI,
- $sql as xs:string ) as xs:anyURI external;
+ $conn as anyURI,
+ $sql as string) as anyURI external;
(:~
- : Executes non-updating SQL statements.
+ : Execute a non-updating SQL query.
:
- : @param $connection-id The identifier to an active connection.
+ : @param $conn The identifier to an active connection.
: @param $sql The query string to be executed.
:
: @error SQL08003 Connection doesn't exist.
@@ -217,20 +224,16 @@
: @error SQL005 The statement is Updating type.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return 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.
- :
+ : @return the result of the query each row being an object.
:)
-declare function jdbc:execute-query(
- $connection-id as xs:anyURI,
- $sql as xs:string) as object()* external;
+declare %an:nondeterministic function jdbc:execute-query(
+ $conn as anyURI,
+ $sql as string) as object* external;
(:~
- : Executes updating SQL statements.
+ : Execute an updating SQL query.
:
- : @param $connection-id The identifier to an active connection.
+ : @param $conn The identifier to an active connection.
: @param $sql The query string to be executed.
:
: @error SQL08003 Connection doesn't exist.
@@ -238,21 +241,23 @@
: @error SQL005 The statement is Read-only type.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return Returns an xs:integer with the number of affected rows.
- :)
-declare function jdbc:execute-update(
- $connection-id as xs:anyURI,
- $sql as xs:string) as xs:integer external;
-
-
-(:
- : 5 PREPARED STATEMENTS
- :)
+ : @return the number of affected rows.
+ :)
+declare %an:sequential function jdbc:execute-update(
+ $conn as anyURI,
+ $sql as string) as integer external;
(:~
- : Creates a prepared statement for multiple executions with diferent values.
- :
- : @param $connection-id The identifier to an active connection.
+ : Creates a prepared statement for multiple executions with potentially
+ : different values.
+ : <p/>
+ :
+ : Example:
+ : <pre>
+ : jdbc:prepare-statement($conn, "SELECT * FROM users WHERE id=? AND age>?")
+ : </pre>
+ :
+ : @param $conn The identifier to an active connection.
: @param $sql The query string to be executed.
:
: @error SQL08003 Connection doesn't exist.
@@ -260,16 +265,13 @@
: @error SQL001 Descriptive error, see error in attached message.
:
: @return Return an identifier that represents the prepared statement.
- :
- : Example:
- : jsql:prepare-statement($connection, "SELECT * FROM users WHERE id=? AND age>?")
:)
declare %an:sequential function jdbc:prepare-statement(
- $connection-id as xs:anyURI,
- $sql as xs:string) as xs:anyURI external;
+ $conn as anyURI,
+ $sql as string) as anyURI external;
(:~
- : Set the value of the designated parameter with the given value, this function will assign only numeric values.
+ : Set the value of the designated parameter to the given numeric value for a prepared statement.
:
: @param $prepared-statement The identifier to a prepared statement.
: @param $parameter-index The index from the parameter to be set.
@@ -280,15 +282,15 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:set-numeric(
- $prepared-statement as xs:anyURI,
- $parameter-index as xs:decimal,
- $value as xs:anyAtomicType) as empty-sequence() external;
+ $prepared-statement as anyURI,
+ $parameter-index as decimal,
+ $value as anyAtomicType) as () external;
(:~
- : Set the value of the designated parameter with the given value, this function will assign only string values.
+ : Set the value of the designated parameter to the given string for a prepared statement.
:
: @param $prepared-statement The identifier to a prepared statement.
: @param $parameter-index The index from the parameter to be set.
@@ -299,15 +301,15 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:set-string(
- $prepared-statement as xs:anyURI,
- $parameter-index as xs:integer,
- $value as xs:string) as empty-sequence() external;
+ $prepared-statement as anyURI,
+ $parameter-index as integer,
+ $value as string) as () external;
(:~
- : Set the value of the designated parameter with the given value, this function will assign only boolean values.
+ : Set the value of the designated parameter to the given boolean for a prepared statement.
:
: @param $prepared-statement The identifier to a prepared statement.
: @param $parameter-index The index from the parameter to be set.
@@ -318,15 +320,15 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:set-boolean(
- $prepared-statement as xs:anyURI,
- $parameter-index as xs:integer,
- $value as xs:boolean) as empty-sequence() external;
+ $prepared-statement as anyURI,
+ $parameter-index as integer,
+ $value as boolean) as () external;
(:~
- : Set the value of the designated parameter with the given value, this function will assign only null values if possible.
+ : Set the value of the designated parameter to null for a prepared statement.
:
: @param $prepared-statement The identifier to a prepared statement.
: @param $parameter-index The index from the parameter to be set.
@@ -336,16 +338,17 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:set-null(
- $prepared-statement as xs:anyURI,
- $parameter-index as xs:integer) as empty-sequence() external;
+ $prepared-statement as anyURI,
+ $parameter-index as integer) as () external;
(:~
- : 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.
+ : Set the value of the designated parameter for a prepared statement.
+ : <p/>
+ : The value will be cast to the target type or raise an error
+ : if this fails.
:
: @param $prepared-statement The identifier to a prepared statement.
: @param $parameter-index The index from the parameter to be set.
@@ -356,15 +359,15 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:set-value(
- $prepared-statement as xs:anyURI,
- $parameter-index as xs:decimal,
- $value as xs:anyAtomicType) as empty-sequence() external;
+ $prepared-statement as anyURI,
+ $parameter-index as decimal,
+ $value as anyAtomicType) as () external;
(:~
- : Clears the current parameter values immediately.
+ : Clears all the parameters of the given prepared statement.
:
: @param $prepared-statement The identifier to a prepared statement.
:
@@ -372,10 +375,10 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
-declare %an:sequential function jdbc:clear-params(
- $prepared-statement as xs:anyURI) as empty-sequence() external;
+declare %an:sequential function jdbc:clear-params($prepared-statement as anyURI)
+ as () external;
(:~
: Retrieves the number, types and properties of the prepared statement parameters.
@@ -391,19 +394,19 @@
: The metadata node returned by this function is defined as follows:
: {
: columns: [{
- : "name": xs:string,
- : "type": xs:string
+ : "name": string,
+ : "type": string
: }]
: }
: @option "name" The name of the column.
: @option "type" The SQL type of the column.
:)
-declare function jdbc:parameter-metadata(
- $prepared-statement as xs:anyURI) as object() external;
+declare function jdbc:parameter-metadata($prepared-statement as anyURI)
+ as object external;
(:~
- : Executes SQL statements prepared with 5.1 jsql:prepare-statement with values set
- : and returns an identifier to a Dataset.
+ : Executes any prepared statement returning an identifier to the resulting
+ : DataSet.
:
: @param $prepared-statement The identifier to a prepared statement.
:
@@ -411,13 +414,16 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return Return an identifier that represents a DataSet.
+ : @return an identifier that represents the DataSet.
:)
declare %an:sequential function jdbc:execute-prepared(
- $prepared-statement as xs:anyURI) as xs:anyURI external;
+ $prepared-statement as anyURI)
+ as anyURI external;
(:~
- : Executes a non-updating SQL statement prepared with 5.1 jsql:prepare-statement.
+ : Execute a non-updating query that was prepared using jdbc:prepare-statement.
+ : <p/>
+ : Each row in the result is returned as an object.
:
: @param $prepared-statement The identifier to a prepared statement.
:
@@ -426,16 +432,14 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return 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.
+ : @return the resulting rows as a sequence of objects.
:)
-declare function jdbc:execute-query-prepared(
- $prepared-statement as xs:anyURI) as object()* external;
+declare %an:nondeterministic function jdbc:execute-query-prepared(
+ $prepared-statement as anyURI)
+ as object* external;
(:~
- : Executes an updating SQL statement prepared with 5.1 jsql:prepare-statement.
+ : Execute an updating query that was prepared using jdbc:prepare-statement.
:
: @param $prepared-statement The identifier to a prepared statement.
:
@@ -444,13 +448,13 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return Returns an xs:integer with the number of affected rows.
+ : @return the number of affected rows.
:)
-declare function jdbc:execute-update-prepared(
- $prepared-statement as xs:anyURI) as xs:integer external;
+declare %an:sequential function jdbc:execute-update-prepared($prepared-statement as anyURI)
+ as integer external;
(:~
- : Closes and frees from memory any prepared SQL statement created with jdbc:prepare-statement
+ : Close a prepared statement and release all related resources.
:
: @param $prepared-statement The identifier to a prepared statement.
:
@@ -458,18 +462,21 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
- :)
-declare %an:sequential function jdbc:close-prepared(
- $prepared-statement as xs:anyURI) as empty-sequence() external;
-
-
-(:
- : 6 DATASETS
- :)
+ : @return This function returns the empty-sequence.
+ :)
+declare %an:sequential function jdbc:close-prepared($prepared-statement as anyURI)
+ as () external;
(:~
- : This function returns a sequence of objects representing the rows of data from a non-updating query.
+ : Returns the result of a non-updating query.
+ : <p/>
+ : Each row of the result is returned as an object.
+ : <pre>
+ : {
+ : "column1" : value,
+ : ...
+ : }
+ : </pre>
:
: @param $dataset-id The identifier to a DataSet.
:
@@ -477,44 +484,45 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return 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.
+ : @return The result of the given DataSet.
:)
-declare function jdbc:result-set(
- $dataset-id as xs:anyURI) as object()* external;
+declare function jdbc:result-set($dataset-id as anyURI)
+ as object* external;
(:~
: Return the metadata of the result of a particular DataSet.
- :
- : @param $dataset-id The identifier to a DataSet.
- :
- : @error SQL008 DataSet doesn't exist.
- : @error SQL08000 Connection is closed.
- : @error SQL001 Descriptive error, see error in attached message.
- :
- : @return 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:
+ : <p/>
+ : The information contains the column names, types and whether a column is nillable.
+ : The structure of the returned object is as follows:
+ : <p/>
+ : <pre>
: {
: "columns": [ {
- : "name": xs:string,
- : "type": xs:string,
- : "autoincrement"? = xs:boolean,
- : "nillable"? = xs:boolean } * ]
+ : "name": string,
+ : "type": string,
+ : "autoincrement"? = boolean,
+ : "nillable"? = boolean } * ]
: }
- : @option "name" The name of the column.
- : @option "type" The SQL type of the column.
- : @option "autoincrement" is true if this column is automatically maintained.
- : @option "nillable" If the colums can contain NULL values this attribute will be set to true.
- :
- : If the query is an updating query, then the result object will return the number of affected rows like:
- : { "affectedrows": xs:integer }
+ : </pre>
+ :
+ : <p/>
+ : If the query is an updating query, then the result object will return the number of affected rows:
+ : <pre>{ "affectedrows": integer }</pre>
+ : <p/>
+ :
+ : The information can only be returned for DataSets that have been executed
+ : using the jdbc:execute function.
+ :
+ : @param $dataset-id The identifier to a DataSet.
+ :
+ : @error SQL008 DataSet doesn't exist.
+ : @error SQL08000 Connection is closed.
+ : @error SQL001 Descriptive error, see error in attached message.
+ :
+ : @return the metadata associated with the given DataSet.
:)
-declare function jdbc:metadata(
- $dataset-id as xs:anyURI) as object() external;
+declare function jdbc:metadata($dataset-id as anyURI)
+ as object external;
(:~
: Return the number of affected rows of a particular DataSet.
@@ -525,13 +533,13 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return Returns an xs:integer with the number of affected rows.
+ : @return the number of affected rows.
:)
-declare function jdbc:affected-rows(
- $dataset-id as xs:anyURI) as xs:integer external;
+declare function jdbc:affected-rows($dataset-id as anyURI)
+ as integer external;
(:~
- : Closes and free resources from a particular DataSet.
+ : Close a DataSet and free all related resources.
:
: @param $dataset-id The identifier to a DataSet.
:
@@ -539,15 +547,28 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return This function returns an empty-sequence()
+ : @return This function returns the empty-sequence.
:)
declare %an:sequential function jdbc:close-dataset(
- $dataset-id as xs:anyURI) as empty-sequence() external;
+ $dataset-id as anyURI) as () external;
(:~
- : Return the list of tables from a connection
+ : Return the list of tables in a database.
+ : <p/>
+ : The result is a sequence of objects each containing all the metadata
+ : for a particular table.
+ : <p/>
+ : For example,
+ : <pre>
+ : {
+ : "TABLE_SCHEMA" : "demo",
+ : "TABLE_NAME" : "faq",
+ : "TABLE_TYPE" : "BASE TABLE",
+ : ...
+ : }
+ : </pre>
:
- : @param $connection-id The identifier to a connection.
+ : @param $conn The identifier to a connection.
: @param $catalog A filter of the catalog name of the tables.
: Send empty-sequence for all tables.
: @param $schema A filter of the schema name of the tables.
@@ -558,34 +579,40 @@
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return 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.
+ : @return a sequence of objects one for each table.
:
:)
declare %an:sequential function jdbc:tables(
- $connection-id as xs:anyURI,
- $catalog as xs:string?,
- $schema as xs:string?,
- $table as xs:string?) as object()* external;
+ $conn as anyURI,
+ $catalog as string?,
+ $schema as string?,
+ $table as string?) as object* external;
(:~
- :
- : Return the list of tables from a connection
- :
- : @param $connection-id The identifier to a connection.
+ : Return the list of tables in a database.
+ : <p/>
+ : The result is a sequence of objects each containing all the metadata
+ : for a particular table.
+ : <p/>
+ : For example,
+ : <pre>
+ : {
+ : "TABLE_SCHEMA" : "demo",
+ : "TABLE_NAME" : "faq",
+ : "TABLE_TYPE" : "BASE TABLE",
+ : ...
+ : }
+ : </pre>
+ :
+ : @param $conn The identifier to a connection.
:
: @error SQL08000 Connection is closed.
: @error SQL001 Descriptive error, see error in attached message.
:
- : @return 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.
+ : @return a sequence of objects one for each table.
:)
-declare %an:sequential function jdbc:tables(
- $connection-id as xs:anyURI) as object()*
+declare %an:sequential function jdbc:tables($conn as anyURI)
+ as object*
{
- jdbc:tables($connection-id, (), (), ())
+ jdbc:tables($conn, (), (), ())
};
=== modified file 'src/jdbc.xq.src/connection/connectionoptions.cpp'
--- src/jdbc.xq.src/connection/connectionoptions.cpp 2013-01-29 21:33:07 +0000
+++ src/jdbc.xq.src/connection/connectionoptions.cpp 2014-02-11 03:58:32 +0000
@@ -28,11 +28,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStrUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStrUUID = JdbcModule::getStringArg(args, 0);
jobject oConnection = JdbcModule::getObject(aDynamincContext, lStrUUID, INSTANCE_MAP_CONNECTIONS);
=== modified file 'src/jdbc.xq.src/connection/isconnected.cpp'
--- src/jdbc.xq.src/connection/isconnected.cpp 2012-12-27 22:23:41 +0000
+++ src/jdbc.xq.src/connection/isconnected.cpp 2014-02-11 03:58:32 +0000
@@ -28,10 +28,11 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lConnectionUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
jboolean isClosed = JNI_FALSE;
JDBC_MODULE_TRY
- String lConnectionUUID = JdbcModule::getStringArg(args, 0);
jobject oConnection = JdbcModule::getObject(aDynamincContext, lConnectionUUID, INSTANCE_MAP_CONNECTIONS);
=== modified file 'src/jdbc.xq.src/connection/tables.cpp'
--- src/jdbc.xq.src/connection/tables.cpp 2013-06-12 14:34:44 +0000
+++ src/jdbc.xq.src/connection/tables.cpp 2014-02-11 03:58:32 +0000
@@ -49,13 +49,13 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStrUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
jobject result=NULL;
JDBC_MODULE_TRY
- String lStrUUID = JdbcModule::getStringArg(args, 0);
-
jobject oConnection = JdbcModule::getObject(aDynamincContext, lStrUUID, INSTANCE_MAP_CONNECTIONS);
jobject oDatabaseMetadata = env->CallObjectMethod(oConnection, jConnection.getMetadata);
=== modified file 'src/jdbc.xq.src/datasets/affectedrows.cpp'
--- src/jdbc.xq.src/datasets/affectedrows.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/datasets/affectedrows.cpp 2014-02-11 03:58:32 +0000
@@ -28,12 +28,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
zorba::ItemFactory* itemFactory = Zorba::getInstance(0)->getItemFactory();
jobject oStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_STATEMENTS);
=== modified file 'src/jdbc.xq.src/datasets/metadata.cpp'
--- src/jdbc.xq.src/datasets/metadata.cpp 2013-01-05 01:04:21 +0000
+++ src/jdbc.xq.src/datasets/metadata.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_STATEMENTS);
zorba::ItemFactory* itemFactory = Zorba::getInstance(0)->getItemFactory();
=== modified file 'src/jdbc.xq.src/datasets/resultset.cpp'
--- src/jdbc.xq.src/datasets/resultset.cpp 2012-12-27 22:23:41 +0000
+++ src/jdbc.xq.src/datasets/resultset.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
jobject result=NULL;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_STATEMENTS);
int iUpdateCount = env->CallIntMethod(oPreparedStatement, jPreparedStatement.getUpdateCount);
=== modified file 'src/jdbc.xq.src/prepared/clearparams.cpp'
--- src/jdbc.xq.src/prepared/clearparams.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/prepared/clearparams.cpp 2014-02-11 03:58:32 +0000
@@ -28,12 +28,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
env->CallVoidMethod(oPreparedStatement, jPreparedStatement.clearParameters);
=== modified file 'src/jdbc.xq.src/prepared/closeprepared.cpp'
--- src/jdbc.xq.src/prepared/closeprepared.cpp 2013-01-05 01:04:21 +0000
+++ src/jdbc.xq.src/prepared/closeprepared.cpp 2014-02-11 03:58:32 +0000
@@ -29,9 +29,9 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
-
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
JdbcModule::deleteObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
=== modified file 'src/jdbc.xq.src/prepared/executeprepared.cpp'
--- src/jdbc.xq.src/prepared/executeprepared.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/prepared/executeprepared.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
env->CallBooleanMethod(oPreparedStatement, jPreparedStatement.execute);
=== modified file 'src/jdbc.xq.src/prepared/executequeryprepared.cpp'
--- src/jdbc.xq.src/prepared/executequeryprepared.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/prepared/executequeryprepared.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
jobject result=NULL;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
result = env->CallObjectMethod(oPreparedStatement, jPreparedStatement.executeQuery);
=== modified file 'src/jdbc.xq.src/prepared/executeupdateprepared.cpp'
--- src/jdbc.xq.src/prepared/executeupdateprepared.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/prepared/executeupdateprepared.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
int rowCount = env->CallIntMethod(oPreparedStatement, jPreparedStatement.executeUpdate);
=== modified file 'src/jdbc.xq.src/prepared/parametermetadata.cpp'
--- src/jdbc.xq.src/prepared/parametermetadata.cpp 2012-12-27 22:54:36 +0000
+++ src/jdbc.xq.src/prepared/parametermetadata.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
jobject oParameterMetaData = env->CallObjectMethod(oPreparedStatement, jPreparedStatement.getParameterMetaData);
=== modified file 'src/jdbc.xq.src/prepared/setboolean.cpp'
--- src/jdbc.xq.src/prepared/setboolean.cpp 2012-12-27 22:23:41 +0000
+++ src/jdbc.xq.src/prepared/setboolean.cpp 2014-02-11 03:58:32 +0000
@@ -30,12 +30,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
long index = (long)JdbcModule::getItemArg(args, 1).getLongValue();
=== modified file 'src/jdbc.xq.src/prepared/setnull.cpp'
--- src/jdbc.xq.src/prepared/setnull.cpp 2013-01-03 01:26:52 +0000
+++ src/jdbc.xq.src/prepared/setnull.cpp 2014-02-11 03:58:32 +0000
@@ -28,12 +28,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
jobject oParameterMetadata = env->CallObjectMethod(oPreparedStatement, jPreparedStatement.getParameterMetaData);
=== modified file 'src/jdbc.xq.src/prepared/setnumeric.cpp'
--- src/jdbc.xq.src/prepared/setnumeric.cpp 2012-12-27 22:23:41 +0000
+++ src/jdbc.xq.src/prepared/setnumeric.cpp 2014-02-11 03:58:32 +0000
@@ -30,12 +30,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
long index = (long)JdbcModule::getItemArg(args, 1).getLongValue();
=== modified file 'src/jdbc.xq.src/prepared/setstring.cpp'
--- src/jdbc.xq.src/prepared/setstring.cpp 2012-12-27 22:23:41 +0000
+++ src/jdbc.xq.src/prepared/setstring.cpp 2014-02-11 03:58:32 +0000
@@ -30,12 +30,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
long index = (long)JdbcModule::getItemArg(args, 1).getLongValue();
=== modified file 'src/jdbc.xq.src/prepared/setvalue.cpp'
--- src/jdbc.xq.src/prepared/setvalue.cpp 2013-01-03 09:35:44 +0000
+++ src/jdbc.xq.src/prepared/setvalue.cpp 2014-02-11 03:58:32 +0000
@@ -30,12 +30,12 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStatementUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lStatementUUID = JdbcModule::getStringArg(args, 0);
-
jobject oPreparedStatement = JdbcModule::getObject(aDynamincContext, lStatementUUID, INSTANCE_MAP_PREPAREDSTATEMENTS);
long index = (long)JdbcModule::getItemArg(args, 1).getLongValue();
=== modified file 'src/jdbc.xq.src/statements/execute.cpp'
--- src/jdbc.xq.src/statements/execute.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/statements/execute.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,13 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lConnectionUUID = JdbcModule::getStringArg(args, 0);
+ String lQuery = JdbcModule::getStringArg(args, 1);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lConnectionUUID = JdbcModule::getStringArg(args, 0);
- String lQuery = JdbcModule::getStringArg(args, 1);
jobject oConnection = JdbcModule::getObject(aDynamincContext, lConnectionUUID, INSTANCE_MAP_CONNECTIONS);
=== modified file 'src/jdbc.xq.src/statements/executequery.cpp'
--- src/jdbc.xq.src/statements/executequery.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/statements/executequery.cpp 2014-02-11 03:58:32 +0000
@@ -29,12 +29,13 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lConnectionUUID = JdbcModule::getStringArg(args, 0);
+ String lQuery = JdbcModule::getStringArg(args, 1);
+
CHECK_CONNECTION
jobject result=NULL;
JDBC_MODULE_TRY
- String lConnectionUUID = JdbcModule::getStringArg(args, 0);
- String lQuery = JdbcModule::getStringArg(args, 1);
jobject oConnection = JdbcModule::getObject(aDynamincContext, lConnectionUUID, INSTANCE_MAP_CONNECTIONS);
=== modified file 'src/jdbc.xq.src/statements/executeupdate.cpp'
--- src/jdbc.xq.src/statements/executeupdate.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/statements/executeupdate.cpp 2014-02-11 03:58:32 +0000
@@ -30,12 +30,13 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lConnectionUUID = JdbcModule::getStringArg(args, 0);
+ String lQuery = JdbcModule::getStringArg(args, 1);
+
CHECK_CONNECTION
Item result;
JDBC_MODULE_TRY
- String lConnectionUUID = JdbcModule::getStringArg(args, 0);
- String lQuery = JdbcModule::getStringArg(args, 1);
jobject oConnection = JdbcModule::getObject(aDynamincContext, lConnectionUUID, INSTANCE_MAP_CONNECTIONS);
=== modified file 'src/jdbc.xq.src/transactions/commit.cpp'
--- src/jdbc.xq.src/transactions/commit.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/transactions/commit.cpp 2014-02-11 03:58:32 +0000
@@ -28,11 +28,11 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lStrUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
JDBC_MODULE_TRY
- String lStrUUID = JdbcModule::getStringArg(args, 0);
-
jobject oConnection = JdbcModule::getObject(aDynamincContext, lStrUUID, INSTANCE_MAP_CONNECTIONS);
env->CallVoidMethod(oConnection, jConnection.commit);
=== modified file 'src/jdbc.xq.src/transactions/rollback.cpp'
--- src/jdbc.xq.src/transactions/rollback.cpp 2012-12-27 22:13:59 +0000
+++ src/jdbc.xq.src/transactions/rollback.cpp 2014-02-11 03:58:32 +0000
@@ -28,11 +28,11 @@
const zorba::StaticContext* aStaticContext,
const zorba::DynamicContext* aDynamincContext) const
{
+ String lConnectionUUID = JdbcModule::getStringArg(args, 0);
+
CHECK_CONNECTION
JDBC_MODULE_TRY
- String lConnectionUUID = JdbcModule::getStringArg(args, 0);
-
jobject oConnection = JdbcModule::getObject(aDynamincContext, lConnectionUUID, INSTANCE_MAP_CONNECTIONS);
jclass cConnection = jConnection.classID;
=== modified file 'test/Queries/01-creatingDB.xq'
--- test/Queries/01-creatingDB.xq 2013-02-08 09:40:54 +0000
+++ test/Queries/01-creatingDB.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
=== modified file 'test/Queries/02-select.xq'
--- test/Queries/02-select.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/02-select.xq 2014-02-11 03:58:32 +0000
@@ -1,12 +1,17 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
+
+let $conn := {
+ "url": "jdbc:mysql://localhost:3307/",
+ "user" : "root",
+ "password" : ""})
+return
+ jdbc:execute-update($conn, "CREATE DATABASE /*!32312 IF NOT EXISTS*/`School02` /*!40100 DEFAULT CHARACTER SET latin1 */;");
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
"user" : "root",
"password" : ""});
-jdbc:execute-update($connection, "CREATE DATABASE /*!32312 IF NOT EXISTS*/`School02` /*!40100 DEFAULT CHARACTER SET latin1 */;");
-
jdbc:execute-update($connection, "USE `School02`;");
(: Table structures :)
=== modified file 'test/Queries/03-connect-options.xq'
--- test/Queries/03-connect-options.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/03-connect-options.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
=== modified file 'test/Queries/04-set-null.xq'
--- test/Queries/04-set-null.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/04-set-null.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/?generateSimpleParameterMetadata=true",
=== modified file 'test/Queries/05-result-set.xq'
--- test/Queries/05-result-set.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/05-result-set.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
=== modified file 'test/Queries/06-prepare.xq'
--- test/Queries/06-prepare.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/06-prepare.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
=== modified file 'test/Queries/07-prepare.xq'
--- test/Queries/07-prepare.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/07-prepare.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/?generateSimpleParameterMetadata=true",
=== modified file 'test/Queries/08-deletingDB.xq'
--- test/Queries/08-deletingDB.xq 2013-06-11 20:47:52 +0000
+++ test/Queries/08-deletingDB.xq 2014-02-11 03:58:32 +0000
@@ -1,4 +1,4 @@
-import module namespace jdbc = "http://www.zorba-xquery.com/modules/jdbc";
+import module namespace jdbc = "http://zorba.io/modules/jdbc";
variable $connection := jdbc:connect({
"url": "jdbc:mysql://localhost:3307/",
@@ -56,6 +56,7 @@
INSERT INTO `students`(`idStudent`,`Name`,`Address`,`Birthday`,`Weight`) VALUES (1,'Rodolfo Ochoa',' 10 Van De Graaff Dr # 1 Burlington, MA 01803','2012-12-06',160),(2,'Dana Florescu','10 Van De Graaff Dr # 1 Burlington, MA 01803','2012-12-13',150),(3,'Cezar Andrei',' 10 Van De Graaff Dr # 1 Burlington, MA 01803','2012-12-27',160);
");
+trace(jdbc:tables($connection), "tables");
if (jdbc:is-connected($connection))
then { true() }
Follow ups