Examples of DBIdentifier


Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

        StringBuilder buf = new StringBuilder();
        buf.append("CREATE ");
        if (index.isUnique())
            buf.append("UNIQUE ");
       
        DBIdentifier fullIdxName = index.getIdentifier();
        DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName();
        checkNameLength(toDBName(unQualifiedName), maxIndexNameLength,
                "long-index-name");
        String indexName = toDBName(fullIdxName);
        
        buf.append("INDEX ").append(indexName);
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

     * &lt;fk name&gt;</code> by default.
     */
    public String[] getDropForeignKeySQL(ForeignKey fk, Connection conn) {
        if (DBIdentifier.isNull(fk.getIdentifier())) {
            String[] retVal;
            DBIdentifier fkName = fk.loadIdentifierFromDB(this,conn);
            retVal = (fkName == null || fkName.getName() == null) new String[0] :
                new String[]{ "ALTER TABLE "
                + getFullName(fk.getTable(), false)
                + " DROP CONSTRAINT " + toDBName(fkName) };
            return retVal;
        }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

     * @param targetSchema if true, then the given schema was listed by
     * the user as one of his schemas
     */
    public boolean isSystemTable(DBIdentifier name, DBIdentifier schema,
        boolean targetSchema) {
        DBIdentifier sName = DBIdentifier.toUpper(name);
        if (systemTableSet.contains(sName.getName()))
            return true;
        DBIdentifier schName = DBIdentifier.toUpper(schema);
        return !targetSchema && schema != null
            && systemSchemaSet.contains(schName.getName());
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

     */
    protected int findObject(Object obj, Joins joins)
        throws SQLException {
        try {
          String s1 = obj.toString();
          DBIdentifier sName = DBIdentifier.newColumn(obj.toString());
          return getResultSet().findColumn(_dict.convertSchemaCase(sName));
        } catch (SQLException se) {
            _dict.log.trace(se.getMessage());
            return 0;
        }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

     * &lt;fk name&gt;</code>.
     */
    @Override
    public String[] getDropForeignKeySQL(ForeignKey fk, Connection conn) {
        if (DBIdentifier.isNull(fk.getIdentifier())) {
            DBIdentifier fkName = fk.loadIdentifierFromDB(this,conn);
            String[] retVal = (fkName == null) new String[0] :
                new String[]{ "ALTER TABLE "
                + getFullName(fk.getTable(), false)
                + " DROP FOREIGN KEY " + toDBName(fkName) };
            return retVal;  
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

     * &lt;fk name&gt;</code>.
     */
    @Override
    public String[] getDropForeignKeySQL(ForeignKey fk, Connection conn) {
        if (DBIdentifier.isNull(fk.getIdentifier())) {
            DBIdentifier fkName = fk.loadIdentifierFromDB(this,conn);
            String[] retVal = (fkName == null) new String[0] :
                new String[]{ "ALTER TABLE "
                + getFullName(fk.getTable(), false)
                + " DROP FOREIGN KEY " + toDBName(fkName) };
            return retVal;  
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

    /**
     * Returns a OpenJPA 3-compatible name for an auto-assign sequence.
     */
    protected String getOpenJPA3GeneratedKeySequenceName(Column col) {
        Table table = col.getTable();
        DBIdentifier sName = DBIdentifier.preCombine(table.getIdentifier(), "SEQ");
        return toDBName(getNamingUtil().makeIdentifierValid(sName, table.getSchema().
            getSchemaGroup(), maxTableNameLength, true));
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

    /**
     * Returns a OpenJPA 3-compatible name for an auto-assign trigger.
     */
    protected String getOpenJPA3GeneratedKeyTriggerName(Column col) {
        Table table = col.getTable();       
        DBIdentifier sName = DBIdentifier.preCombine(table.getIdentifier(), "TRIG");
        return toDBName(getNamingUtil().makeIdentifierValid(sName, table.getSchema().
            getSchemaGroup(), maxTableNameLength, true));
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

            Column pkColumn) {
        if (db2ServerType == db2ZOSV8xOrLater) {
            // build the index for the sequence tables
            // the index name will be the fully qualified table name + _IDX
            Table tab = schema.getTable(table);
            DBIdentifier fullIdxId = tab.getFullIdentifier().clone();
            DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(), "IDX");
            fullIdxId.setName(getValidIndexName(unQualifiedName, tab));
            Index idx = tab.addIndex(fullIdxId);
            idx.setUnique(true);
            idx.addColumn(pkColumn);
        }
View Full Code Here

Examples of org.apache.openjpa.jdbc.identifier.DBIdentifier

            || _seconds.containsKey(tableName)
            || !DBIdentifier.isNull(path.getSchemaName()))
            return tableName;

        // decide which class-level join table is best match
        DBIdentifier best = tableName;
        int pts = 0;
        DBIdentifier fullJoin = DBIdentifier.NULL;
        DBIdentifier join = DBIdentifier.NULL;
        for (Iterator<DBIdentifier> itr = _seconds.keySet().iterator(); itr.hasNext();) {
            // award a caseless match without schema 2 points
            fullJoin = (DBIdentifier) itr.next();
            QualifiedDBIdentifier joinPath = QualifiedDBIdentifier.getPath(fullJoin);
            if (joinPath.isUnqualifiedObject() && pts < 2 && fullJoin.equalsIgnoreCase(tableName)) {
                best = fullJoin;
                pts = 2;
            } else if (joinPath.isUnqualifiedObject())
                continue;

            // immediately return an exact match with schema
            join = joinPath.getIdentifier();
            if (join.equals(tableName))
                return fullJoin;

            // caseless match with schema worth 1 point
            if (pts < 1 && join.equalsIgnoreCase(tableName)) {
                best = fullJoin;
                pts = 1;
            }
        }
        return best;
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.