diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index fff7c5ff..00000000
--- a/.editorconfig
+++ /dev/null
@@ -1,9 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
-end_of_line = lf
-insert_final_newline = true
diff --git a/.travis.yml b/.travis.yml
index fdde9cf9..00320fb4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: java
branches:
only:
- - master
- /^\d+\.\d+$/
services:
- docker
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 01651793..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Guide to contributing
-
-Please read this if you intend to contribute to the project.
-
-## First things
-
-* Get a github account if you don't have one already
-* Submit a github issue if there isn't one already.
- * Clearly describe the bug or feature
- * Provide exact reproducable steps to reproduce the issue if its a bug
- * Include the versions of all components
-* Fork the repository on github
-
-## Making your changes
-
-* Create a new branch for your changes
-* Make your changes
-* Make sure you include tests
-* Make sure the test suite passes after your changes
-* Commit your changes into that branch
-* Use descriptive and meaningful commit messages
-* If you have a lot of commits squash them into a single commit
-* Push your changes to your branch in your forked repository
-
-## Submitting the changes
-
-Before submitting your pull request you must sign the [Eclipse Foundation Contributor License Agreement](http://www.eclipse.org/legal/CLA.php).
-
-We will NOT ACCEPT any contributions without this first being signed.
-
-To sign the Eclipse CLA you need to:
-
-* Obtain an Eclipse Foundation userid. Anyone who currently uses Eclipse Bugzilla or Gerrit systems already has one of those.
-If you don’t, you need to [register](https://dev.eclipse.org/site_login/createaccount.php).
-
-* Login into the [projects portal](https://projects.eclipse.org/), select “My Account”, and then the “Contributor License Agreement” tab.
-
-## After submitting
-
-* Once you have signed the Eclipse CLA, make a note on the github issue that you have signed the CLA, and then you can submit a pull request via github.
-* Do not use your branch for any other development, otherwise further changes that you make will be visible in the PR.
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 37ec93a1..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/README.adoc b/README.adoc
index ab240ac7..1b6d2bb9 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,47 +1,3 @@
= Vert.x MySQL PostgreSQL client
-image:https://travis-ci.org/vert-x3/vertx-mysql-postgresql-client.svg?branch=master["Build Status", link="https://travis-ci.org/vert-x3/vertx-mysql-postgresql-client"]
-
-This Vert.x client uses the https://github.com/mauricio/postgresql-async[Mauricio Linhares driver] to support
-a fully async client for MySQL and PostgreSQL.
-
-Please see the in source asciidoc documentation or the main documentation on the web-site for a full description:
-
-* http://vertx.io/docs/vertx-mysql-postgresql-client/java/[Java documentation]
-* http://vertx.io/docs/vertx-mysql-postgresql-client/js/[JavaScript documentation]
-* http://vertx.io/docs/vertx-mysql-postgresql-client/kotlin/[Kotlin documentation]
-* http://vertx.io/docs/vertx-mysql-postgresql-client/groovy/[Groovy documentation]
-* http://vertx.io/docs/vertx-mysql-postgresql-client/ruby/[Ruby documentation]
-
-== Running test suite with Docker
-
-The test suite is based on testcontainers and will spawn separate instances for the different tests.
-
-NOTE: Running test with Docker requires enabling the profile as Docker isn't available on Cloudbees: `mvn clean install -Ddocker`
-
-== (Deprecated) Running test suite on CkoudBees (this is only here for historic docs to help transition to Travis)
-
-Setting up test databases with Docker:
-
-----
-docker run --rm --name vertx-postgres -e POSTGRES_USER=vertx -e POSTGRES_PASSWORD=password -e POSTGRES_DB=testdb -p 5432:5432 postgres
-----
-
-----
-docker run --rm --name vertx-postgres-ssl -p 54321:5432 \
- -e POSTGRES_USER=vertx \
- -e POSTGRES_PASSWORD=password \
- -e POSTGRES_DB=testdb \
- -v $(pwd)/src/test/resources/ssl-docker/server.crt:/docker-entrypoint-initdb.d/server.crt \
- -v $(pwd)/src/test/resources/ssl-docker/server.key:/docker-entrypoint-initdb.d/server.key \
- -v $(pwd)/src/test/resources/ssl-docker/init.sh:/docker-entrypoint-initdb.d/init.sh \
- postgres
-----
-
-NOTE: If you're working with Fedora, CentOS or RHEL and have selinux enabled, you need to add `:z` to the volume options.
-Otherwise Postgres won't be able to read the SSL setup files.
-For more details, read http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/[Using Volumes with Docker can Cause Problems with SELinux].
-
-----
-docker run --rm --name vertx-mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_USER=vertx -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=testdb -p 3306:3306 mysql/mysql-server:5.6
-----
+Module removed in Vert.x 4.
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 87d02836..00000000
--- a/pom.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
- io.vertx
- vertx-ext-parent
- 34
-
-
- 4.0.0
-
- vertx-mysql-postgresql-client
- 3.6.0
-
- Vert.x MySQL/PostgreSQL Client
-
-
- 3.6.0
- 2.12.7
- 0.2.21
-
-
-
-
-
- io.vertx
- vertx-dependencies
- ${stack.version}
- pom
- import
-
-
-
-
-
-
- org.slf4j
- slf4j-api
- 1.7.21
- provided
-
-
- io.vertx
- vertx-sql-common
-
-
- io.vertx
- vertx-unit
- test
-
-
- org.scala-lang
- scala-library
- ${scala.version}
-
-
- com.github.mauricio
- postgresql-async_2.12
- ${asyncdriver.version}
-
-
- org.slf4j
- slf4j-api
-
-
- io.netty
- netty-all
-
-
-
-
- com.github.mauricio
- mysql-async_2.12
- ${asyncdriver.version}
-
-
- org.slf4j
- slf4j-api
-
-
- io.netty
- netty-all
-
-
-
-
- io.vertx
- vertx-codegen
- true
-
-
- io.vertx
- vertx-docgen
- true
-
-
- io.vertx
- vertx-core
- test-jar
- test
-
-
- junit
- junit
- test
- 4.12
-
-
- com.jayway.awaitility
- awaitility
- 1.6.3
- test
-
-
- org.mockito
- mockito-core
- 2.10.0
- test
-
-
- org.testcontainers
- testcontainers
- 1.8.3
- test
-
-
- org.testcontainers
- mysql
- 1.8.3
- test
-
-
- mysql
- mysql-connector-java
- 5.1.6
- test
-
-
- org.testcontainers
- postgresql
- 1.8.3
- test
-
-
- org.slf4j
- slf4j-simple
- 1.7.25
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- 60
- PARANOID
-
- -server -Xms128m -Xmx1024m -XX:NewRatio=2
-
-
-
-
-
-
diff --git a/src/main/asciidoc/index.adoc b/src/main/asciidoc/index.adoc
deleted file mode 100644
index ca3aa7c8..00000000
--- a/src/main/asciidoc/index.adoc
+++ /dev/null
@@ -1,233 +0,0 @@
-= Vert.x MySQL / PostgreSQL client
-
-The Async MySQL / PostgreSQL Client is responsible for providing an
-interface for Vert.x applications that need to interact with a MySQL or PostgreSQL database.
-
-It uses Mauricio Linhares https://github.com/mauricio/postgresql-async[async driver] to interact with the MySQL
-or PostgreSQL databases in a non blocking way.
-
-== Using the MySQL and PostgreSQL client
-
-This section describes how to configure your project to be able to use the MySQL / PostgreSQL client in your
-application.
-
-=== In a regular application
-
-To use this client, you need to add the following jar to your `CLASSPATH`:
-
-* ${maven.artifactId} ${maven.version} (the client)
-* scala-library 2.11.4
-* the postgress-async-2.11 and mysdql-async-2.11 from https://github.com/mauricio/postgresql-async
-* joda time
-
-All these jars are downloadable from Maven Central.
-
-=== In an application packaged in a fat jar
-
-If you are building a _Fat-jar_ using Maven or Gradle, just add the following dependencies:
-
-* Maven (in your `pom.xml`):
-
-[source,xml,subs="+attributes"]
-----
-
- io.vertx
- vertx-mysql-postgresql-client
- ${maven.version}
-
-----
-
-* Gradle (in your `build.gradle` file):
-
-[source,groovy,subs="+attributes"]
-----
-compile 'io.vertx:vertx-mysql-postgresql-client:${maven.version}'
-----
-
-=== In an application using a vert.x distributions
-
-If you are using a vert.x distribution, add the jar files listed above to the `$VERTX_HOME/lib` directory.
-
-Alternatively, you can edit the `vertx-stack.json` file located in `$VERTX_HOME`, and set `"included": true`
-for the `vertx-mysql-postgresql-client` dependency. Once done, launch: `vertx resolve --dir=lib --stack=
-./vertx-stack.json`. It downloads the client and its dependencies.
-
-== Creating a client
-
-There are several ways to create a client. Let's go through them all.
-
-=== Using default shared pool
-
-In most cases you will want to share a pool between different client instances.
-
-E.g. you scale your application by deploying multiple instances of your verticle and you want each verticle instance
-to share the same pool so you don't end up with multiple pools
-
-You do this as follows:
-
-[source,java]
-----
-{@link examples.MySQLPostgreSQLExamples#exampleCreateDefault}
-----
-
-The first call to {@link io.vertx.ext.asyncsql.MySQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject)}
-or {@link io.vertx.ext.asyncsql.PostgreSQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject)}
-will actually create the data source, and the specified config will be used.
-
-Subsequent calls will return a new client instance that uses the same data source, so the configuration won't be used.
-
-=== Specifying a pool name
-
-You can create a client specifying a pool name as follows
-
-[source,java]
-----
-{@link examples.MySQLPostgreSQLExamples#exampleCreatePoolName}
-----
-
-If different clients are created using the same Vert.x instance and specifying the same pool name, they will
-share the same data source.
-
-The first call to {@link io.vertx.ext.asyncsql.MySQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject, String)}
-or {@link io.vertx.ext.asyncsql.PostgreSQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject, String)}
-will actually create the data source, and the specified config will be used.
-
-Subsequent calls will return a new client instance that uses the same pool, so the configuration won't be used.
-
-Use this way of creating if you wish different groups of clients to have different pools, e.g. they're
-interacting with different databases.
-
-=== Creating a client with a non shared data source
-
-In most cases you will want to share a pool between different client instances.
-However, it's possible you want to create a client instance that doesn't share its pool with any other client.
-
-In that case you can use {@link io.vertx.ext.asyncsql.MySQLClient#createNonShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject)}
-or {@link io.vertx.ext.asyncsql.PostgreSQLClient#createNonShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject)}
-
-[source,java]
-----
-{@link examples.MySQLPostgreSQLExamples#exampleCreateNonShared}
-----
-
-This is equivalent to calling {@link io.vertx.ext.asyncsql.MySQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject, String)}
-or {@link io.vertx.ext.asyncsql.PostgreSQLClient#createShared(io.vertx.core.Vertx, io.vertx.core.json.JsonObject, String)}
-with a unique pool name each time.
-
-== Closing the client
-
-You can hold on to the client for a long time (e.g. the life-time of your verticle), but once you have finished with
-it, you should close it using {@link io.vertx.ext.asyncsql.AsyncSQLClient#close(io.vertx.core.Handler)} or
-{@link io.vertx.ext.asyncsql.AsyncSQLClient#close()}
-
-== Getting a connection
-
-Use {@link io.vertx.ext.asyncsql.AsyncSQLClient#getConnection(io.vertx.core.Handler)} to get a connection.
-
-This will return the connection in the handler when one is ready from the pool.
-
-[source,java]
-----
-{@link examples.MySQLPostgreSQLExamples#example4}
-----
-
-Once you've finished with the connection make sure you close it afterwards.
-
-The connection is an instance of {@link io.vertx.ext.sql.SQLConnection} which is a common interface used by
-other SQL clients.
-
-You can learn how to use it in the http://vertx.io/docs/vertx-sql-common/$lang/[common sql interface] documentation.
-
-=== Configuring reconnections
-
-This service is able to recover from temporary database outages, such as those which occur during a database restart or
-brief loss of network connectivity. You can configure the expected behaviour when acquiring connections via the
-following properties:
-
-* `maxConnectionRetries`
-* `connectionRetryDelay`
-
-When the internal connection pool attempts to acquire an open connection and fails, it will retry up to
-`maxConnectionRetries` times, with a delay of `connectionRetryDelay` milliseconds between each attempt.
-If all attempts fail, any clients waiting for connections from the pool will be notified with an Error, indicating that
-a Connection could not be acquired. Note that clients will not be notified with an Error until a full round of attempts
-fail, which may be some time after the initial connection attempt.
-
-If `maxConnectionRetries` is set to `0`, the internal connection pool will not perform any reconnection (default). If
-`maxConnectionRetries` is set to `-1`, the internal connection pool will attempt to acquire new connections indefinitely,
-so any call to {@link io.vertx.ext.asyncsql.AsyncSQLClient#getConnection(io.vertx.core.Handler)}
-may be indefinitely waiting for a successful acquisition.
-
-Once a full round of acquisition attempts fails, the internal connection pool will remain active, and will try
-again to acquire connections in response to future requests for connections.
-
-Note that if a database restart occurs, a pool may contain previously acquired but now stale Connections that will only be
-detected and purged lazily, when the pool attempts to reuse them.
-
-=== Note about date and timestamps
-
-Whenever you get dates back from the database, this service will implicitly convert them into ISO 8601
-(`yyyy-MM-ddTHH:mm:ss.SSS`) formatted strings. MySQL usually discards milliseconds, so you will regularly see `.000`.
-
-=== Note about last inserted ids
-
-When inserting new rows into a table, you might want to retrieve auto-incremented ids from the database. The JDBC API
-usually lets you retrieve the last inserted id from a connection. If you use MySQL, it will work the way it does like
-the JDBC API. In PostgreSQL you can add the
-http://www.postgresql.org/docs/current/static/sql-insert.html["RETURNING" clause] to get the latest inserted ids. Use
-one of the `query` methods to get access to the returned columns.
-
-=== Note about stored procedures
-
-The `call` and `callWithParams` methods are not implemented currently.
-
-== Configuration
-
-Both the PostgreSql and MySql clients take the same configuration:
-
-----
-{
- "host" : ,
- "port" : ,
- "maxPoolSize" : ,
- "username" : ,
- "password" : ,
- "database" : ,
- "charset" : ,
- "connectTimeout" : ,
- "testTimeout" : ,
- "queryTimeout" : ,
- "maxConnectionRetries" : ,
- "connectionRetryDelay" : ,
- "sslMode" : <"disable"|"prefer"|"require"|"verify-ca"|"verify-full">,
- "sslRootCert" :
-}
-----
-
-`host`:: The host of the database. Defaults to `localhost`.
-`port`:: The port of the database. Defaults to `5432` for PostgreSQL and `3306` for MySQL.
-`maxPoolSize`:: The number of connections that may be kept open. Defaults to `10`.
-`username`:: The username to connect to the database. Defaults to `vertx`.
-`password`:: The password to connect to the database. Defaults to `password`.
-`database`:: The name of the database you want to connect to. Defaults to `testdb`.
-`charset`:: The name of the character set you want to use for the connection. Defaults to `UTF-8`.
-`connectTimeout`:: The timeout to wait for connecting to the database. Defaults to `10000` (= 10 seconds).
-`testTimeout`:: The timeout for connection tests performed by pools. Defaults to `10000` (= 10 seconds).
-`queryTimeout`:: The timeout to wait for a query in milliseconds. Default is not set.
-`maxConnectionRetries`:: Maximum number of connection retries. Defaults to `0` (no retries). +
- Special values:
- -1 ::: Unlimited number of connection retries
- 0 ::: No connection retries will be done
-`connectionRetryDelay`:: Delay in milliseconds between each retry attempt. Defaults to `5000` (= 5 seconds).
-`sslMode` :: If you want to enable SSL support you should enable this parameter.
- For example to connect Heroku you will need to use *prefer*.
-
- "disable" ::: only try a non-SSL connection
- "prefer" ::: first try an SSL connection; if that fails, try a non-SSL connection
- "require" ::: only try an SSL connection, but don't verify Certificate Authority
- "verify-ca" ::: only try an SSL connection, and verify that the server certificate is issued by a trusted
- certificate authority (CA)
- "verify-full" ::: only try an SSL connection, verify that the server certificate is issued by a trusted CA and
- that the server host name matches that in the certificate
-`sslRootCert` :: Path to SSL root certificate file. Is used if you want to verify privately issued certificate.
- Refer to https://github.com/mauricio/postgresql-async[postgresql-async] documentation for more details.
diff --git a/src/main/java/examples/MySQLPostgreSQLExamples.java b/src/main/java/examples/MySQLPostgreSQLExamples.java
deleted file mode 100644
index 7a6c797f..00000000
--- a/src/main/java/examples/MySQLPostgreSQLExamples.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package examples;
-
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.MySQLClient;
-import io.vertx.ext.asyncsql.PostgreSQLClient;
-import io.vertx.ext.sql.SQLClient;
-import io.vertx.ext.sql.SQLConnection;
-
-/**
- *
- * @author Tim Fox
- */
-public class MySQLPostgreSQLExamples {
-
- public void exampleCreateDefault(Vertx vertx) {
-
- // To create a MySQL client:
-
- JsonObject mySQLClientConfig = new JsonObject().put("host", "mymysqldb.mycompany");
- SQLClient mySQLClient = MySQLClient.createShared(vertx, mySQLClientConfig);
-
- // To create a PostgreSQL client:
-
- JsonObject postgreSQLClientConfig = new JsonObject().put("host", "mypostgresqldb.mycompany");
- SQLClient postgreSQLClient = PostgreSQLClient.createShared(vertx, postgreSQLClientConfig);
-
- }
-
- public void exampleCreatePoolName(Vertx vertx) {
-
- // To create a MySQL client:
-
- JsonObject mySQLClientConfig = new JsonObject().put("host", "mymysqldb.mycompany");
- SQLClient mySQLClient = MySQLClient.createShared(vertx, mySQLClientConfig, "MySQLPool1");
-
- // To create a PostgreSQL client:
-
- JsonObject postgreSQLClientConfig = new JsonObject().put("host", "mypostgresqldb.mycompany");
- SQLClient postgreSQLClient = PostgreSQLClient.createShared(vertx, postgreSQLClientConfig, "PostgreSQLPool1");
-
- }
-
- public void exampleCreateNonShared(Vertx vertx) {
-
- // To create a MySQL client:
-
- JsonObject mySQLClientConfig = new JsonObject().put("host", "mymysqldb.mycompany");
- SQLClient mySQLClient = MySQLClient.createNonShared(vertx, mySQLClientConfig);
-
- // To create a PostgreSQL client:
-
- JsonObject postgreSQLClientConfig = new JsonObject().put("host", "mypostgresqldb.mycompany");
- SQLClient postgreSQLClient = PostgreSQLClient.createNonShared(vertx, postgreSQLClientConfig);
-
- }
-
- public void example2(Vertx vertx) {
-
- JsonObject config = new JsonObject().put("host", "mymysqldb.mycompany");
-
- SQLClient mySQLClient = MySQLClient.createNonShared(vertx, config);
-
- }
-
- public void example3(Vertx vertx) {
-
- JsonObject config = new JsonObject().put("host", "mypostgresqldb.mycompany");
-
- SQLClient postgreSQLClient = PostgreSQLClient.createNonShared(vertx, config);
- }
-
- public void example4(SQLClient client) {
-
- // Now do stuff with it:
-
- client.getConnection(res -> {
- if (res.succeeded()) {
-
- SQLConnection connection = res.result();
-
- // Got a connection
-
- } else {
- // Failed to get connection - deal with it
- }
- });
-
- }
-
-
-}
diff --git a/src/main/java/examples/package-info.java b/src/main/java/examples/package-info.java
deleted file mode 100644
index c75de2ba..00000000
--- a/src/main/java/examples/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-/**
- * @author Julien Viet
- */
-@Source
-package examples;
-
-import io.vertx.docgen.Source;
\ No newline at end of file
diff --git a/src/main/java/io/vertx/ext/asyncsql/AsyncSQLClient.java b/src/main/java/io/vertx/ext/asyncsql/AsyncSQLClient.java
deleted file mode 100644
index 20421b8a..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/AsyncSQLClient.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql;
-
-import io.vertx.codegen.annotations.VertxGen;
-import io.vertx.ext.sql.SQLClient;
-
-/**
- * Represents an asynchronous SQL client
- *
- * @author Joern Bernhardt.
- * @author Tim Fox
- */
-@VertxGen
-public interface AsyncSQLClient extends SQLClient {
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/MySQLClient.java b/src/main/java/io/vertx/ext/asyncsql/MySQLClient.java
deleted file mode 100644
index 59db3567..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/MySQLClient.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql;
-
-import io.vertx.codegen.annotations.VertxGen;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.impl.ClientHelper;
-import io.vertx.ext.sql.SQLClient;
-
-import java.util.UUID;
-
-/**
- * Represents an asynchronous MySQL client
- *
- * @author Joern Bernhardt.
- * @author Tim Fox
- */
-@VertxGen
-public interface MySQLClient extends AsyncSQLClient {
-
- /**
- * The default name used for the MySQL pool.
- */
- String DEFAULT_POOL_NAME = "DEFAULT_MYSQL_POOL";
-
- /**
- * The default host.
- */
- String DEFAULT_HOST = "localhost";
-
- /**
- * The default port.
- */
- int DEFAULT_PORT = 3306;
-
- /**
- * The default database.
- */
- String DEFAULT_DATABASE = "testdb";
-
- /**
- * The default database user.
- */
- String DEFAULT_USER = "vertx";
-
- /**
- * The default database password.
- */
- String DEFAULT_PASSWORD = "password";
-
- /**
- * The default charset.
- */
- String DEFAULT_CHARSET = "UTF-8";
-
- /**
- * The default timeout for connect.
- */
- long DEFAULT_CONNECT_TIMEOUT = 10000L;
-
- /**
- * The default timeout for tests.
- */
- long DEFAULT_TEST_TIMEOUT = 10000L;
-
-
- /**
- * Create a MySQL client which maintains its own pool.
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @return the client
- */
- static AsyncSQLClient createNonShared(Vertx vertx, JsonObject config) {
- return ClientHelper.getOrCreate(vertx, config, UUID.randomUUID().toString(), true);
- }
-
-
- /**
- * Create a MySQL client which shares its data source with any other MySQL clients created with the same
- * data source name
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @param poolName the pool name
- * @return the client
- */
- static AsyncSQLClient createShared(Vertx vertx, JsonObject config, String poolName) {
- return ClientHelper.getOrCreate(vertx, config, poolName, true);
- }
-
-
- /**
- * Like {@link #createShared(io.vertx.core.Vertx, JsonObject, String)} but with the default pool name
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @return the client
- */
- static AsyncSQLClient createShared(Vertx vertx, JsonObject config) {
- return ClientHelper.getOrCreate(vertx, config, DEFAULT_POOL_NAME, true);
- }
-
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/PostgreSQLClient.java b/src/main/java/io/vertx/ext/asyncsql/PostgreSQLClient.java
deleted file mode 100644
index a8dbecfe..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/PostgreSQLClient.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql;
-
-import io.vertx.codegen.annotations.VertxGen;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.impl.ClientHelper;
-import io.vertx.ext.sql.SQLClient;
-
-import java.util.UUID;
-
-/**
- * Represents an PostgreSQL client
- *
- * @author Joern Bernhardt.
- * @author Tim Fox
- */
-@VertxGen
-public interface PostgreSQLClient extends AsyncSQLClient {
-
- /**
- * The default name used for the PostGreSQL pool.
- */
- String DEFAULT_DS_NAME = "DEFAULT_POSTGRESQL_DS";
-
- /**
- * The default host.
- */
- String DEFAULT_HOST = "localhost";
-
- /**
- * The default port.
- */
- int DEFAULT_PORT = 5432;
-
- /**
- * The default database name.
- */
- String DEFAULT_DATABASE = "testdb";
-
- /**
- * The default database user.
- */
- String DEFAULT_USER = "vertx";
-
- /**
- * The default user password.
- */
- String DEFAULT_PASSWORD = "password";
-
- /**
- * The default charset.
- */
- String DEFAULT_CHARSET = "UTF-8";
-
- /**
- * The default timeout for connect.
- */
- long DEFAULT_CONNECT_TIMEOUT = 10000L;
-
- /**
- * The default timeout for tests.
- */
- long DEFAULT_TEST_TIMEOUT = 10000L;
-
-
- /**
- * Create a PostgreSQL client which maintains its own pool.
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @return the client
- */
- static AsyncSQLClient createNonShared(Vertx vertx, JsonObject config) {
- return ClientHelper.getOrCreate(vertx, config, UUID.randomUUID().toString(), false);
- }
-
- /**
- * Create a PostgreSQL client which shares its pool with any other MySQL clients created with the same pool name.
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @param poolName the pool name
- * @return the client
- */
- static AsyncSQLClient createShared(Vertx vertx, JsonObject config, String poolName) {
- return ClientHelper.getOrCreate(vertx, config, poolName, false);
- }
-
-
- /**
- * Like {@link #createShared(io.vertx.core.Vertx, JsonObject, String)} but with the default pool name
- *
- * @param vertx the Vert.x instance
- * @param config the configuration
- * @return the client
- */
- static AsyncSQLClient createShared(Vertx vertx, JsonObject config) {
- return ClientHelper.getOrCreate(vertx, config, DEFAULT_DS_NAME, false);
- }
-
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLClientImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLClientImpl.java
deleted file mode 100644
index 8bda55e1..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLClientImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Handler;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.AsyncSQLClient;
-import io.vertx.ext.sql.SQLClient;
-import io.vertx.ext.sql.SQLConnection;
-
-/**
- * @author Joern Bernhardt.
- */
-public class AsyncSQLClientImpl implements AsyncSQLClient {
-
- private final BaseSQLClient baseClient;
-
- public AsyncSQLClientImpl(Vertx vertx, JsonObject config, boolean mysql) {
- if (mysql) {
- baseClient = new MYSQLClientImpl(vertx, config);
- } else {
- baseClient = new PostgreSQLClientImpl(vertx, config);
- }
- }
-
- @Override
- public void close() {
- baseClient.close(null);
- }
-
- @Override
- public void close(Handler> completionHandler) {
- baseClient.close(completionHandler);
- }
-
- @Override
- public SQLClient getConnection(Handler> handler) {
- baseClient.getConnection(handler);
- return this;
- }
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLConnectionImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLConnectionImpl.java
deleted file mode 100644
index 1802df30..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLConnectionImpl.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Connection;
-import com.github.mauricio.async.db.QueryResult;
-import com.github.mauricio.async.db.RowData;
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Future;
-import io.vertx.core.Handler;
-import io.vertx.core.json.JsonArray;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.sql.ResultSet;
-import io.vertx.ext.sql.SQLConnection;
-import io.vertx.ext.sql.SQLOptions;
-import io.vertx.ext.sql.SQLRowStream;
-import io.vertx.ext.sql.TransactionIsolation;
-import io.vertx.ext.sql.UpdateResult;
-import scala.Option;
-import scala.concurrent.ExecutionContext;
-import scala.runtime.AbstractFunction1;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Implementation of {@link SQLConnection} using the {@link AsyncConnectionPool}.
- *
- * @author Clement Escoffier
- */
-public abstract class AsyncSQLConnectionImpl implements SQLConnection {
-
- private final ExecutionContext executionContext;
- private volatile boolean inTransaction = false;
- private boolean inAutoCommit = true;
-
- private final Connection connection;
- private final AsyncConnectionPool pool;
-
- public AsyncSQLConnectionImpl(Connection connection, AsyncConnectionPool pool, ExecutionContext executionContext) {
- this.connection = connection;
- this.pool = pool;
- this.executionContext = executionContext;
- }
-
- /**
- * Returns a vendor specific start transaction statement
- */
- protected abstract String getStartTransactionStatement();
-
- @Override
- public SQLConnection call(String sql, Handler> resultHandler) {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection callWithParams(String sql, JsonArray params, JsonArray outputs, Handler> resultHandler) {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection setOptions(SQLOptions options) {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection setAutoCommit(boolean autoCommit, Handler> handler) {
- Future fut;
-
- synchronized (this) {
- if (inTransaction && autoCommit) {
- inTransaction = false;
- fut = ScalaUtils.scalaToVertxVoid(connection.sendQuery("COMMIT"), executionContext);
- } else {
- fut = Future.succeededFuture();
- }
- inAutoCommit = autoCommit;
- }
-
- fut.setHandler(handler);
- return this;
-
- }
-
- @Override
- public SQLConnection execute(String sql, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final scala.concurrent.Future future = connection.sendQuery(sql);
- future.onComplete(ScalaUtils.toFunction1(ar -> {
- if (ar.succeeded()) {
- handler.handle(Future.succeededFuture());
- } else {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- }), executionContext);
- });
-
- return this;
- }
-
- @Override
- public SQLConnection query(String sql, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final Future future = ScalaUtils.scalaToVertx(connection.sendQuery(sql), executionContext);
- future.setHandler(handleAsyncQueryResultToResultSet(handler));
- });
-
- return this;
- }
-
- @Override
- public SQLConnection queryStream(String sql, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final Future future = ScalaUtils.scalaToVertx(connection.sendQuery(sql), executionContext);
- future.setHandler(handleAsyncQueryResultToRowStream(handler));
- });
-
- return this;
- }
-
- @Override
- public SQLConnection queryWithParams(String sql, JsonArray params, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final scala.concurrent.Future future = connection.sendPreparedStatement(sql,
- ScalaUtils.toScalaList(params.getList()));
- future.onComplete(ScalaUtils.toFunction1(handleAsyncQueryResultToResultSet(handler)), executionContext);
- });
-
- return this;
- }
-
- @Override
- public SQLConnection queryStreamWithParams(String sql, JsonArray params, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final Future future = ScalaUtils.scalaToVertx(connection.sendPreparedStatement(sql, ScalaUtils.toScalaList(params.getList())), executionContext);
- future.setHandler(handleAsyncQueryResultToRowStream(handler));
- });
-
- return this;
- }
-
- @Override
- public SQLConnection update(String sql, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final scala.concurrent.Future future = connection.sendQuery(sql);
- future.onComplete(ScalaUtils.toFunction1(handleAsyncUpdateResultToResultSet(handler)), executionContext);
- });
-
- return this;
- }
-
- @Override
- public SQLConnection updateWithParams(String sql, JsonArray params, Handler> handler) {
- beginTransactionIfNeeded(v -> {
- final scala.concurrent.Future future = connection.sendPreparedStatement(sql,
- ScalaUtils.toScalaList(params.getList()));
- future.onComplete(ScalaUtils.toFunction1(handleAsyncUpdateResultToResultSet(handler)), executionContext);
- });
-
- return this;
- }
-
- @Override
- public synchronized void close(Handler> handler) {
- inAutoCommit = true;
- if (inTransaction) {
- inTransaction = false;
- Future future = ScalaUtils.scalaToVertx(connection.sendQuery("COMMIT"), executionContext);
- future.setHandler((v) -> {
- pool.giveBack(connection);
- handler.handle(Future.succeededFuture());
- });
- } else {
- pool.giveBack(connection);
- handler.handle(Future.succeededFuture());
- }
- }
-
- @Override
- public void close() {
- close((ar) -> {
- // Do nothing by default.
- });
- }
-
- @Override
- public SQLConnection commit(Handler> handler) {
- return endAndStartTransaction("COMMIT", handler);
- }
-
- @Override
- public SQLConnection rollback(Handler> handler) {
- return endAndStartTransaction("ROLLBACK", handler);
- }
-
- @Override
- public SQLConnection setTransactionIsolation(TransactionIsolation transactionIsolation, Handler> handler) {
- String sql;
- switch (transactionIsolation) {
- case READ_UNCOMMITTED:
- sql = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
- break;
- case REPEATABLE_READ:
- sql = "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ";
- break;
- case READ_COMMITTED:
- sql = "SET TRANSACTION ISOLATION LEVEL READ COMMITTED";
- break;
- case SERIALIZABLE:
- sql = "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE";
- break;
- case NONE:
- default:
- sql = null;
- break;
- }
-
- if (sql == null) {
- handler.handle(Future.succeededFuture());
- return this;
- }
-
- return execute(sql, handler);
- }
-
- @Override
- public SQLConnection getTransactionIsolation(Handler> handler) {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection batch(List sqlStatements, Handler>> handler) {
- // This should be simple in postgres, since it is just append the query separator after each query and send as a big
- // sql statement, however it does not seem to work on mysql
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection batchWithParams(String sqlStatement, List args, Handler>> handler) {
- // This should be simple in postgres, since it is just append the query separator after each query and send as a big
- // sql statement, however it does not seem to work on mysql
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- public SQLConnection batchCallableWithParams(String sqlStatement, List inArgs, List outArgs, Handler>> handler) {
- // No idea how to implement this
- throw new UnsupportedOperationException("Not implemented");
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public C unwrap() {
- return (C) connection;
- }
-
- private SQLConnection endAndStartTransaction(String command, Handler> handler) {
- if (inTransaction) {
- inTransaction = false;
- ScalaUtils.scalaToVertx(connection.sendQuery(command), executionContext).setHandler(
- ar -> {
- if (ar.failed()) {
- handler.handle(Future.failedFuture(ar.cause()));
- } else {
- ScalaUtils.scalaToVertx(connection.sendQuery("BEGIN"), executionContext).setHandler(
- ar2 -> {
- if (ar2.failed()) {
- handler.handle(Future.failedFuture(ar.cause()));
- } else {
- inTransaction = true;
- handler.handle(Future.succeededFuture());
- }
- }
- );
- }
- });
- } else {
- handler.handle(Future.failedFuture(
- new IllegalStateException("Not in transaction currently")));
- }
- return this;
- }
-
- private synchronized void beginTransactionIfNeeded(Handler> action) {
- if (!inAutoCommit && !inTransaction) {
- inTransaction = true;
- ScalaUtils.scalaToVertxVoid(connection.sendQuery(getStartTransactionStatement()), executionContext)
- .setHandler(action);
- } else {
- action.handle(Future.succeededFuture());
- }
- }
-
- private Handler> handleAsyncQueryResultToResultSet(Handler> handler) {
- return ar -> {
- if (ar.succeeded()) {
- ResultSet result;
- try {
- result = queryResultToResultSet(ar.result());
- } catch (Throwable e) {
- handler.handle(Future.failedFuture(e));
- return;
- }
- handler.handle(Future.succeededFuture(result));
- } else {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- };
- }
-
- private Handler> handleAsyncQueryResultToRowStream(Handler> handler) {
- return ar -> {
- if (ar.succeeded()) {
- AsyncSQLRowStream rowStream;
- try {
- rowStream = new AsyncSQLRowStream(ar.result());
- } catch (Throwable e) {
- handler.handle(Future.failedFuture(e));
- return;
- }
- handler.handle(Future.succeededFuture(rowStream));
- } else {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- };
- }
-
- private ResultSet queryResultToResultSet(QueryResult qr) {
- final Option rows = qr.rows();
- if (!rows.isDefined()) {
- return new ResultSet(Collections.emptyList(), Collections.emptyList(), null);
- } else {
- final List names = ScalaUtils.toJavaList(rows.get().columnNames().toList());
- final List arrays = rowDataSeqToJsonArray(rows.get());
- return new ResultSet(names, arrays, null);
- }
- }
-
- private Handler> handleAsyncUpdateResultToResultSet(Handler> handler) {
- return ar -> {
- if (ar.succeeded()) {
- UpdateResult result;
- try {
- result = queryResultToUpdateResult(ar.result());
- } catch (Throwable e) {
- handler.handle(Future.failedFuture(e));
- return;
- }
- handler.handle(Future.succeededFuture(result));
- } else {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- };
- }
-
- protected UpdateResult queryResultToUpdateResult(QueryResult qr) {
- int affected = (int) qr.rowsAffected();
- return new UpdateResult(affected, new JsonArray());
- }
-
- private List rowDataSeqToJsonArray(com.github.mauricio.async.db.ResultSet set) {
- List list = new ArrayList<>();
- set.foreach(new AbstractFunction1() {
- @Override
- public Void apply(RowData row) {
- list.add(ScalaUtils.rowToJsonArray(row));
- return null;
- }
- });
- return list;
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLRowStream.java b/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLRowStream.java
deleted file mode 100644
index 04962a11..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/AsyncSQLRowStream.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.QueryResult;
-import com.github.mauricio.async.db.ResultSet;
-import com.github.mauricio.async.db.RowData;
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Future;
-import io.vertx.core.Handler;
-import io.vertx.core.json.JsonArray;
-import io.vertx.ext.sql.SQLRowStream;
-import scala.Option;
-import scala.collection.Iterator;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-class AsyncSQLRowStream implements SQLRowStream {
-
- private final ResultSet rs;
- private final Iterator cursor;
- private List columns;
-
- private long demand = 0L;
- private final AtomicBoolean ended = new AtomicBoolean(false);
-
- private Handler handler;
- private Handler endHandler;
- private Handler rsClosedHandler;
-
- AsyncSQLRowStream(QueryResult qr) {
- final Option rows = qr.rows();
- if (rows.isDefined()) {
- rs = rows.get();
- cursor = rs.iterator();
- } else {
- rs = null;
- cursor = null;
- }
- }
-
- @Override
- public int column(String name) {
- if (rs == null) {
- throw new IndexOutOfBoundsException("'" + name + "' not found");
- }
-
- // the columns value will be cached
- return columns().indexOf(name);
- }
-
- @Override
- public List columns() {
- // populate the cache
- if (columns == null) {
- // quick escape
- if (rs == null) {
- return Collections.emptyList();
- }
- // this list is always read only
- columns = Collections.unmodifiableList(ScalaUtils.toJavaList(rs.columnNames().toList()));
- }
- return columns;
- }
-
- @Override
- public SQLRowStream exceptionHandler(Handler handler) {
- return this;
- }
-
- @Override
- public SQLRowStream handler(Handler handler) {
- this.handler = handler;
- // start pumping data once the handler is set
- resume();
- return this;
- }
-
- @Override
- public SQLRowStream pause() {
- demand = 0L;
- return this;
- }
-
- @Override
- public synchronized SQLRowStream fetch(long amount) {
- if (amount > 0L) {
- if ((demand += amount) < 0L) {
- demand = Long.MAX_VALUE;
- }
- nextRow();
- }
- return this;
- }
-
- @Override
- public SQLRowStream resume() {
- return fetch(Long.MAX_VALUE);
- }
-
- private void nextRow() {
- while (demand > 0L) {
- if (cursor.hasNext()) {
- if (demand != Long.MAX_VALUE) {
- demand--;
- }
- handler.handle(ScalaUtils.rowToJsonArray(cursor.next()));
- } else {
- // mark as ended if the handler was registered too late
- ended.set(true);
- // automatically close resources
- if (rsClosedHandler != null) {
- // only notify (since the rs is closed by the underlying driver)
- rsClosedHandler.handle(null);
- } else {
- // default behavior notify that everything ended
- close(c -> {
- if (endHandler != null) {
- endHandler.handle(null);
- }
- });
- }
- break;
- }
- }
- }
-
- @Override
- public SQLRowStream endHandler(Handler handler) {
- this.endHandler = handler;
- // registration was late but we're already ended, notify
- if (ended.compareAndSet(true, false)) {
- // only notify once
- endHandler.handle(null);
- }
- return this;
- }
-
- @Override
- public SQLRowStream resultSetClosedHandler(Handler handler) {
- this.rsClosedHandler = handler;
- // registration was late but we're already ended, notify
- if (ended.compareAndSet(true, false)) {
- // only notify once
- rsClosedHandler.handle(null);
- }
- return this;
- }
-
- @Override
- public void moreResults() {
- // NO-OP since the underlying driver only returns 1 ResultSet
- }
-
- @Override
- public void close() {
- close(null);
- }
-
- @Override
- public void close(Handler> handler) {
- // make sure we stop pumping data
- pause();
- // call the provided handler
- if (handler != null) {
- handler.handle(Future.succeededFuture());
- }
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java b/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java
deleted file mode 100644
index 33bc0e19..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/BaseSQLClient.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Configuration;
-import com.github.mauricio.async.db.Connection;
-import com.github.mauricio.async.db.SSLConfiguration;
-import io.netty.buffer.PooledByteBufAllocator;
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Future;
-import io.vertx.core.Handler;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.core.logging.Logger;
-import io.vertx.core.logging.LoggerFactory;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.sql.SQLConnection;
-import scala.Option;
-import scala.Tuple2;
-import scala.collection.Map$;
-import scala.collection.immutable.Map;
-import scala.concurrent.ExecutionContext;
-import scala.concurrent.duration.Duration;
-
-import java.nio.charset.Charset;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Base class for the SQL client.
- *
- * @author Clement Escoffier
- */
-public abstract class BaseSQLClient {
-
- protected final Logger log = LoggerFactory.getLogger(this.getClass());
- protected final Vertx vertx;
-
- protected final JsonObject globalConfig;
-
- public BaseSQLClient(Vertx vertx, JsonObject globalConfig) {
- this.vertx = vertx;
- this.globalConfig = globalConfig;
- }
-
- protected abstract AsyncConnectionPool pool();
-
- protected abstract SQLConnection createFromPool(Connection conn, AsyncConnectionPool pool, ExecutionContext ec);
-
- public void getConnection(Handler> handler) {
- pool().take(ar -> {
- if (ar.succeeded()) {
- final AsyncConnectionPool pool = pool();
- ExecutionContext ec = VertxEventLoopExecutionContext.create(vertx);
- handler.handle(Future.succeededFuture(createFromPool(ar.result(), pool, ec)));
- } else {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- });
- }
-
- public void close(Handler> handler) {
- log.info("Stopping async SQL client " + this);
- pool().close(ar -> {
- if (ar.succeeded()) {
- if (handler != null) {
- handler.handle(Future.succeededFuture());
- }
- } else {
- if (handler != null) {
- handler.handle(Future.failedFuture(ar.cause()));
- }
- }
- }
- );
- }
-
- public void close() {
- close(null);
- }
-
- protected Configuration getConnectionConfiguration(
- String defaultHost,
- int defaultPort,
- String defaultDatabase,
- String defaultUser,
- String defaultPassword,
- String defaultCharset,
- long defaultConnectTimeout,
- long defaultTestTimeout,
- JsonObject config) {
-
- String host = config.getString("host", defaultHost);
- int port = config.getInteger("port", defaultPort);
- String username = config.getString("username", defaultUser);
- String password = config.getString("password", defaultPassword);
- String database = config.getString("database", defaultDatabase);
- Charset charset = Charset.forName(config.getString("charset", defaultCharset));
- long connectTimeout = config.getLong("connectTimeout", defaultConnectTimeout);
- long testTimeout = config.getLong("testTimeout", defaultTestTimeout);
- Long queryTimeout = config.getLong("queryTimeout");
- Option queryTimeoutOption = (queryTimeout == null) ?
- Option.empty() : Option.apply(Duration.apply(queryTimeout, TimeUnit.MILLISECONDS));
-
- Map sslConfig = buildSslConfig(config);
-
- log.info("Creating configuration for " + host + ":" + port);
- return new Configuration(
- username,
- host,
- port,
- Option.apply(password),
- Option.apply(database),
- SSLConfiguration.apply(sslConfig),
- charset,
- 16777216,
- PooledByteBufAllocator.DEFAULT,
- Duration.apply(connectTimeout, TimeUnit.MILLISECONDS),
- Duration.apply(testTimeout, TimeUnit.MILLISECONDS),
- queryTimeoutOption);
- }
-
- private Map buildSslConfig(JsonObject config) {
- Map sslConfig = Map$.MODULE$.empty();
- if (config.getString("sslMode")!= null) {
- sslConfig = sslConfig.$plus(Tuple2.apply("sslmode", config.getString("sslMode")));
- }
- if (config.getString("sslRootCert") != null) {
- sslConfig = sslConfig.$plus(Tuple2.apply("sslrootcert", config.getString("sslRootCert")));
- }
- return sslConfig;
- }
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/ClientHelper.java b/src/main/java/io/vertx/ext/asyncsql/impl/ClientHelper.java
deleted file mode 100644
index bcde0c59..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/ClientHelper.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.core.shareddata.LocalMap;
-import io.vertx.ext.asyncsql.AsyncSQLClient;
-import io.vertx.ext.sql.SQLClient;
-
-
-/**
- * This class handles sharing the client instances by using a local shared map.
- *
- * @author Tim Fox
- */
-public class ClientHelper {
-
- private static final String DS_LOCAL_MAP_NAME_BASE = "__vertx.MySQLPostgreSQL.pools.";
-
- public static AsyncSQLClient getOrCreate(Vertx vertx, JsonObject config, String poolName, boolean
- mySQL) {
- synchronized (vertx) {
- LocalMap map = vertx.sharedData().getLocalMap(
- DS_LOCAL_MAP_NAME_BASE + (mySQL ? "MySQL" : "PostgreSQL"));
-
- ClientHolder theHolder = map.get(poolName);
- if (theHolder == null) {
- theHolder = new ClientHolder(vertx, config, mySQL, () -> removeFromMap(vertx, map, poolName));
- map.put(poolName, theHolder);
- } else {
- theHolder.incRefCount();
- }
- return new ClientWrapper(theHolder);
- }
- }
-
- private static void removeFromMap(Vertx vertx, LocalMap map, String poolName) {
- synchronized (vertx) {
- map.remove(poolName);
- if (map.isEmpty()) {
- map.close();
- }
- }
- }
-
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/ClientHolder.java b/src/main/java/io/vertx/ext/asyncsql/impl/ClientHolder.java
deleted file mode 100644
index 8ca966a5..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/ClientHolder.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Handler;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.core.shareddata.Shareable;
-import io.vertx.ext.asyncsql.AsyncSQLClient;
-
-/**
- * @author Tim Fox
- */
-class ClientHolder implements Shareable {
-
- private final Vertx vertx;
- private final JsonObject config;
- private final boolean mySQL;
- private final Runnable closeRunner;
-
- private AsyncSQLClient client;
- private int refCount = 1;
-
- ClientHolder(Vertx vertx, JsonObject config, boolean mySQL, Runnable closeRunner) {
- this.vertx = vertx;
- this.config = config;
- this.mySQL = mySQL;
- this.closeRunner = closeRunner;
- }
-
- synchronized AsyncSQLClient client() {
- if (client == null) {
- client = new AsyncSQLClientImpl(vertx, config, mySQL);
- }
- return client;
- }
-
- synchronized void incRefCount() {
- refCount++;
- }
-
- synchronized void close(Handler> whenDone) {
- if (--refCount == 0) {
- if (client != null) {
- client.close(whenDone);
- }
- if (closeRunner != null) {
- closeRunner.run();
- }
- }
- }
-}
-
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/ClientWrapper.java b/src/main/java/io/vertx/ext/asyncsql/impl/ClientWrapper.java
deleted file mode 100644
index 8e396c89..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/ClientWrapper.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Handler;
-import io.vertx.ext.asyncsql.AsyncSQLClient;
-import io.vertx.ext.sql.SQLClient;
-import io.vertx.ext.sql.SQLConnection;
-
-/**
- * Wraps a client with the {@link ClientHolder} in order to keep track of the references.
- *
- * @author Tim Fox
- */
-public class ClientWrapper implements AsyncSQLClient {
-
- private final ClientHolder holder;
- private final AsyncSQLClient client;
-
- public ClientWrapper(ClientHolder holder) {
- this.holder = holder;
- this.client = holder.client();
- }
-
- @Override
- public void close(Handler> whenDone) {
- holder.close(whenDone);
- }
-
- @Override
- public void close() {
- holder.close(null);
- }
-
- @Override
- public SQLClient getConnection(Handler> handler) {
- return client.getConnection(handler);
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/MYSQLClientImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/MYSQLClientImpl.java
deleted file mode 100644
index 1a104a91..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/MYSQLClientImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Connection;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.MySQLClient;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.asyncsql.impl.pool.MysqlAsyncConnectionPool;
-import io.vertx.ext.sql.SQLConnection;
-import scala.concurrent.ExecutionContext;
-
-/**
- * Implementation of the {@link BaseSQLClient} for MYSQL.
- *
- * @author Clement Escoffier
- */
-public class MYSQLClientImpl extends BaseSQLClient {
-
- private final MysqlAsyncConnectionPool pool;
-
- public MYSQLClientImpl(Vertx vertx, JsonObject globalConfig) {
- super(vertx, globalConfig);
- pool = new MysqlAsyncConnectionPool(vertx, globalConfig, getConnectionConfiguration(
- MySQLClient.DEFAULT_HOST,
- MySQLClient.DEFAULT_PORT,
- MySQLClient.DEFAULT_DATABASE,
- MySQLClient.DEFAULT_USER,
- MySQLClient.DEFAULT_PASSWORD,
- MySQLClient.DEFAULT_CHARSET,
- MySQLClient.DEFAULT_CONNECT_TIMEOUT,
- MySQLClient.DEFAULT_TEST_TIMEOUT,
- globalConfig));
- }
-
- @Override
- protected AsyncConnectionPool pool() {
- return pool;
- }
-
- @Override
- protected SQLConnection createFromPool(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
- return new MySQLConnectionImpl(conn, pool, ec);
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/MySQLConnectionImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/MySQLConnectionImpl.java
deleted file mode 100644
index 8362ef6e..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/MySQLConnectionImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Connection;
-import com.github.mauricio.async.db.QueryResult;
-import com.github.mauricio.async.db.mysql.MySQLQueryResult;
-import io.vertx.core.json.JsonArray;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.sql.UpdateResult;
-import scala.concurrent.ExecutionContext;
-
-/**
- * @author Joern Bernhardt.
- */
-public class MySQLConnectionImpl extends AsyncSQLConnectionImpl {
- public MySQLConnectionImpl(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
- super(conn, pool, ec);
- }
-
- @Override
- protected String getStartTransactionStatement() {
- return "BEGIN";
- }
-
- @Override
- protected UpdateResult queryResultToUpdateResult(QueryResult qr) {
- int affected = (int)qr.rowsAffected();
- MySQLQueryResult mySQLQueryResult = (MySQLQueryResult) qr;
- return new UpdateResult(affected, new JsonArray().add(mySQLQueryResult.lastInsertId()));
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLClientImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLClientImpl.java
deleted file mode 100644
index f5a0b04e..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLClientImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Connection;
-import io.vertx.core.Vertx;
-import io.vertx.core.json.JsonObject;
-import io.vertx.ext.asyncsql.PostgreSQLClient;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.asyncsql.impl.pool.PostgresqlAsyncConnectionPool;
-import io.vertx.ext.sql.SQLConnection;
-import scala.concurrent.ExecutionContext;
-
-/**
- * Implementation of the {@link BaseSQLClient} for PostGreSQL.
- *
- * @author Clement Escoffier
- */
-public class PostgreSQLClientImpl extends BaseSQLClient {
-
- private final PostgresqlAsyncConnectionPool pool;
-
- public PostgreSQLClientImpl(Vertx vertx, JsonObject globalConfig) {
- super(vertx, globalConfig);
- pool = new PostgresqlAsyncConnectionPool(vertx, globalConfig, getConnectionConfiguration(
- PostgreSQLClient.DEFAULT_HOST,
- PostgreSQLClient.DEFAULT_PORT,
- PostgreSQLClient.DEFAULT_DATABASE,
- PostgreSQLClient.DEFAULT_USER,
- PostgreSQLClient.DEFAULT_PASSWORD,
- PostgreSQLClient.DEFAULT_CHARSET,
- PostgreSQLClient.DEFAULT_CONNECT_TIMEOUT,
- PostgreSQLClient.DEFAULT_TEST_TIMEOUT,
- globalConfig));
- }
-
- @Override
- protected AsyncConnectionPool pool() {
- return pool;
- }
-
- @Override
- protected SQLConnection createFromPool(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
- return new PostgreSQLConnectionImpl(conn, pool, ec);
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLConnectionImpl.java b/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLConnectionImpl.java
deleted file mode 100644
index ee0c5242..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/PostgreSQLConnectionImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.Connection;
-import com.github.mauricio.async.db.QueryResult;
-import io.vertx.core.json.JsonArray;
-import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
-import io.vertx.ext.sql.UpdateResult;
-import scala.concurrent.ExecutionContext;
-
-/**
- * @author Paulo Lopes.
- */
-public class PostgreSQLConnectionImpl extends AsyncSQLConnectionImpl {
- public PostgreSQLConnectionImpl(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
- super(conn, pool, ec);
- }
-
- @Override
- protected String getStartTransactionStatement() {
- // TODO: consider the tx isolation level
- return "BEGIN";
- }
-
- @Override
- protected UpdateResult queryResultToUpdateResult(QueryResult qr) {
- int affected = (int) qr.rowsAffected();
- return new UpdateResult(affected, new JsonArray());
- }
-}
diff --git a/src/main/java/io/vertx/ext/asyncsql/impl/ScalaUtils.java b/src/main/java/io/vertx/ext/asyncsql/impl/ScalaUtils.java
deleted file mode 100644
index 53f8cbab..00000000
--- a/src/main/java/io/vertx/ext/asyncsql/impl/ScalaUtils.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2015 Red Hat, Inc.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Apache License v2.0 which accompanies this distribution.
- *
- * The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * The Apache License v2.0 is available at
- * http://www.opensource.org/licenses/apache2.0.php
- *
- * You may elect to redistribute this code under either of these licenses.
- */
-
-package io.vertx.ext.asyncsql.impl;
-
-import com.github.mauricio.async.db.RowData;
-import io.vertx.core.AsyncResult;
-import io.vertx.core.Future;
-import io.vertx.core.Handler;
-import io.vertx.core.json.JsonArray;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-import org.joda.time.LocalTime;
-import scala.Function1;
-import scala.collection.immutable.List;
-import scala.concurrent.ExecutionContext;
-import scala.concurrent.duration.FiniteDuration;
-import scala.runtime.AbstractFunction1;
-import scala.util.Try;
-
-import java.time.Instant;
-import java.util.UUID;
-
-/**
- * Some Scala <=> Java conversion utilities.
- *
- * @author Clement Escoffier
- */
-public final class ScalaUtils {
-
- private ScalaUtils () {}
-
- public static Future scalaToVertx(scala.concurrent.Future future, ExecutionContext ec) {
- Future fut = Future.future();
- future.onComplete(new AbstractFunction1, Void>() {
- @Override
- public Void apply(Try v1) {
- if (v1.isSuccess()) {
- fut.complete(v1.get());
- } else {
- fut.fail(v1.failed().get());
- }
- return null;
- }
- }, ec);
- return fut;
- }
-
- public static Future scalaToVertxVoid(scala.concurrent.Future future, ExecutionContext ec) {
- Future fut = Future.future();
- future.onComplete(new AbstractFunction1, Void>() {
- @Override
- public Void apply(Try v1) {
- if (v1.isSuccess()) {
- fut.complete();
- } else {
- fut.fail(v1.failed().get());
- }
- return null;
- }
- }, ec);
- return fut;
- }
-
-
- public static java.util.List toJavaList(List list) {
- return scala.collection.JavaConversions.bufferAsJavaList(list.toBuffer());
- }
-
- public static List toScalaList(java.util.List list) {
- return scala.collection.JavaConversions.asScalaBuffer(list).toList();
- }
-
- public static Function1, Void> toFunction1(Handler> code) {
- return new AbstractFunction1, Void>() {
- @Override
- public Void apply(Try v1) {
- if (v1.isSuccess()) {
- code.handle(Future.succeededFuture(v1.get()));
- } else {
- code.handle(Future.failedFuture(v1.failed().get()));
- }
- return null;
- }
- };
- }
-
- public static JsonArray rowToJsonArray(RowData data) {
- JsonArray array = new JsonArray();
- data.foreach(new AbstractFunction1