protected static GroovyResultSet getImpl(CallableStatement call, int idx) { GroovyResultSetProxy proxy = new GroovyResultSetProxy(new CallResultSet(call, idx)); return proxy.getImpl(); } }
protected SqlOrderByVisitor getSqlOrderByVisitor() { if (sortVisitor == null) { sortVisitor = new SqlOrderByVisitor(); visit(sort, sortVisitor); } return sortVisitor; }
protected SqlWhereVisitor getSqlWhereVisitor() { if (visitor == null) { visitor = new SqlWhereVisitor(); visit(where, visitor); } return visitor; }
/** * Returns a List of all of the rows from the table a DataSet * represents. * * @return Returns a list of GroovyRowResult objects from the dataset * @throws SQLException if a database error occurs */ public List rows() throws SQLException { return rows(getSql(), getParameters()); }
/** * Return a lazy-implemented re-ordered view of this DataSet. * * @param sort the ordering Closure * @return the view DataSet */ public DataSet sort(Closure sort) { return new DataSet(this, null, sort); }
@Override protected void closeResources(Connection connection, java.sql.Statement statement) { delegate.closeResources(connection, statement); }
public Object getValue() { return in.getValue(); } };
/** * Find the property value for the given name (ignoring case). * * @param property the name of the property to get * @return the property value */ public Object get(Object property) { if (property instanceof String) return getProperty((String)property); return null; }
/** * Creates a new proxy instance. * This will create the extension automatically using * GroovyResultSetExtension * * @param set the result set to delegate to * @see GroovyResultSetExtension */ public GroovyResultSetProxy(ResultSet set) { extension = new GroovyResultSetExtension(set); }
@Override public Object getProperty(String property) { return invokeMethod(getPropertyGetterName(property), EMPTY_OBJECT_ARRAY); }
@Override protected Connection createConnection() throws SQLException { return delegate.createConnection(); }
private Statement getStatement(Connection connection, String sql) throws SQLException { LOG.fine(sql); Statement stmt = getAbstractStatement(new CreateStatementCommand(), connection, sql); configure(stmt); return stmt; }
/** * Factory for the PreparedQueryCommand command pattern object allows subclass to supply implementations * of the command class. * * @param sql statement to be executed, including optional parameter placeholders (?) * @param queryParams List of parameter values corresponding to parameter placeholders * @return a command - invoke its execute() and closeResource() methods * @see #createQueryCommand(String) */ protected AbstractQueryCommand createPreparedQueryCommand(String sql, List<Object> queryParams) { return new PreparedQueryCommand(sql, queryParams); }
/** * Static factory method used to create a new instance. Since parsing of the input * is required, this ensures the object is fully initialized. * * @param sql statement to be parsed * @return an instance of {@link ExtractIndexAndSql} */ static ExtractIndexAndSql from(String sql) { return new ExtractIndexAndSql(sql).invoke(); }
public SqlWithParams checkForNamedParams(String sql, List<Object> params) { SqlWithParams preCheck = buildSqlWithIndexedProps(sql); if (preCheck == null) { return new SqlWithParams(sql, params); } List<Tuple> indexPropList = new ArrayList<Tuple>(); for (Object next : preCheck.getParams()) { indexPropList.add((Tuple) next); } return new SqlWithParams(preCheck.getSql(), getUpdatedParams(params, indexPropList)); }
public void doCall(BatchingPreparedStatementWrapper stmt) throws SQLException { for (Object next : batchData) { stmt.addBatch(new Object[]{next}); } } };
public BatchingStatementWrapper(Statement delegate, int batchSize, Logger log) { this.delegate = delegate; this.batchSize = batchSize; this.log = log; reset(); }
/** * Checks if the result contains (ignoring case) the given key. * * @param key the property name to look for * @return true if the result contains this property name */ public boolean containsKey(Object key) { return lookupKeyIgnoringCase(key) != null; }
/** * Return a lazy-implemented filtered view of this DataSet. * * @param where the filtering Closure * @return the view DataSet */ public DataSet findAll(Closure where) { return new DataSet(this, where); }