io.github.sinri.keel.mysql.statement.AnyStatement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Keel Show documentation
Show all versions of Keel Show documentation
A website framework with VERT.X for ex-PHP-ers, exactly Ark Framework Users.
The newest version!
package io.github.sinri.keel.mysql.statement;
import io.github.sinri.keel.mysql.NamedMySQLConnection;
import io.github.sinri.keel.mysql.matrix.ResultMatrix;
import io.github.sinri.keel.mysql.statement.templated.TemplateArgumentMapping;
import io.github.sinri.keel.mysql.statement.templated.TemplatedModifyStatement;
import io.github.sinri.keel.mysql.statement.templated.TemplatedReadStatement;
import io.github.sinri.keel.mysql.statement.templated.TemplatedStatement;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.sqlclient.SqlConnection;
import javax.annotation.Nonnull;
/**
* @since 3.0.9
*/
public interface AnyStatement {
/**
* @since 3.0.9
*/
static AbstractStatement raw(@Nonnull String sql) {
return new AbstractStatement() {
@Override
public String toString() {
return sql;
}
};
}
static SelectStatement select(@Nonnull Handler statementHandler) {
SelectStatement selectStatement = new SelectStatement();
statementHandler.handle(selectStatement);
return selectStatement;
}
static UnionStatement union(@Nonnull Handler unionStatementHandler) {
UnionStatement unionStatement = new UnionStatement();
unionStatementHandler.handle(unionStatement);
return unionStatement;
}
static UpdateStatement update(@Nonnull Handler updateStatementHandler) {
UpdateStatement updateStatement = new UpdateStatement();
updateStatementHandler.handle(updateStatement);
return updateStatement;
}
static DeleteStatement delete(@Nonnull Handler deleteStatementHandler) {
DeleteStatement deleteStatement = new DeleteStatement();
deleteStatementHandler.handle(deleteStatement);
return deleteStatement;
}
static WriteIntoStatement insert(Handler statementHandler) {
WriteIntoStatement writeIntoStatement = new WriteIntoStatement(WriteIntoStatement.INSERT);
statementHandler.handle(writeIntoStatement);
return writeIntoStatement;
}
static WriteIntoStatement replace(@Nonnull Handler statementHandler) {
WriteIntoStatement writeIntoStatement = new WriteIntoStatement(WriteIntoStatement.REPLACE);
statementHandler.handle(writeIntoStatement);
return writeIntoStatement;
}
/**
* @since 3.2.19
*/
static CallStatement call(@Nonnull Handler statementHandler) {
CallStatement callStatement = new CallStatement();
statementHandler.handle(callStatement);
return callStatement;
}
static TemplatedReadStatement templatedRead(@Nonnull String path, @Nonnull Handler templatedReadStatementHandler) {
TemplatedReadStatement readStatement = TemplatedStatement.loadTemplateToRead(path);
TemplateArgumentMapping arguments = readStatement.getArguments();
templatedReadStatementHandler.handle(arguments);
return readStatement;
}
static TemplatedModifyStatement templatedModify(@Nonnull String path, @Nonnull Handler templatedModifyStatementHandler) {
TemplatedModifyStatement templatedModifyStatement = TemplatedStatement.loadTemplateToModify(path);
TemplateArgumentMapping arguments = templatedModifyStatement.getArguments();
templatedModifyStatementHandler.handle(arguments);
return templatedModifyStatement;
}
/**
* @return The SQL Generated
*/
String toString();
Future execute(@Nonnull SqlConnection sqlConnection);
/**
* @since 3.0.11
* @since 3.0.18 Finished Technical Preview.
*/
default Future execute(@Nonnull NamedMySQLConnection namedSqlConnection) {
return execute(namedSqlConnection.getSqlConnection());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy