Package org.jpox.store.rdbms.columninfo

Examples of org.jpox.store.rdbms.columninfo.ColumnInfo


                                                        Table table,
                                                        Connection conn,
                                                        DatastoreIdentifier column)
    throws SQLException
    {
        ColumnInfo colInfo = null;

        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        // Calculate the catalog/schema names since we need to search fully qualified
        String[] t = splitTableIdentifierName(dba.getCatalogSeparator(), table.getIdentifier().getIdentifier());
        String catalogName = table.getCatalogName();
View Full Code Here


     * @throws SQLException
     */
    public ColumnInfo getColumnInfoForColumnName(Table table, Connection conn, DatastoreIdentifier column)
    throws SQLException
    {
        ColumnInfo colInfo = null;
        if (storeDataMgr.size() == 0)
        {
            // No SchemaData yet so go to the database directly to find any info for this table.
            colInfo = RDBMSStoreHelper.getColumnInfoForColumnName(this, table, conn, column);
            if (JPOXLogger.DATASTORE_SCHEMA.isDebugEnabled())
            {
                JPOXLogger.DATASTORE_SCHEMA.debug(LOCALISER_RDBMS.msg("050032", table, (colInfo != null ? "" + 1 : "" + 0)));
            }
        }
        else
        {
            synchronized (this)
            {
                long now = System.currentTimeMillis();

                // Get fully-qualified name for this table (regardless of whether it is specified by user)
                DatastoreIdentifier tableId = ((AbstractTable)table).getDatastoreIdentifierFullyQualified();
                List cols = null;
                // Check if we already have valid info for this table in the cache
                if (now >= columnInfoReadTimestamp &&
                    now < columnInfoReadTimestamp + COLUMN_INFO_EXPIRATION_MS)
                {
                    cols = (List) columnInfoByColumnName.get(tableId.getIdentifier()+column.getIdentifier());
                    if (cols != null)
                    {
                        for(int i=0; i<cols.size(); i++)
                        {
                            String[] c = RDBMSStoreHelper.splitColumnIdentifierName(((RDBMSAdapter)this.getDatastoreAdapter()).getCatalogSeparator(), column.getIdentifier());
                            String columnName = column.getIdentifier();
                            if (c[RDBMSStoreHelper.TABLE_IDENTIFIER_COLUMN] != null)
                            {
                                columnName = c[RDBMSStoreHelper.TABLE_IDENTIFIER_COLUMN];
                            }                           
                            ColumnInfo ci = (ColumnInfo) cols.get(i);
                            if (ci.getColumnName().equals(columnName))
                            {
                                colInfo = ci;
                            }
                        }
                    }
View Full Code Here

            JPOXLogger.SCHEMATOOL.info(ti);
            ps.println(ti);
            Iterator itColumns = getColumnInfo(ti.getTableSchem(), ti.getTableName()).iterator();
            while (itColumns.hasNext())
            {
                ColumnInfo ci = (ColumnInfo) itColumns.next();
                JPOXLogger.SCHEMATOOL.info(ci);
                ps.println(ci);
            }
        }
        ps.println("");
View Full Code Here

     * @param rs    The result set returned from DatabaseMetaData.getColumns().
     * @return The column info
     */
    public ColumnInfo newColumnInfo(ResultSet rs)
    {
        return new ColumnInfo(rs);
    }
View Full Code Here

    {
        HashMap unvalidated = new HashMap(columnsByName);
        Iterator i = storeMgr.getColumnInfoForTable(this, conn).iterator();
        while (i.hasNext())
        {
            ColumnInfo ci = (ColumnInfo) i.next();

            // Create an identifier to use for the real column - use "CUSTOM" because we dont want truncation
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier(ci.getColumnName(),
                this.storeMgr.getOMFContext().getTypeManager().isDefaultEmbeddedType(String.class), FieldRole.ROLE_CUSTOM);
            Column col = (Column) unvalidated.get(colName);
            if (col != null)
            {
                if (validateColumnStructure)
View Full Code Here

        while (i.hasNext())
        {
            Column col = (Column) i.next();
            if (col.isPrimaryKey())
            {
                ColumnInfo ci = storeMgr.getColumnInfoForColumnName(this, conn, col.getIdentifier());
                if (ci != null)
                {
                    col.initializeColumnInfoFromDatastore(ci);
                }
            }
View Full Code Here

    {
        HashMap columns = new HashMap(columnsByName);
        Iterator i = storeMgr.getColumnInfoForTable(this, conn).iterator();
        while (i.hasNext())
        {
            ColumnInfo ci = (ColumnInfo) i.next();
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newIdentifier(IdentifierFactory.COLUMN, ci.getColumnName());
            Column col = (Column) columns.get(colName);
            if (col != null)
            {
                col.initializeColumnInfoFromDatastore(ci);
            }
View Full Code Here

        // Validate the column(s)
        HashMap unvalidated = new HashMap(columnsByName);
        Iterator i = storeMgr.getColumnInfoForTable(this, conn).iterator();
        while (i.hasNext())
        {
            ColumnInfo ci = (ColumnInfo)i.next();
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newIdentifier(IdentifierFactory.COLUMN, ci.getColumnName());
            Column col = (Column)unvalidated.get(colName);
            if (col == null)
            {
                if (!hasColumnName(colName))
                {
View Full Code Here

TOP

Related Classes of org.jpox.store.rdbms.columninfo.ColumnInfo

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.