GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mintUI9976/AsyncMySQLPoolHandler: An simplify library to create jdbc pools via HikariCP. The Statement/PreparedStatement methods are performed asynchronously

BranchesTags
Open more actions menu

Latest commit

 

History

56 Commits
56 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

AsyncMySQLPoolHandler

forthebadge forthebadge forthebadge

GitHub release GitHub stars

An simplify library to create jdbc pools via HikariCP.

Statement/PreparedStatement methods are performed asynchronously.

Features

  • full asynchronously statement/preparedStatement methods
  • simple jdbc connector
  • simple configurator
  • default config available
  • instant query result via preparedStatement
  • multiple object update via preparedStatement
  • single update via statement
  • add selection PublicKeyRetrival

Implemented JDBC Frameworks

HikariCP

Repository

<repositories>
    <repository>
        <id>gitlab-maven</id>
        <url>https://gitlab.zyonicsoftware.com/api/v4/projects/211/packages/maven</url>
    </repository>
</repositories>

<distributionManagement>
<repository>
    <id>gitlab-maven</id>
    <url>https://gitlab.zyonicsoftware.com/api/v4/projects/211/packages/maven</url>
</repository>

<snapshotRepository>
    <id>gitlab-maven</id>
    <url>https://gitlab.zyonicsoftware.com/api/v4/projects/211/packages/maven</url>
</snapshotRepository>
</distributionManagement>

Dependency

<dependency>
    <groupId>de.mint.asyncmysqlpoolhandler</groupId>
    <artifactId>AsyncMySQLPoolHandler</artifactId>
    <version>Tag@Gitlab</version>
</dependency>

Utilization

Initialized AsyncMySQLPoolHandler Object

private final AsyncMySQLPoolHandler asyncMySQLPoolHandler=new AsyncMySQLPoolHandler(hostname,username,password,enumPoolFramework,configPoolFramework);
private final AsyncMySQLPoolHandler asyncMySQLPoolHandler=new AsyncMySQLPoolHandler(hostname,port,username,password,enumPoolFramework,configPoolFramework);
private final AsyncMySQLPoolHandler asyncMySQLPoolHandler=new AsyncMySQLPoolHandler(hostname,username,password,database,enumPoolFramework,configPoolFramework);
private final AsyncMySQLPoolHandler asyncMySQLPoolHandler=new AsyncMySQLPoolHandler(hostname,port,username,password,database,enumPoolFramework,configPoolFramework);

ConfigPoolFramework

private final ConfigPoolFramework configPoolFramework=ConfigBuilder.getConfigBuilder().build(); // returns a default configuration
// You do not have to change all values, the remaining values are filled with default values.

OpenPool:

private void openPool(){
        if(this.asyncMySQLPoolHandler.openPool()){
        //successful
        }else{
        //failed
        }
        }

ClosePool:

private void closePool(){
        if(this.asyncMySQLPoolHandler.closePool()){
        //successful
        }else{
        //failed
        }
        }

ExecuteQuery:

private void testQuery(){
        this.asyncMySQLPoolHandler.executeQueryAsync("SELECT * FROM `"+"yourTable"+"`;").whenComplete((cachedRowSet,throwable)->{
        try{
final Collection<String> collection=new ArrayList<>();
        while(cachedRowSet.next()){
        collection.add(cachedRowSet.getString(1));
        }
        // now you can work with the cachedRowSet
        cachedRowSet.close();
        }catch(final SQLException exception){
        exception.printStackTrace();
        }
        });
        }

ReturnExecuteQuery:

ExecuteQueryAsync:
public int testQueryResult(final String value){
        try{
final CachedRowSet resultSet=this.asyncMySQLPoolHandler.executeQueryAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';").join();
        if(resultSet.last()){
final int test=resultSet.getInt("yourColumn");
        resultSet.close();
        // return your async request result
        return test;
        }else{
        resultSet.close();
        // return a custom result if your request has failed
        return-1;
        }
        }catch(final SQLException exception){
        exception.printStackTrace();
        }
        return-1;
        }
ExecuteQueryInstantLastResultAsync:
public int test(final String value){
final Integer result=(Integer)this.asyncMySQLPoolHandler.executeQueryInstantLastResultAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
        return result!=null?result:-1;
        }
ExecuteQueryInstantFirstResultAsync:
public int test(final String value){
final Integer result=(Integer)this.asyncMySQLPoolHandler.executeQueryInstantFirstResultAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
        return result!=null?result:-1;
        }
ExecuteQueryInstantLastResultAsBooleanAsync:
public boolean test(final String value){
        return this.asyncMySQLPoolHandler.executeQueryInstantLastResultAsBooleanAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
        }
ExecuteQueryInstantFirstResultAsBooleanAsync:
public boolean test(final String value){
        return this.asyncMySQLPoolHandler.executeQueryInstantFirstResultAsBooleanAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
        }
ExecuteQueryInstantNextResultAsync:
public boolean test(final String value){
        return this.asyncMySQLPoolHandler.executeQueryInstantNextResultAsync("SELECT * FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';").join();
        }

ExecuteUpdate with Statement:

  private void testUpdate(final String yourValue){
        this.asyncMySQLPoolHandler.executeUpdateAsync("INSERT INTO `"+"yourTable"+"` SET `yourColumn` = '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(yourValue)+"';").whenComplete((aVoid,throwable)->{
        //now you can work with the result
        });
        }

ExecuteUpdate with PreparedStatement:

  private void testUpdate(final String...value){
        this.asyncMySQLPoolHandler.executeUpdatePreparedStatementAsync("INSERT INTO `"+"yourTable"+"` (value1, value2, value3, value4) VALUES (?, ?, ?, ?)",value1,value2,value3,value4).whenComplete((aVoid,throwable)->{
        //now you can work with the result
        });
        }

About

An simplify library to create jdbc pools via HikariCP. The Statement/PreparedStatement methods are performed asynchronously

Topics

asychronousasyncasync-functionsasynchronous-programmingasynchronous-taskshikari-connection-poolhikari-datasourcehikaricpjdbcjdbc-connectorjdbc-databasepoolpool-allocatorpool-managerpooling

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.