Skip to content

Commit

Permalink
Adding initial setup for mssql
Browse files Browse the repository at this point in the history
  • Loading branch information
lcahlander committed May 13, 2022
1 parent fae15f8 commit 28c8ab8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MySQL JDBC Driver for eXist-db
# Microsoft MSSQL JDBC Driver for eXist-db

Loadable JDBC Driver for MySQL within eXist-db.

Expand Down
21 changes: 10 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
</parent>

<groupId>org.exist-db</groupId>
<artifactId>exist-mysql-jdbc-driver</artifactId>
<version>8.0.29</version>
<artifactId>exist-mssql-jdbc-driver</artifactId>
<version>10.2.0.jre8</version>

<name>MySQL JDBC Driver</name>
<description>MySQL JDBC Driver for eXist-db</description>
<url>https://exist-db.org/exist-db/jdbc/mysql</url>
<url>https://exist-db.org/exist-db/jdbc/mssql</url>

<organization>
<name>eXist-db</name>
Expand All @@ -33,14 +33,14 @@
</licenses>

<scm>
<url>https://www.github.com/eXist-db/exist-mysql-jdbc-driver.git</url>
<connection>scm:git:https://www.github.com/eXist-db/exist-mysql-jdbc-driver.git</connection>
<developerConnection>scm:git:https://www.github.com/eXist-db/exist-mysql-jdbc-driver.git</developerConnection>
<url>https://www.github.com/eXist-db/exist-mssql-jdbc-driver.git</url>
<connection>scm:git:https://www.github.com/eXist-db/exist-mssql-jdbc-driver.git</connection>
<developerConnection>scm:git:https://www.github.com/eXist-db/exist-mssql-jdbc-driver.git</developerConnection>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://www.github.com/eXist-db/exist-mysql-jdbc-driver/issues</url>
<url>https://www.github.com/eXist-db/exist-mssql-jdbc-driver/issues</url>
</issueManagement>

<properties>
Expand All @@ -51,7 +51,7 @@
<exist.version>6.0.1</exist.version>

<!-- used in the EXPath Package Descriptor -->
<package-name>https://exist-db.org/exist-db/jdbc/mysql</package-name>
<package-name>https://exist-db.org/exist-db/jdbc/mssql</package-name>
</properties>

<dependencies>
Expand All @@ -60,10 +60,9 @@
<artifactId>exist-core</artifactId>
<version>${exist.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Binary file modified src/main/xar-resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
xquery version "3.1";

(:~
: A module for performing SQL queries against MySQL Databases, returning XML representations of the result sets.
: A module for performing SQL queries against mssql Databases, returning XML representations of the result sets.
:)
module namespace mysql = "https://exist-db.org/exist-db/ns/app/mysql";
module namespace mssql = "https://exist-db.org/exist-db/ns/app/mssql";
import module namespace sql="http://exist-db.org/xquery/sql";

declare variable $mysql:classpath := "com.mysql.cj.jdbc.Driver";
declare variable $mssql:classpath := "com.microsoft.sqlserver.jdbc.SQLServerDriver";

(:~
: Opens a connection to a MySQL Database
: Opens a connection to a mssql Database
: @param $url The JDBC connection URL
: @return an xs:long representing the connection handle
:)
declare function mysql:get-connection($url as xs:string)
declare function mssql:get-connection($url as xs:string)
as xs:long?
{
sql:get-connection($mysql:classpath, $url)
sql:get-connection($mssql:classpath, $url)
};

(:~
: Opens a connection to a MySQL Database
: Opens a connection to a mssql Database
: @param $url The JDBC connection URL
: @param $properties The JDBC database connection properties in the form &lt;properties&gt;&lt;property name="" value=""/&gt;&lt;/properties&gt;
: @return an xs:long representing the connection handle
:)
declare function mysql:get-connection($url as xs:string, $properties as element()?)
declare function mssql:get-connection($url as xs:string, $properties as element()?)
as xs:long?
{
sql:get-connection($mysql:classpath, $url, $properties)
sql:get-connection($mssql:classpath, $url, $properties)
};

(:~
: Opens a connection to a MySQL Database
: Opens a connection to a mssql Database
: @param $url The JDBC connection URL
: @param $username The MySQL database username
: @param $password The MySQL database password
: @param $username The mssql database username
: @param $password The mssql database password
: @return an xs:long representing the connection handle
:)
declare function mysql:get-connection($url as xs:string, $username as xs:string, $password as xs:string)
declare function mssql:get-connection($url as xs:string, $username as xs:string, $password as xs:string)
as xs:long?
{
sql:get-connection($mysql:classpath, $url, $username, $password)
sql:get-connection($mssql:classpath, $url, $username, $password)
};

(:~
: Prepares a SQL statement against a MySQL db using the connection indicated by the connection handle.
: Prepares a SQL statement against a mssql db using the connection indicated by the connection handle.
: @param $handle The connection handle
: @param $sql-statement The SQL statement
: @return an xs:long representing the statement handle
:)
declare function mysql:prepare($handle as xs:long, $sql-statement as xs:string)
declare function mssql:prepare($handle as xs:long, $sql-statement as xs:string)
as xs:long?
{
sql:prepare($handle, $sql-statement)
};

(:~
: Executes a SQL statement against a MySQL database.
: Executes a SQL statement against a mssql database.
: @param $connection-handle The connection handle
: @param $sql-statement The SQL statement
: @param $make-node-from-column-name
Expand All @@ -66,7 +66,7 @@ as xs:long?
: will be replaced by an underscore!)
: @return the results
:)
declare function mysql:execute(
declare function mssql:execute(
$connection-handle as xs:long,
$sql-statement as xs:string,
$make-node-from-column-name as xs:boolean
Expand All @@ -77,7 +77,7 @@ as element()?
};

(:~
: Executes a prepared SQL statement against a MySQL database.
: Executes a prepared SQL statement against a mssql database.
: @param $connection-handle The connection handle
: @param $statement-handle The prepared statement handle
: @param $parameters Parameters for the prepared statement.
Expand All @@ -94,7 +94,7 @@ as element()?
: will be replaced by an underscore!)
: @return the results
:)
declare function mysql:execute(
declare function mssql:execute(
$connection-handle as xs:long,
$statement-handle as xs:long,
$parameters as element()?,
Expand Down
11 changes: 5 additions & 6 deletions xar-assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://expath.org/ns/pkg" name="${package-name}" abbrev="${package-abbrev}" version="${project.version}"
spec="1.0">
<title>${package-title}</title>
<author id="my-organisation">My Organisation</author>
<author id="my-organisation">eXist-db</author>
<website>${project.url}</website>
<license>GNU Lesser General Public License, version 2.1</license>
<copyright>true</copyright>
Expand Down Expand Up @@ -41,10 +41,10 @@
<!-- include the XQuery Library modules written in XQuery from this project -->
<xquerySets>
<xquerySet>
<namespace>https://exist-db.org/exist-db/ns/app/mysql</namespace>
<namespace>https://exist-db.org/exist-db/ns/app/mssql</namespace>
<directory>${basedir}/src/main/xquery</directory>
<includes>
<include>mysql-module.xqm</include>
<include>mssql-module.xqm</include>
</includes>
<outputDirectory>content</outputDirectory>
</xquerySet>
Expand All @@ -57,10 +57,9 @@
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependencySet>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependencySet>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>${project.version}</version>
</dependencySet>
</dependencySets>
Expand Down

0 comments on commit 28c8ab8

Please sign in to comment.