Examples of RDBMSIdentifierFactory


Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

            {
                sequenceSchemaName = properties.getProperty("schema-name");
            }
            String sequenceName = properties.getProperty("sequence-name");
            RDBMSManager srm = (RDBMSManager)storeMgr;
            RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)srm.getIdentifierFactory();
            SQLIdentifier identifier = (SQLIdentifier)idFactory.newSequenceIdentifier(sequenceName);
            if (((RDBMSAdapter)srm.getDatastoreAdapter()).supportsCatalogsInTableDefinitions() && sequenceCatalogName != null)
            {
                identifier.setCatalogName(sequenceCatalogName);
            }
            if (((RDBMSAdapter)srm.getDatastoreAdapter()).supportsSchemasInTableDefinitions() && sequenceSchemaName != null)
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        try
        {
            while (rs.next())
            {
                RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
                DatastoreIdentifier pkName;
                String s = rs.getString(6);
                if (s == null)
                {
                    pkName = idFactory.newPrimaryKeyIdentifier(this);
                }
                else
                {
                    pkName = idFactory.newIdentifier(IdentifierFactory.COLUMN, s);
                }
                PrimaryKey pk = (PrimaryKey) primaryKeysByName.get(pkName);
                if (pk == null)
                {
                    pk = new PrimaryKey(this);
                    pk.setName(pkName.getIdentifier());
                    primaryKeysByName.put(pkName, pk);
                }

                int keySeq = rs.getInt(5) - 1;
                DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierFactory.COLUMN, rs.getString(4));
                Column col = (Column) columnsByName.get(colName);

                if (col == null)
                {
                    throw new UnexpectedColumnException(this.toString(), colName.getIdentifier(), this.getSchemaName(), this.getCatalogName());
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        HashMap foreignKeysByName = new HashMap();

        Iterator i = RDBMSStoreHelper.getForeignKeyInfoForTable(storeMgr, this, conn).iterator();
        while (i.hasNext())
        {
            RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
            DatastoreIdentifier fkName;
            ForeignKeyInfo fki = (ForeignKeyInfo) i.next();
            if (fki.fkName == null)
            {
                fkName = idFactory.newForeignKeyIdentifier(this, foreignKeysByName.size());
            }
            else
            {
                fkName = idFactory.newIdentifier(IdentifierFactory.FOREIGN_KEY, fki.fkName);
            }

            boolean initiallyDeferred = fki.deferrability == DatabaseMetaData.importedKeyInitiallyDeferred;
            ForeignKey fk = (ForeignKey) foreignKeysByName.get(fkName);
            if (fk == null)
            {
                fk = new ForeignKey(initiallyDeferred);
                fk.setName(fkName.getIdentifier());
                foreignKeysByName.put(fkName, fk);
            }

            AbstractTable refTable = (AbstractTable)storeMgr.getDatastoreClass(idFactory.newDatastoreContainerIdentifier(fki.pkTableName));
            if (refTable != null)
            {
                DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierFactory.COLUMN, fki.fkColumnName);
                DatastoreIdentifier refColName = idFactory.newIdentifier(IdentifierFactory.COLUMN, fki.pkColumnName);
                DatastoreField col = (DatastoreField) columnsByName.get(colName);
                DatastoreField refCol = (DatastoreField) refTable.columnsByName.get(refColName);
                if (col != null && refCol != null)
                {
                    fk.addDatastoreField(col, refCol);
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        boolean isRsOpen = true;
        try
        {
            if (rs.next()) // proceed if rs contains a table description for our table
            {
                RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
                //close RS as soon as possible to release any locks it may have
                if (rs.getStatement() != null)
                {
                    rs.getStatement().close();
                }
                rs.close();
                isRsOpen = false;
               
                // Note : The table name has no quottes on it here. Some JDBC drivers (e.g Oracle 8i) fail here when
                // the table name is an SQL keyword. This is likely an error in the JDBC driver
                ResultSet rsIndexes = dba.getExistingIndexes(conn,dmd,c[0], c[1] == null ? getSchemaName() : c[1], c[2]);
                try
                {
                    boolean hasNext = rsIndexes.next();
                    if (!hasNext)
                    {
                        //ORACLE 10g: The SCHEMA name is mandatory for Oracle 10g, so if it was not given
                        //in the previous getExistingIndexes, it will be given here
                        rsIndexes = dba.getExistingIndexes(conn,dmd,c[0], storeMgr.getSchemaName(), c[2]);
                        hasNext = rsIndexes.next();
                    }
                    while (hasNext)
                {
                      boolean isUnique = !rsIndexes.getBoolean(4);
                      if (isUnique)
                      {
                      short idxType = rsIndexes.getShort(7);
                      if (idxType == DatabaseMetaData.tableIndexStatistic)
                      {
                                hasNext = rsIndexes.next();
                          continue;
                      }
   
                      String keyName=rsIndexes.getString(6);
                      DatastoreIdentifier idxName = idFactory.newIdentifier(IdentifierFactory.CANDIDATE_KEY, keyName);
                      CandidateKey can = (CandidateKey) candidateKeysByName.get(idxName);
                      if (can == null)
                      {
                          can = new CandidateKey(this);
                          can.setName(keyName);
     
                          candidateKeysByName.put(idxName, can);
                      }
     
                      // Set the column
                      int colSeq = rsIndexes.getShort(8) - 1;
                      DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierFactory.COLUMN, rsIndexes.getString(9));
                      Column col = (Column) columnsByName.get(colName);
     
                      if (col != null)
                      {
                          can.setDatastoreField(colSeq, col);
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        boolean isRsOpen = true;
        try
        {
            if (rs.next()) // proceed if rs contains a table description for our table
            {
                RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
                //close RS as soon as possible to release any locks it may have
                if (rs.getStatement() != null)
                {
                    rs.getStatement().close();
                }
                rs.close();
                isRsOpen = false;

                // Note : The table name has no quotes on it here. Some JDBC drivers (e.g Oracle 9i, 10g) fail here when
                // the table name is an SQL keyword. This is likely an error in the JDBC driver
                ResultSet rsIndexes = dba.getExistingIndexes(conn,dmd,c[0], c[1] == null ? getSchemaName() : c[1], c[2]);
                try
                {
                    boolean hasNext = rsIndexes.next();
                    if (!hasNext)
                    {
                        //ORACLE 10g: The SCHEMA name is mandatory for Oracle 10g, so if it was not given
                        //in the previous getExistingIndexes, it will be given here
                        rsIndexes = dba.getExistingIndexes(conn,dmd,c[0], storeMgr.getSchemaName(), c[2]);
                        hasNext = rsIndexes.next();
                    }
                    while (hasNext)
                {
                    short idxType = rsIndexes.getShort(7);
                    if (idxType == DatabaseMetaData.tableIndexStatistic)
                    {
                            hasNext = rsIndexes.next();
                        continue;
                    }
 
                    String indexName=rsIndexes.getString(6);
                    DatastoreIdentifier idxName = idFactory.newIdentifier(IdentifierFactory.INDEX, indexName);
                    Index idx = (Index) indicesByName.get(idxName);
                    if (idx == null)
                    {
                        boolean isUnique = !rsIndexes.getBoolean(4);
   
                        idx = new Index(this, isUnique, null);
                        idx.setName(indexName);
   
                        indicesByName.put(idxName, idx);
                    }
   
                    // Set the column
                    int colSeq = rsIndexes.getShort(8) - 1;
                    DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierFactory.COLUMN, rsIndexes.getString(9));
                    Column col = (Column) columnsByName.get(colName);
   
                    if (col != null)
                    {
                        idx.setColumn(colSeq, col);
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        HashMap stmtsByFKName = new HashMap();
        List expectedForeignKeys = getExpectedForeignKeys(clr);
        Iterator i = expectedForeignKeys.iterator();
        int n = 1;
        RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
        while (i.hasNext())
        {
            ForeignKey fk = (ForeignKey) i.next();
            if (!actualForeignKeysByName.containsValue(fk))
            {
                // If no name assigned, make one up
                if (fk.getName() == null)
                {
                    // Use the ForeignKeyIdentifier to generate the name
                    DatastoreIdentifier fkName;
                    do
                    {
                        fkName = idFactory.newForeignKeyIdentifier(this, n++);
                    }
                    while (actualForeignKeysByName.containsKey(fkName));
                    fk.setName(fkName.getIdentifier());
                }
                String stmtText = dba.getAddForeignKeyStatement(fk, idFactory);
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        HashMap stmtsByCKName = new HashMap();
        List expectedCandidateKeys = getExpectedCandidateKeys();
        Iterator i = expectedCandidateKeys.iterator();
        int n = 1;
        RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
        while (i.hasNext())
        {
            CandidateKey ck = (CandidateKey) i.next();
            if (!actualCandidateKeysByName.containsValue(ck))
            {
                // If no name assigned, make one up
                if (ck.getName() == null)
                {
                    // Use the CandidateKeyIdentifier to generate the name
                    DatastoreIdentifier ckName;
                    do
                    {
                        ckName = idFactory.newCandidateKeyIdentifier(this, n++);
                    }
                    while (actualCandidateKeysByName.containsKey(ckName));
                    ck.setName(ckName.getIdentifier());
                }
                String stmtText = dba.getAddCandidateKeyStatement(ck, idFactory);
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

        HashMap stmtsByIdxName = new HashMap();
        Set expectedIndices = getExpectedIndices(clr);

        int n = 1;
        Iterator i = expectedIndices.iterator();
        RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
        while (i.hasNext())
        {
            Index idx = (Index) i.next();
            if (isIndexReallyNeeded(idx, actualIndicesByName.values()))
            {
                // If no name assigned, make one up
                if (idx.getName() == null)
                {
                    // Use IndexIdentifier to generate the name.
                    DatastoreIdentifier idxName;
                    do
                    {
                        idxName = idFactory.newIndexIdentifier(this, idx.getUnique(), n++);
                        idx.setName(idxName.getIdentifier());
                    }
                    while (actualIndicesByName.containsKey(idxName));
                }
View Full Code Here

Examples of org.jpox.store.rdbms.sqlidentifier.RDBMSIdentifierFactory

    {
        ArrayList stmts = new ArrayList();
        Iterator cks = candidateKeysByMapField.values().iterator();
        int ckNum = 0;

        RDBMSIdentifierFactory idFactory = (RDBMSIdentifierFactory)storeMgr.getIdentifierFactory();
        while (cks.hasNext())
        {
            DatastoreIdentifier ckName = idFactory.newCandidateKeyIdentifier(this, ++ckNum);
            CandidateKey ck = (CandidateKey)cks.next();
            ck.setName(ckName.getIdentifier());

            stmts.add(dba.getAddCandidateKeyStatement(ck, idFactory));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.