Search in sources :

Example 81 with Set

use of org.h2.command.dml.Set in project h2database by h2database.

the class JdbcResultSet method getMetaData.

/**
 * Gets the meta data of this result set.
 *
 * @return the meta data
 */
@Override
public ResultSetMetaData getMetaData() throws SQLException {
    try {
        int id = getNextId(TraceObject.RESULT_SET_META_DATA);
        if (isDebugEnabled()) {
            debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id, "getMetaData()");
        }
        checkClosed();
        String catalog = conn.getCatalog();
        return new JdbcResultSetMetaData(this, null, result, catalog, conn.getSession().getTrace(), id);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : ValueString(org.h2.value.ValueString) DbException(org.h2.message.DbException) SQLException(java.sql.SQLException)

Example 82 with Set

use of org.h2.command.dml.Set in project h2database by h2database.

the class JdbcResultSet method updateNCharacterStream.

/**
 * Updates a column in the current or insert row.
 *
 * @param columnLabel the column label
 * @param x the value
 * @param length the number of characters
 * @throws SQLException if the result set is closed or not updatable
 */
@Override
public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException {
    try {
        if (isDebugEnabled()) {
            debugCode("updateNCharacterStream(" + quote(columnLabel) + ", x, " + length + "L);");
        }
        checkClosed();
        Value v = conn.createClob(x, length);
        update(columnLabel, v);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : Value(org.h2.value.Value) DbException(org.h2.message.DbException) SQLException(java.sql.SQLException)

Example 83 with Set

use of org.h2.command.dml.Set in project h2database by h2database.

the class JdbcResultSet method updateNCharacterStream.

/**
 * Updates a column in the current or insert row.
 *
 * @param columnIndex (1,2,...)
 * @param x the value
 * @param length the number of characters
 * @throws SQLException if the result set is closed or not updatable
 */
@Override
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
    try {
        if (isDebugEnabled()) {
            debugCode("updateNCharacterStream(" + columnIndex + ", x, " + length + "L);");
        }
        checkClosed();
        Value v = conn.createClob(x, length);
        update(columnIndex, v);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : Value(org.h2.value.Value) DbException(org.h2.message.DbException) SQLException(java.sql.SQLException)

Example 84 with Set

use of org.h2.command.dml.Set in project h2database by h2database.

the class JdbcResultSet method updateClob.

/**
 * Updates a column in the current or insert row.
 *
 * @param columnIndex (1,2,...)
 * @param x the value
 * @throws SQLException if the result set is closed or not updatable
 */
@Override
public void updateClob(int columnIndex, Clob x) throws SQLException {
    try {
        if (isDebugEnabled()) {
            debugCode("updateClob(" + columnIndex + ", x);");
        }
        checkClosed();
        Value v;
        if (x == null) {
            v = ValueNull.INSTANCE;
        } else {
            v = conn.createClob(x.getCharacterStream(), -1);
        }
        update(columnIndex, v);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : Value(org.h2.value.Value) DbException(org.h2.message.DbException) SQLException(java.sql.SQLException)

Example 85 with Set

use of org.h2.command.dml.Set in project h2database by h2database.

the class JdbcResultSet method getObject.

/**
 * Returns a column value as a Java object. The data is
 * de-serialized into a Java object (on the client side).
 *
 * @param columnLabel the column label
 * @return the value or null
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Object getObject(String columnLabel) throws SQLException {
    try {
        debugCodeCall("getObject", columnLabel);
        Value v = get(columnLabel);
        return conn.convertToDefaultObject(v);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : Value(org.h2.value.Value) DbException(org.h2.message.DbException) SQLException(java.sql.SQLException)

Aggregations

SQLException (java.sql.SQLException)107 DbException (org.h2.message.DbException)80 PreparedStatement (java.sql.PreparedStatement)78 Connection (java.sql.Connection)70 Statement (java.sql.Statement)63 ResultSet (java.sql.ResultSet)62 Value (org.h2.value.Value)51 JdbcConnection (org.h2.jdbc.JdbcConnection)48 SimpleResultSet (org.h2.tools.SimpleResultSet)36 HashSet (java.util.HashSet)28 Column (org.h2.table.Column)24 Savepoint (java.sql.Savepoint)23 ValueString (org.h2.value.ValueString)21 IOException (java.io.IOException)20 Random (java.util.Random)17 Expression (org.h2.expression.Expression)16 Task (org.h2.util.Task)16 ExpressionColumn (org.h2.expression.ExpressionColumn)14 ValueExpression (org.h2.expression.ValueExpression)13 IndexColumn (org.h2.table.IndexColumn)13