public Session create(String sessionName) { return new Session(dialect, keyGenerator, connectionProvider, sessionName); }
public <T> List<T> executeQuery(ObjectMapper<T> objectMapper) { return session.executeQuery(build(), objectMapper); } }
public Optional<Long> queryForOptionalLong() { return session.executeQueryForOptionalLong(build()); }
Optional<BigDecimal> executeQueryForOptionalBigDecimal(Select select) { PreparedStatementExecutor executor = getOrCreatePreparedStatement(select); return executor.executeQueryForOptionalBigDecimal(select); }
@Override public long getKeyFromLastInsert(Session session) { return session.executeQueryForLong(new Select("last autoincrementDefinition id", autoincrementDefinition.lastInsertedAutoincrement())); }
void executeInsert(String queryName, List<Parameter> parameters, String tableName, String primaryKeyFieldName, String sequenceName) { Validate.argumentsAreNotNull(queryName, parameters, tableName); if (dialect.supportsSequences() && sequenceName != null) { long newId = keyGenerator.generateKey(sequenceName, this); Insert insertQuery = new Insert( queryName, Lists.add(parameters, new Parameter.LongParameter(primaryKeyFieldName, newId)), tableName); execute(insertQuery); } else { Insert insertQuery = new Insert(queryName, parameters, tableName); execute(insertQuery); } }
public void execute() { session.executeInsert(getQueryName(), getParameters(), tableName, primaryKeyFieldName, sequenceName); } }
public Optional<BigDecimal> queryForOptionalBigDecimal(String queryName) { queryName(queryName); return session.executeQueryForOptionalBigDecimal(build()); }
public SelectBuilder limit(int limit, int offset) { session.getDialect().limit(this, limit, offset); return this; }
public long executeAndGetSequence() { return session.executeInsertAndGetSequence(getQueryName(), getParameters(), tableName, primaryKeyFieldName, sequenceName); }
long executeQueryForLong(Select select) { PreparedStatementExecutor executor = getOrCreatePreparedStatement(select); return executor.executeQueryForLong(select); }
public long queryForLong(String queryName) { queryName(queryName); return session.executeQueryForLong(build()); }
void executeInsert(String queryName, List<Parameter> parameters, String tableName, String primaryKeyFieldName, String sequenceName) { Validate.argumentsAreNotNull(queryName, parameters, tableName); if (dialect.supportsSequences() && sequenceName != null) { long newId = keyGenerator.generateKey(sequenceName, this); Insert insertQuery = new Insert( queryName, Lists.add(parameters, new Parameter.LongParameter(primaryKeyFieldName, newId)), tableName); execute(insertQuery); } else { Insert insertQuery = new Insert(queryName, parameters, tableName); execute(insertQuery); } }
public void execute() { session.executeInsert(getQueryName(), getParameters(), tableName, primaryKeyFieldName, sequenceName); } }
public Optional<BigDecimal> queryForOptionalBigDecimal(String queryName) { queryName(queryName); return session.executeQueryForOptionalBigDecimal(build()); }
public SelectBuilder limit(int limit, int offset) { session.getDialect().limit(this, limit, offset); return this; }
public long executeAndGetSequence() { return session.executeInsertAndGetSequence(getQueryName(), getParameters(), tableName, primaryKeyFieldName, sequenceName); }
Optional<Long> executeQueryForOptionalLong(Select select) { PreparedStatementExecutor executor = getOrCreatePreparedStatement(select); return executor.executeQueryForOptionalLong(select); }
public long queryForLong(String queryName) { queryName(queryName); return session.executeQueryForLong(build()); }
long executeInsertAndGetSequence(String queryName, List<Parameter> parameters, String tableName, String primaryKeyFieldName, String sequenceName) { Validate.argumentsAreNotNull(queryName, parameters, tableName, primaryKeyFieldName, sequenceName); if (dialect.supportsSequences()) { long newId = keyGenerator.generateKey(sequenceName, this); Insert insertQuery = new Insert( queryName, Lists.add(parameters, new Parameter.LongParameter(primaryKeyFieldName, newId)), tableName); execute(insertQuery); return newId; } else { Insert insertQuery = new Insert(queryName, parameters, tableName); execute(insertQuery); return keyGenerator.getKeyFromLastInsert(this); } }