Package org.hsqldb

Examples of org.hsqldb.ColumnSchema


    }

    protected final void addColumn(Table t, String name, Type type) {

        HsqlName     cn;
        ColumnSchema c;

        cn = database.nameManager.newInfoSchemaColumnName(name, t.getName());
        c  = new ColumnSchema(cn, type, true, false, null);

        t.addColumn(c);
    }
View Full Code Here


            scope  = ti.getBRIScope();
            pseudo = ti.getBRIPseudo();

            for (int i = 0; i < cols.length; i++) {
                ColumnSchema column = table.getColumn(i);
                Type         type   = types[i];

                if (translateTTI) {
                    if (type.isIntervalType()) {
                        type = ((IntervalType) type).getCharacterType();
                    } else if (type.isDateTimeTypeWithZone()) {
                        type = ((DateTimeType) type)
                            .getDateTimeTypeWithoutZone();
                    }
                }

                row                 = t.getEmptyRowData();
                row[iscope]         = scope;
                row[icolumn_name]   = column.getName().name;
                row[idata_type]     = ValuePool.getInt(type.getJDBCTypeCode());
                row[itype_name]     = type.getNameString();
                row[icolumn_size] = ValuePool.getInt(type.getJDBCPrecision());
                row[ibuffer_length] = null;
                row[idecimal_digits] = type.acceptsScale()
                                       ? ValuePool.getInt(type.getJDBCScale())
                                       : null;
                row[ipseudo_column] = pseudo;
                row[itable_cat]     = tableCatalog;
                row[itable_schem]   = tableSchema;
                row[itable_name]    = tableName;
                row[inullable] = ValuePool.getInt(column.getNullability());
                row[iinKey]         = inKey;

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

            tableSchema  = table.getSchemaName().name;
            tableName    = table.getName().name;
            columnCount  = table.getColumnCount();

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

                if (translateTTI) {
                    if (type.isIntervalType()) {
                        type = ((IntervalType) type).getCharacterType();
                    } else if (type.isDateTimeTypeWithZone()) {
                        type = ((DateTimeType) type)
                            .getDateTimeTypeWithoutZone();
                    }
                }

                row = t.getEmptyRowData();

                //
                row[itable_cat]         = tableCatalog;
                row[itable_schem]       = tableSchema;
                row[itable_name]        = tableName;
                row[icolumn_name]       = column.getName().name;
                row[idata_type] = ValuePool.getInt(type.getJDBCTypeCode());
                row[itype_name]         = type.getNameString();
                row[icolumn_size]       = ValuePool.INTEGER_0;
                row[ichar_octet_length] = ValuePool.INTEGER_0;

                if (type.isArrayType()) {
                    row[itype_name] = type.getDefinition();
                }

                if (type.isCharacterType()) {
                    row[icolumn_size] =
                        ValuePool.getInt(type.getJDBCPrecision());

                    // this is length not octet_length, for character columns
                    row[ichar_octet_length] =
                        ValuePool.getInt(type.getJDBCPrecision());
                }

                if (type.isBinaryType()) {
                    row[icolumn_size] =
                        ValuePool.getInt(type.getJDBCPrecision());
                    row[ichar_octet_length] =
                        ValuePool.getInt(type.getJDBCPrecision());
                }

                if (type.isNumberType()) {
                    row[icolumn_size] = ValuePool.getInt(
                        ((NumberType) type).getNumericPrecisionInRadix());
                    row[inum_prec_radix] =
                        ValuePool.getInt(type.getPrecisionRadix());

                    if (type.isExactNumberType()) {
                        row[idecimal_digits] = ValuePool.getLong(type.scale);
                    }
                }

                if (type.isDateTimeType()) {
                    int size = (int) column.getDataType().displaySize();

                    row[icolumn_size] = ValuePool.getInt(size);
                    row[isql_datetime_sub] = ValuePool.getInt(
                        ((DateTimeType) type).getSqlDateTimeSub());
                }

                row[inullable] = ValuePool.getInt(column.getNullability());
                row[iremark]           = ti.getColRemarks(i);
                row[icolumn_def]       = column.getDefaultSQL();
                row[isql_data_type]    = ValuePool.getInt(type.typeCode);
                row[iordinal_position] = ValuePool.getInt(i + 1);
                row[iis_nullable]      = column.isNullable() ? "YES"
                                                             : "NO";

                if (type.isDistinctType()) {
                    row[isource_data_type] =
                        type.getName().getSchemaQualifiedStatementName();
                }

                // JDBC 4.0
                row[iis_autoinc]   = column.isIdentity() ? "YES"
                                                         : "NO";
                row[iis_generated] = column.isGenerated() ? "YES"
                                                          : "NO";

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

            for (int i = 0; i < specifics.length; i++) {
                routine     = specifics[i];
                columnCount = routine.getParameterCount();

                for (int j = 0; j < columnCount; j++) {
                    ColumnSchema column = routine.getParameter(j);

                    row  = t.getEmptyRowData();
                    type = column.getDataType();

                    if (translateTTI) {
                        if (type.isIntervalType()) {
                            type = ((IntervalType) type).getCharacterType();
                        } else if (type.isDateTimeTypeWithZone()) {
                            type = ((DateTimeType) type)
                                .getDateTimeTypeWithoutZone();
                        }
                    }

                    row[specific_cat]     = database.getCatalogName().name;
                    row[specific_schem]   = routine.getSchemaName().name;
                    row[specific_name]    = routine.getSpecificName().name;
                    row[procedure_name]   = routine.getName().name;
                    row[parameter_name]   = column.getName().name;
                    row[ordinal_position] = ValuePool.getInt(j + 1);
                    row[parameter_mode] =
                        ValuePool.getInt(column.getParameterMode());
                    row[data_type] = type.getFullNameString();
                    row[data_type_sql_id] =
                        ValuePool.getInt(type.getJDBCTypeCode());
                    row[numeric_precision]      = ValuePool.INTEGER_0;
                    row[character_octet_length] = ValuePool.INTEGER_0;

                    if (type.isCharacterType()) {
                        row[numeric_precision] =
                            ValuePool.getInt(type.getJDBCPrecision());

                        // this is length not octet_length, for character columns
                        row[character_octet_length] =
                            ValuePool.getInt(type.getJDBCPrecision());
                    }

                    if (type.isBinaryType()) {
                        row[numeric_precision] =
                            ValuePool.getInt(type.getJDBCPrecision());
                        row[character_octet_length] =
                            ValuePool.getInt(type.getJDBCPrecision());
                    }

                    if (type.isNumberType()) {
                        row[numeric_precision] = ValuePool.getInt(
                            ((NumberType) type).getNumericPrecisionInRadix());
                        row[numeric_precision_radix] =
                            ValuePool.getLong(type.getPrecisionRadix());

                        if (type.isExactNumberType()) {
                            row[numeric_scale] = ValuePool.getLong(type.scale);
                        }
                    }

                    if (type.isDateTimeType()) {
                        int size = (int) column.getDataType().displaySize();

                        row[numeric_precision] = ValuePool.getInt(size);
                    }

                    row[sql_data_type] =
                        ValuePool.getInt(column.getDataType().typeCode);
                    row[nullable] = ValuePool.getInt(column.getNullability());
                    row[is_nullable] = column.isNullable() ? "YES"
                                                           : "NO";

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

                                        (Table) ((StatementSchema) cs)
                                            .getArguments()[0];

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

                                        if (column.getDataType().isBitType()) {
                                            column.setType(Type.SQL_BOOLEAN);
                                        }
                                    }
                                }
                            }
