/** Increment the buffer size for the list. */ private final void resize() throws SQLException { int newsize = data.length << 1; if (newsize > 0xFFFFFF) { // see pointerSize newsize = 0xFFFFFF; if (newsize == data.length) throw SmallSQLException.create(Language.INDEX_TOOMANY_EQUALS); } byte[] temp = new byte[newsize]; System.arraycopy(data, 0, temp, 0, data.length); data = temp; }
final void setNeedGeneratedKeys(int autoGeneratedKeys) throws SQLException { switch (autoGeneratedKeys) { case NO_GENERATED_KEYS: break; case RETURN_GENERATED_KEYS: needGeneratedKeys = true; break; default: throw SmallSQLException.create( Language.ARGUMENT_INVALID, String.valueOf(autoGeneratedKeys)); } }
public final boolean getMoreResults(int current) throws SQLException { switch (current) { case CLOSE_ALL_RESULTS: // currently there exists only one ResultSet case CLOSE_CURRENT_RESULT: ResultSet rs = cmd.getResultSet(); cmd.rs = null; if (rs != null) rs.close(); break; case KEEP_CURRENT_RESULT: break; default: throw SmallSQLException.create(Language.FLAGVALUE_INVALID, String.valueOf(current)); } return cmd.getMoreResults(); }
private final void executeImpl(String sql) throws SQLException { checkStatement(); generatedKeys = null; try { con.log.println(sql); SQLParser parser = new SQLParser(); cmd = parser.parse(con, sql); if (maxRows != 0 && (cmd.getMaxRows() == -1 || cmd.getMaxRows() > maxRows)) cmd.setMaxRows(maxRows); cmd.execute(con, this); } catch (Exception e) { throw SmallSQLException.createFromException(e); } needGeneratedKeys = false; generatedKeyIndexes = null; generatedKeyNames = null; }
void checkStatement() throws SQLException { if (isClosed) { throw SmallSQLException.create(Language.STMT_IS_CLOSED); } }
public final ResultSet getGeneratedKeys() throws SQLException { if (generatedKeys == null) throw SmallSQLException.create(Language.GENER_KEYS_UNREQUIRED); return generatedKeys; }
public final void setCursorName(String name) throws SQLException { /** @todo: Implement this java.sql.Statement.setCursorName method */ throw SmallSQLException.create(Language.UNSUPPORTED_OPERATION, "setCursorName"); }
public final void setMaxRows(int max) throws SQLException { if (max < 0) throw SmallSQLException.create(Language.ROWS_WRONG_MAX, String.valueOf(max)); maxRows = max; }
/** * Create a SQLException that the current function can not convert the specific data type. * * @param dataType A data type const from SQLTokenizer. */ SQLException createUnspportedConversion(int dataType) { Object[] params = {SQLTokenizer.getKeyWord(dataType), SQLTokenizer.getKeyWord(getFunction())}; return SmallSQLException.create(Language.UNSUPPORTED_CONVERSION_FUNC, params); }
/** * Create a SQLException that the current function does not support the specific data type. * * @param dataType A data type const from SQLTokenizer. */ SQLException createUnspportedDataType(int dataType) { Object[] params = {SQLTokenizer.getKeyWord(dataType), SQLTokenizer.getKeyWord(getFunction())}; return SmallSQLException.create(Language.UNSUPPORTED_DATATYPE_FUNC, params); }
void setPrecision(int precision) throws SQLException { if (precision < 0) throw SmallSQLException.create( Language.COL_INVALID_SIZE, new Object[] {new Integer(precision), name}); this.precision = precision; }