-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
44 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 6 additions & 15 deletions
21
src/main/java/io/github/areebgillani/db/mssql/MSSQLConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
src/main/java/io/github/areebgillani/db/mysql/MySQLConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 3 additions & 12 deletions
15
src/main/java/io/github/areebgillani/db/oracle/OracleConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 3 additions & 12 deletions
15
src/main/java/io/github/areebgillani/db/postgres/PostgresConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/io/github/areebgillani/db/utils/AbstractSQLConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.areebgillani.db.utils; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
import io.vertx.sqlclient.Pool; | ||
import io.vertx.sqlclient.PoolOptions; | ||
import io.vertx.sqlclient.SqlConnectOptions; | ||
|
||
public abstract class AbstractSQLConnection <T extends SqlConnectOptions> extends AbstractConnection <T, Pool>{ | ||
protected DatabaseConfig config; | ||
public AbstractSQLConnection(JsonObject config) { | ||
this.config = DatabaseConfig.getInstance(config); | ||
this.poolOptions = getPoolOptions(this.config.DB_POOL_SIZE); | ||
this.client = getSQLPool(); | ||
} | ||
|
||
@Override | ||
protected Pool getSQLPool() { | ||
return this.client == null ? Pool.pool(vertx, connectionOptions, poolOptions) : this.client; | ||
} | ||
@Override | ||
protected PoolOptions getPoolOptions(int poolSize) { | ||
return this.poolOptions == null ? new PoolOptions().setMaxSize(poolSize) : poolOptions; | ||
} | ||
|
||
protected abstract T getConnectionOption(); | ||
} |