- 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
<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>
<groupId>de.mint.asyncmysqlpoolhandler</groupId>
<artifactId>AsyncMySQLPoolHandler</artifactId>
<version>Tag@Gitlab</version>
</dependency>
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);
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.
private void openPool(){
if(this.asyncMySQLPoolHandler.openPool()){
//successful
}else{
//failed
}
}
private void closePool(){
if(this.asyncMySQLPoolHandler.closePool()){
//successful
}else{
//failed
}
}
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();
}
});
}
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;
}
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;
}
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;
}
public boolean test(final String value){
return this.asyncMySQLPoolHandler.executeQueryInstantLastResultAsBooleanAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
}
public boolean test(final String value){
return this.asyncMySQLPoolHandler.executeQueryInstantFirstResultAsBooleanAsync("SELECT `yourColumn` FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';","yourColumn").join();
}
public boolean test(final String value){
return this.asyncMySQLPoolHandler.executeQueryInstantNextResultAsync("SELECT * FROM `"+"yourTable"+"` WHERE `yourValue`= '"+this.asyncMySQLPoolHandler.removeSQLInjectionPossibility(value)+"';").join();
}
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
});
}
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
});
}