Package org.dbunit.util

Examples of org.dbunit.util.QualifiedTableName


                        logger.debug("Skipping oracle recycle bin table '{}'", tableName);
                        continue;
                    }


                    QualifiedTableName qualifiedTableName = new QualifiedTableName(tableName, schemaName);
                    tableName = qualifiedTableName.getQualifiedNameIfEnabled(config);

                    // Put the table into the table map
                    tableMap.add(tableName, null);
                }
View Full Code Here


             {
                 _originalTableName = tableName;
             }
            
             // qualified names support - table name and schema is stored here
             _qualifiedTableNameSupport = new QualifiedTableName(_originalTableName, _connection.getSchema());

             if(validate)
             {
                 String schemaName = _qualifiedTableNameSupport.getSchema();
                 String plainTableName = _qualifiedTableNameSupport.getTable();
View Full Code Here

        {
            if (i > 0)
            {
                sqlBuffer.append(", ");
            }
            String columnName = new QualifiedTableName(
                    columns[i].getColumnName(), null, escapePattern).getQualifiedName();
            sqlBuffer.append(columnName);
        }

        // from
        sqlBuffer.append(" from ");
        sqlBuffer.append(new QualifiedTableName(
                metaData.getTableName(), schema, escapePattern).getQualifiedName());

        // order by
        for (int i = 0; i < primaryKeys.length; i++)
        {
            if (i == 0)
            {
                sqlBuffer.append(" order by ");
            }
            else
            {
                sqlBuffer.append(", ");
            }
            sqlBuffer.append(new QualifiedTableName(primaryKeys[i].getColumnName(), null, escapePattern).getQualifiedName());

        }

        return sqlBuffer.toString();
    }
View Full Code Here

        logger.debug("getQualifiedName(prefix={}, name={}, connection={}) - start",
            new Object[] {prefix, name, connection});
      }

        String escapePattern = (String)connection.getConfig().getProperty(DatabaseConfig.PROPERTY_ESCAPE_PATTERN);
        QualifiedTableName qualifiedTbleName = new QualifiedTableName(name, prefix, escapePattern);
        return qualifiedTbleName.getQualifiedName();
    }
View Full Code Here

     */
    public static String getQualifiedName(String prefix, String name)
    {
        logger.debug("getQualifiedName(prefix={}, name={}) - start", prefix, name);

        return new QualifiedTableName(name, prefix, (String)null).getQualifiedName();
    }
View Full Code Here

    {
        if(logger.isDebugEnabled())
            logger.debug("getQualifiedName(prefix={}, name={}, escapePattern={}) - start",
                    new String[] {prefix, name, escapePattern});
       
        return new QualifiedTableName(name, prefix, escapePattern).getQualifiedName();
    }
View Full Code Here

     * @deprecated since 2.3.0. Prefer usage of {@link QualifiedTableName#getQualifiedName()} creating a new {@link QualifiedTableName} object
     */
    public static String getEscapedName(String name, String escapePattern)
    {
        logger.debug("getEscapedName(name={}, escapePattern={}) - start", name, escapePattern);
        return new QualifiedTableName(name, null, escapePattern).getQualifiedName();
    }
View Full Code Here

            throw new IllegalArgumentException("node '" + node + "' should be a String, not a "
                    + node.getClass().getName());
        }
        String tableName = (String) node;

      QualifiedTableName qualifiedTableName = new QualifiedTableName(tableName, schema);
      schema = qualifiedTableName.getSchema();
      tableName = qualifiedTableName.getTable();
       
        ResultSet rs = null;
        try {
            IMetadataHandler metadataHandler = (IMetadataHandler)
                    this.connection.getConfig().getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
            // Validate if the table exists
            if(!metadataHandler.tableExists(metaData, schema, tableName))
            {
                throw new NoSuchTableException("The table '"+tableName+"' does not exist in schema '"+schema+"'");
            }

            switch (type) {
            case IMPORT:
                rs = metaData.getImportedKeys(null, schema, tableName);
                break;
            case EXPORT:
                rs = metaData.getExportedKeys(null, schema, tableName);
                break;
            }
           
           
           
            DatabaseConfig dbConfig = this.connection.getConfig();
            while (rs.next()) {
                int index = TABLENAME_INDEXES[type];
                int schemaindex = SCHEMANAME_INDEXES[type];
                String dependentTableName = rs.getString(index);
                String dependentSchemaName = rs.getString(schemaindex);
                String pkColumn = rs.getString( PK_INDEXES[type] );
                String fkColumn = rs.getString( FK_INDEXES[type] );

                // set the schema in front if there is none ("SCHEMA.TABLE") - depending on the "qualified table names" feature
              tableName = new QualifiedTableName(tableName, schema).getQualifiedNameIfEnabled(dbConfig);
              dependentTableName = new QualifiedTableName(dependentTableName, dependentSchemaName).getQualifiedNameIfEnabled(dbConfig);
               
                IEdge edge = newEdge(rs, type, tableName, dependentTableName, fkColumn, pkColumn );
                if ( logger.isDebugEnabled() ) {
                    logger.debug("Adding edge " + edge);
                }
View Full Code Here

        StringBuffer sqlBuffer = new StringBuffer(128);
        sqlBuffer.append("select count(*) from ");

        //add table name and schema (schema only if available)
        QualifiedTableName qualifiedTableName = new QualifiedTableName(tableName, this.getSchema());
        String qualifiedName = qualifiedTableName.getQualifiedName();
        sqlBuffer.append(qualifiedName);
        if (whereClause != null)
        {
            sqlBuffer.append(" ");
            sqlBuffer.append(whereClause);
View Full Code Here

TOP

Related Classes of org.dbunit.util.QualifiedTableName

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.