Package org.hsqldb

Examples of org.hsqldb.ColumnSchema


                             : i;
            Object o = data[j];
            Type   t = types[j];

            if (cols != null) {
                ColumnSchema col = (ColumnSchema) cols.get(j);

                writeFieldPrefix();
                writeString(col.getName().statementName);
            }

            if (o == null) {
                writeNull(t);
View Full Code Here


            ti.setTable(table);

            columnCount = table.getColumnCount();

            for (int i = 0; i < columnCount; i++) {
                ColumnSchema column = table.getColumn(i);

                type = column.getDataType();

                if (!columnList.contains(column.getName())) {
                    continue;
                }

                row                   = t.getEmptyRowData();
                row[table_cat]        = table.getCatalogName().name;
                row[table_schem]      = table.getSchemaName().name;
                row[table_name]       = table.getName().name;
                row[column_name]      = column.getName().name;
                row[ordinal_position] = ValuePool.getInt(i + 1);
                row[column_default]   = column.getDefaultSQL();
                row[is_nullable]      = column.isNullable() ? "YES"
                                                            : "NO";
                row[data_type]        = type.getFullNameString();

                if (type.isCharacterType()) {
                    row[character_maximum_length] =
                        ValuePool.getLong(type.precision);
                    row[character_octet_length] =
                        ValuePool.getLong(type.precision * 2);
                    row[character_set_catalog] =
                        database.getCatalogName().name;
                    row[character_set_schema] =
                        ((CharacterType) type).getCharacterSet()
                            .getSchemaName().name;
                    row[character_set_name] =
                        ((CharacterType) type).getCharacterSet().getName()
                            .name;
                    row[collation_catalog] = database.getCatalogName().name;
                    row[collation_schema] =
                        ((CharacterType) type).getCollation().getSchemaName()
                            .name;
                    row[collation_name] =
                        ((CharacterType) type).getCollation().getName().name;
                }

                if (type.isBinaryType()) {
                    row[character_maximum_length] =
                        ValuePool.getLong(type.precision);
                    row[character_octet_length] =
                        ValuePool.getLong(type.precision);
                }

                if (type.isNumberType()) {
                    row[numeric_precision] = ValuePool.getLong(type.precision);
                    row[numeric_precision_radix] = ValuePool.getLong(
                        ((NumberType) type).getPrecisionRadix());
                    row[numeric_scale] = ValuePool.getLong(type.scale);
                }

                if (type.isDateTimeType()) {
                    row[datetime_precision] = ValuePool.getLong(type.scale);
                }

                if (type.isIntervalType()) {
                    row[interval_type] =
                        IntervalType.getQualifier(type.typeCode);
                    row[interval_precision] =
                        ValuePool.getLong(type.precision);
                    row[datetime_precision] = ValuePool.getLong(type.scale);
                }

                if (type.isDomainType()) {
                    row[domain_catalog] = database.getCatalogName().name;
                    row[domain_schema= type.getSchemaName().name;
                    row[domain_name]    = type.getName().name;
                }

                if (type.isDistinctType()) {
                    row[udt_catalog] = database.getCatalogName().name;
                    row[udt_schema= type.getSchemaName().name;
                    row[udt_name]    = type.getName().name;
                }

                row[scope_catalog]       = null;
                row[scope_schema]        = null;
                row[scope_name]          = null;
                row[maximum_cardinality] = null;
                row[dtd_identifier]      = null;
                row[is_self_referencing] = null;
                row[is_identity]         = column.isIdentity() ? "YES"
                                                               : "NO";

                if (column.isIdentity()) {
                    NumberSequence sequence = column.getIdentitySequence();

                    row[identity_generation] = sequence.isAlways() ? "ALWAYS"
                                                                   : "BY DEFAULT";
                    row[identity_start] =
                        Long.toString(sequence.getStartValue());
View Full Code Here

            if (colIndexes == null) {
                continue;
            }

            for (int i = 0; i < colIndexes.length; i++) {
                ColumnSchema column =
                    trigger.getTable().getColumn(colIndexes[i]);

                row                       = t.getEmptyRowData();
                row[trigger_catalog]      = database.getCatalogName().name;
                row[trigger_schema]       = trigger.getSchemaName().name;
                row[trigger_name]         = trigger.getName().name;
                row[event_object_catalog] = database.getCatalogName().name;
                row[event_object_schema] =
                    trigger.getTable().getSchemaName().name;
                row[event_object_table= trigger.getTable().getName().name;
                row[event_object_column] = column.getNameString();

                t.insertSys(store, row);
            }
        }
View Full Code Here

     */
    Integer getColBufLen(int i) {

        int          size;
        int          type;
        ColumnSchema column;

        column = table.getColumn(i);
        type   = column.getDataType().getJDBCTypeCode();

        switch (type) {

            case Types.SQL_CHAR :
            case Types.SQL_CLOB :
            case Types.VARCHAR_IGNORECASE :
            case Types.SQL_VARCHAR : {
                size = column.getDataType().precision > Integer.MAX_VALUE
                       ? Integer.MAX_VALUE
                       : (int) column.getDataType().precision;

                if (size == 0) {}
                else if (size > HALF_MAX_INT) {
                    size = 0;
                } else {
                    size = 2 * size;
                }

                break;
            }
            case Types.SQL_BINARY :
            case Types.SQL_BLOB :
            case Types.SQL_VARBINARY : {
                size = column.getDataType().precision > Integer.MAX_VALUE
                       ? Integer.MAX_VALUE
                       : (int) column.getDataType().precision;

                break;
            }
            case Types.SQL_BIGINT :
            case Types.SQL_DOUBLE :
View Full Code Here

     */
    Integer getColCharOctLen(int i) {

        int          size;
        int          type;
        ColumnSchema column;

        column = table.getColumn(i);
        type   = column.getDataType().getJDBCTypeCode();

        switch (type) {

            case Types.SQL_CHAR :
            case Types.SQL_CLOB :
            case Types.VARCHAR_IGNORECASE :
            case Types.SQL_VARCHAR : {
                size = column.getDataType().precision > Integer.MAX_VALUE
                       ? Integer.MAX_VALUE
                       : (int) column.getDataType().precision;

                if (size == 0) {}
                else if (size > HALF_MAX_INT) {
                    size = 0;
                } else {
View Full Code Here

     * @param i zero-based column index
     * @return the nullability of the specified column
     */
    String getColIsNullable(int i) {

        ColumnSchema column = table.getColumn(i);

        return (column.isNullable() && !column.isPrimaryKey()) ? "YES"
                                                               : "NO";
    }
View Full Code Here

     * @param i zero-based column index
     * @return the specified column's nullablilit
     */
    Integer getColNullability(int i) {

        ColumnSchema column = table.getColumn(i);

        return (column.isNullable() && !column.isPrimaryKey())
               ? ValuePool.getInt(DITypeInfo.columnNullable)
               : ValuePool.getInt(DITypeInfo.columnNoNulls);
    }
View Full Code Here

     * @return the fixed number of digits to the right of the decimal point
     * for exact numeric types.
     */
    Integer getColScaleOrNull(int i) {

        ColumnSchema column;
        int          type;

        column = table.getColumn(i);
        type   = column.getDataType().getJDBCTypeCode();

        return Types.acceptsScaleCreateParam(type)
               ? ValuePool.getInt(column.getDataType().scale)
               : null;
    }
View Full Code Here

     * @return the declared or maximum length/precision for
     *    the specified column
     */
    Integer getColSize(int i) {

        ColumnSchema column;
        int          type;
        int          size;

        column = table.getColumn(i);
        type   = column.getDataType().getJDBCTypeCode();

        if (!Types.acceptsPrecision(type)) {
            return null;
        }

        size = column.getDataType().precision > Integer.MAX_VALUE
               ? Integer.MAX_VALUE
               : (int) column.getDataType().precision;

        if (size > 0) {
            return ValuePool.getInt(size);
        } else {
            ti.setTypeCode(type);
View Full Code Here

TOP

Related Classes of org.hsqldb.ColumnSchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.