Search in sources :

Example 1 with ResultColumnDescriptor

use of org.apache.derby.iapi.sql.ResultColumnDescriptor in project derby by apache.

the class EmbedResultSetMetaData method isAutoIncrement.

/**
 * Is the column automatically numbered, thus read-only?
 *
 * @param column the first column is 1, the second is 2, ...
 * @return true if so
 * @exception SQLException thrown on failure
 */
public final boolean isAutoIncrement(int column) throws SQLException {
    validColumnNumber(column);
    ResultColumnDescriptor rcd = columnInfo[column - 1];
    return rcd.isAutoincrement();
}
Also used : ResultColumnDescriptor(org.apache.derby.iapi.sql.ResultColumnDescriptor)

Example 2 with ResultColumnDescriptor

use of org.apache.derby.iapi.sql.ResultColumnDescriptor in project derby by apache.

the class EmbedResultSetMetaData method getColumnTypeDescriptor.

private DataTypeDescriptor getColumnTypeDescriptor(int column) throws SQLException {
    validColumnNumber(column);
    ResultColumnDescriptor cd = columnInfo[column - 1];
    return cd.getType();
}
Also used : ResultColumnDescriptor(org.apache.derby.iapi.sql.ResultColumnDescriptor)

Example 3 with ResultColumnDescriptor

use of org.apache.derby.iapi.sql.ResultColumnDescriptor in project derby by apache.

the class EmbedResultSetMetaData method getSchemaName.

/**
 * What's a column's table's schema?
 *
 * @param column the first column is 1, the second is 2, ...
 * @return schema name or "" if not applicable
 * @exception SQLException thrown on failure
 */
public final String getSchemaName(int column) throws SQLException {
    ResultColumnDescriptor cd = columnInfo[column - 1];
    String s = cd.getSourceSchemaName();
    // database returns null when no schema name to differentiate from empty name
    return (s == null ? "" : s);
}
Also used : ResultColumnDescriptor(org.apache.derby.iapi.sql.ResultColumnDescriptor)

Example 4 with ResultColumnDescriptor

use of org.apache.derby.iapi.sql.ResultColumnDescriptor in project derby by apache.

the class EmbedResultSetMetaData method getColumnLabel.

/**
 * What's the suggested column title for use in printouts and
 * displays?
 *
 * @param column the first column is 1, the second is 2, ...
 * @return true if so
 * @exception SQLException thrown on failure
 */
public final String getColumnLabel(int column) throws SQLException {
    ResultColumnDescriptor cd = columnInfo[column - 1];
    String s = cd.getName();
    // we could get fancier than this, but it's simple
    return (s == null ? "Column" + Integer.toString(column) : s);
}
Also used : ResultColumnDescriptor(org.apache.derby.iapi.sql.ResultColumnDescriptor)

Example 5 with ResultColumnDescriptor

use of org.apache.derby.iapi.sql.ResultColumnDescriptor in project derby by apache.

the class InsertResultSet method initializeAIcache.

/*
     * The implementation of this method is slightly different than the one
     *  in UpdateResultSet. This code was originally written for insert but
     *  with DERBY-6414, we have started supporting update of auto generated
     *  column with keyword DEFAULT. The reason of different implementation is
     *  that the array used in the following method, namely, 
     *  ColumnDescriptors in resultDescription hold different entries for
     *  insert and update case. For insert case, the array holds the column
     *  descriptors of all the columns in the table. This is because all the
     *  columns in the table are going to get some value into them whether
     *  or not they were included directly in the actual INSERT statement.
     *  The 2nd array, rla has a spot for each of the columns in the table, 
     *  with non null value for auto generated column. But in case of Update,
     *  resultDescription does not include all the columns in the table. It
     *  only has the columns being touched by the Update statement(the rest of
     *  the columns in the table will retain their original values), and for 
     *  each of those touched columns, it has a duplicate entry in 
     *  resultDescription in order to have before and after values for the 
     *  changed column values. Lastly, it has a row location information for 
     *  the row being updated. This difference in array content of 
     *  resultDescription requires us to have separate implementation of this
     *  method for insert and update.
     */
protected void initializeAIcache(RowLocation[] rla) throws StandardException {
    if ((rla = constants.getAutoincRowLocation()) != null) {
        aiCache = new DataValueDescriptor[rla.length];
        bulkInsertCounters = new BulkInsertCounter[rla.length];
        for (int i = 0; i < resultDescription.getColumnCount(); i++) {
            if (rla[i] == null)
                continue;
            ResultColumnDescriptor rcd = resultDescription.getColumnDescriptor(i + 1);
            aiCache[i] = rcd.getType().getNull();
        }
    }
}
Also used : ResultColumnDescriptor(org.apache.derby.iapi.sql.ResultColumnDescriptor)

Aggregations

ResultColumnDescriptor (org.apache.derby.iapi.sql.ResultColumnDescriptor)10 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)2 ResultDescription (org.apache.derby.iapi.sql.ResultDescription)1 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)1