View Full Code Here

            }

            columnCount = table.getColumnCount();

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

                if (!column.isIdentity()) {
                    continue;
                }

                sequence = column.getIdentitySequence();

                if (sequence.getName() == null) {
                    continue;
                }

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

                row                   = t.getEmptyRowData();
                row[table_cat]        = database.getCatalogName().name;
                row[table_schem]      = table.getSchemaName().name;
                row[table_name]       = table.getName().name;
                row[column_name]      = column.getName().name;
                row[sequence_catalog] = database.getCatalogName().name;
                row[sequence_schema= sequence.getSchemaName().name;
                row[sequence_name]    = sequence.getName().name;

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

            ti.setTable(table);

            int colCount = table.getColumnCount();

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

                if (column.getName().comment == null) {
                    continue;
                }

                row              = t.getEmptyRowData();
                row[catalog]     = database.getCatalogName().name;
                row[schema]      = table.getSchemaName().name;
                row[name]        = table.getName().name;
                row[type]        = "COLUMN";
                row[column_name] = column.getName().name;
                row[remark]      = column.getName().comment;

                t.insertSys(session, store, row);
            }

            if (table.getTableType() != Table.INFO_SCHEMA_TABLE
View Full Code Here

            }

            HsqlName name = table.getName();

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

                if (!column.isGenerated()) {
                    continue;
                }

                OrderedHashSet set = column.getGeneratedColumnReferences();

                if (set != null) {
                    for (int j = 0; j < set.size(); j++) {
                        row                   = t.getEmptyRowData();
                        row[table_catalog]    = database.getCatalogName().name;
                        row[table_schema]     = name.schema.name;
                        row[table_name]       = name.name;
                        row[column_name]      = ((HsqlName) set.get(j)).name;
                        row[dependent_column] = column.getName().name;

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

            table       = (Table) tables.next();
            columnCount = table.getColumnCount();
            tableName   = table.getName();

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

                type = column.getDataType();

                if (!type.isDomainType()) {
                    continue;
                }

                if (!grantee.isFullyAccessibleByRole(type.getName())) {
                    continue;
                }

                row                 = t.getEmptyRowData();
                row[domain_catalog] = database.getCatalogName().name;
                row[domain_schema= type.getSchemaName().name;
                row[domain_name]    = type.getName().name;
                row[table_catalog= database.getCatalogName().name;
                row[table_schema]   = tableName.schema.name;
                row[table_name]     = tableName.name;
                row[column_name]    = column.getNameString();

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

            table       = (Table) tables.next();
            columnCount = table.getColumnCount();
            tableName   = table.getName();

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

                type = column.getDataType();

                if (!type.isDistinctType()) {
                    continue;
                }

                if (!grantee.isFullyAccessibleByRole(type.getName())) {
                    continue;
                }

                row                = t.getEmptyRowData();
                row[udt_catalog]   = database.getCatalogName().name;
                row[udt_schema]    = type.getSchemaName().name;
                row[udt_name]      = type.getName().name;
                row[table_catalog] = database.getCatalogName().name;
                row[table_schema= tableName.schema.name;
                row[table_name]    = tableName.name;
                row[column_name]   = column.getNameString();

                t.insertSys(session, store, row);
            }
        }
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.