Examples of RDBMSAdapter


Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

            // No range specified so don't apply checks!
            return false;
        }

        RDBMSStoreManager storeMgr = (RDBMSStoreManager)query.getStoreManager();
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        long rangeFromIncl = query.getRangeFromIncl();
        long rangeToExcl   = query.getRangeToExcl();
        boolean using_limit_where_clause = (dba.getRangeByLimitEndOfStatementClause(rangeFromIncl, rangeToExcl).length() > 0);
        boolean using_rownum = (dba.getRangeByRowNumberColumn().length() > 0);

        return (!using_limit_where_clause && !using_rownum);
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

    {
        super.logConfiguration();

        if (NucleusLogger.DATASTORE.isDebugEnabled())
        {
            RDBMSAdapter rdba = (RDBMSAdapter) dba;

            NucleusLogger.DATASTORE.debug("Datastore Adapter : " + dba.getClass().getName());
            NucleusLogger.DATASTORE.debug("Datastore : name=\"" + rdba.getDatastoreProductName() + "\"" +
                " version=\"" + rdba.getDatastoreProductVersion() + "\"");
            NucleusLogger.DATASTORE.debug("Datastore Driver : name=\"" + rdba.getDatastoreDriverName() + "\"" +
                " version=\"" + rdba.getDatastoreDriverVersion() + "\"");

            // Connection Pooling
            ConnectionFactoryImpl txCF = (ConnectionFactoryImpl)connectionMgr.lookupConnectionFactory(txConnectionFactoryName);
            String poolingType = txCF.getPoolingType();
            NucleusLogger.DATASTORE.debug("Transactional     Connections : Pooling = " +
                (poolingType == null || poolingType.equals("default") ? "None" : poolingType));
            ConnectionFactoryImpl nontxCF = (ConnectionFactoryImpl)connectionMgr.lookupConnectionFactory(nontxConnectionFactoryName);
            poolingType = nontxCF.getPoolingType();
            NucleusLogger.DATASTORE.debug("Non-Transactional Connections : Pooling = " +
                (poolingType == null || poolingType.equals("default") ? "None" : poolingType));

            if (identifierFactory != null)
            {
                NucleusLogger.DATASTORE.debug("Datastore Identifiers :" +
                    " factory=\"" + getStringProperty("datanucleus.identifierFactory") + "\"" +
                    " case=" + identifierFactory.getIdentifierCase().toString() +
                    (catalogName != null ? (" catalog=" + catalogName) : "") +
                    (schemaName != null ? (" schema=" + schemaName) : ""));
                NucleusLogger.DATASTORE.debug("Supported Identifier Cases : " +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_LOWERCASE) ? "lowercase " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_LOWERCASE_QUOTED) ? "\"lowercase\" " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_MIXEDCASE) ? "MixedCase " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_MIXEDCASE_QUOTED) ? "\"MixedCase\" " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_UPPERCASE) ? "UPPERCASE " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_UPPERCASE_QUOTED) ? "\"UPPERCASE\" " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_MIXEDCASE_SENSITIVE) ? "MixedCase-Sensitive " : "") +
                    (rdba.supportsOption(RDBMSAdapter.IDENTIFIERS_MIXEDCASE_QUOTED_SENSITIVE) ? "\"MixedCase-Sensitive\" " : ""));
                NucleusLogger.DATASTORE.debug("Supported Identifier Lengths (max) :" +
                    " Table=" + rdba.getDatastoreIdentifierMaxLength(IdentifierType.TABLE) +
                    " Column=" + rdba.getDatastoreIdentifierMaxLength(IdentifierType.COLUMN) +
                    " Constraint=" + rdba.getDatastoreIdentifierMaxLength(IdentifierType.CANDIDATE_KEY) +
                    " Index=" + rdba.getDatastoreIdentifierMaxLength(IdentifierType.INDEX) +
                    " Delimiter=" + rdba.getIdentifierQuoteString());
                NucleusLogger.DATASTORE.debug("Support for Identifiers in DDL :" +
                    " catalog=" + rdba.supportsOption(RDBMSAdapter.CATALOGS_IN_TABLE_DEFINITIONS) +
                    " schema=" + rdba.supportsOption(RDBMSAdapter.SCHEMAS_IN_TABLE_DEFINITIONS));
            }
            NucleusLogger.DATASTORE.debug("Datastore : " +
                (getBooleanProperty("datanucleus.rdbms.checkExistTablesOrViews") ? "checkTableViewExistence" : "") +
                ", rdbmsConstraintCreateMode=" + getStringProperty("datanucleus.rdbms.constraintCreateMode") +
                ", initialiseColumnInfo=" + getStringProperty("datanucleus.rdbms.initializeColumnInfo"));

            int batchLimit = getIntProperty("datanucleus.rdbms.statementBatchLimit");
            boolean supportBatching = rdba.supportsOption(RDBMSAdapter.STATEMENT_BATCHING);
            if (supportBatching)
            {
                NucleusLogger.DATASTORE.debug("Support Statement Batching : yes (max-batch-size=" +
                    (batchLimit == -1 ? "UNLIMITED" : "" + batchLimit) + ")");
            }
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

    protected SQLText generateOrderingStatement()
    {
        SQLText orderStmt = null;
        if (orderingExpressions != null && orderingExpressions.length > 0)
        {
            RDBMSAdapter dba = getDatabaseAdapter();
            if (dba.supportsOption(RDBMSAdapter.ORDERBY_USING_SELECT_COLUMN_INDEX))
            {
                // Order using the indexes of the ordering columns in the SELECT
                orderStmt = new SQLText();
                for (int i=0; i<orderingExpressions.length; ++i)
                {
                    if (i > 0)
                    {
                        orderStmt.append(',');
                    }
                    orderStmt.append(Integer.toString(orderingColumnIndexes[i]));
                    if (orderingDirections[i])
                    {
                        orderStmt.append(" DESC");
                    }
                }
            }
            else
            {
                // Order using column aliases "NUCORDER{i}"
                orderStmt = new SQLText();
                boolean needsSelect = dba.supportsOption(RDBMSAdapter.INCLUDE_ORDERBY_COLS_IN_SELECT);
                for (int i=0; i<orderingExpressions.length; ++i)
                {
                    if (i > 0)
                    {
                        orderStmt.append(',');
                    }

                    if (needsSelect && !aggregated)
                    {
                        // Order by the "NUCORDER?" if we need them to be selected and it isn't an aggregate
                        String orderString = "NUCORDER" + i;
                        if (orderingExpressions[i].getNumberOfSubExpressions() == 1)
                        {
                            orderStmt.append(dba.getOrderString(rdbmsMgr, orderString, orderingExpressions[i]));
                        }
                        else
                        {
                            JavaTypeMapping m = orderingExpressions[i].getJavaTypeMapping();

                            DatastoreMapping[] mappings = m.getDatastoreMappings();
                            for (int j=0;j<mappings.length;j++)
                            {
                                String alias = orderString + "_" + j;
                                orderStmt.append(dba.getOrderString(rdbmsMgr, alias, orderingExpressions[i]));

                                if (j < mappings.length-1)
                                {
                                    orderStmt.append(',');
                                }
                            }
                        }
                    }
                    else
                    {
                        // Order by the "THIS.COLUMN" otherwise
                        String orderString = orderingExpressions[i].toSQLText().toSQL();
                        orderStmt.append(dba.getOrderString(rdbmsMgr, orderString, orderingExpressions[i]));
                    }

                    if (orderingDirections[i])
                    {
                        orderStmt.append(" DESC");
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

        // TODO Cater for these columns already being selected but with no alias, so add the alias
        // to the already selected column
        if (orderingExpressions != null)
        {
            // Add any ordering columns to the SELECT
            RDBMSAdapter dba = getDatabaseAdapter();
            if (dba.supportsOption(RDBMSAdapter.ORDERBY_USING_SELECT_COLUMN_INDEX))
            {
                // Order using the indexes of the ordering columns in the SELECT
                orderingColumnIndexes = new int[orderingExpressions.length];

                // Add the ordering columns to the selected list, saving the positions
                for (int i=0; i<orderingExpressions.length; ++i)
                {
                    selects.add(orderingExpressions[i].toSQLText().toString());
                    orderingColumnIndexes[i] = selects.size();

                    if (unions != null)
                    {
                        Iterator<SQLStatement> iterator = unions.iterator();
                        while (iterator.hasNext())
                        {
                            iterator.next().selectSQLExpressionInternal(orderingExpressions[i], null);
                        }
                    }
                }
            }
            else if (dba.supportsOption(RDBMSAdapter.INCLUDE_ORDERBY_COLS_IN_SELECT))
            {
                // Order using column aliases "NUCORDER{i}"
                for (int i=0; i<orderingExpressions.length; ++i)
                {
                    String orderExpr = "NUCORDER" + i;
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

    throws SQLException
    {
        String tableType = null;

        // Calculate the catalog/schema names since we need to search fully qualified
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        String[] c = splitTableIdentifierName(dba.getCatalogSeparator(), table.getIdentifier().getIdentifierName());
        String catalogName = table.getCatalogName();
        String schemaName = table.getSchemaName();
        String tableName = table.getIdentifier().getIdentifierName();
        if (c[0] != null)
        {
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

     * @return The foreign key info
     */
    protected RDBMSTableFKInfo getRDBMSTableFKInfoForTable(Connection conn, Table table)
    {
        // Calculate the catalog/schema names since we need to search fully qualified
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        String[] c = splitTableIdentifierName(dba.getCatalogSeparator(), table.getIdentifier().getIdentifierName());
        String catalogName = table.getCatalogName();
        String schemaName = table.getSchemaName();
        String tableName = table.getIdentifier().getIdentifierName();
        if (c[0] != null)
        {
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

            String catalogName, String schemaName, String tableName)
    {
        // We don't cache FK info, so retrieve it directly
        RDBMSTableFKInfo info = new RDBMSTableFKInfo(catalogName, schemaName, tableName);

        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        try
        {
            ResultSet rs = conn.getMetaData().getImportedKeys(catalogName, schemaName, tableName);
            try
            {
                while (rs.next())
                {
                    ForeignKeyInfo fki = dba.newFKInfo(rs);
                    if (!info.getChildren().contains(fki))
                    {
                        // Ignore any duplicate FKs
                        info.addChild(fki);
                    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

     * @return The primary key info
     */
    protected RDBMSTablePKInfo getRDBMSTablePKInfoForTable(Connection conn, Table table)
    {
        // Calculate the catalog/schema names since we need to search fully qualified
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        String[] c = splitTableIdentifierName(dba.getCatalogSeparator(), table.getIdentifier().getIdentifierName());
        String catalogName = table.getCatalogName();
        String schemaName = table.getSchemaName();
        String tableName = table.getIdentifier().getIdentifierName();
        if (c[0] != null)
        {
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

     * @return The index info
     */
    protected RDBMSTableIndexInfo getRDBMSTableIndexInfoForTable(Connection conn, Table table)
    {
        // Calculate the catalog/schema names since we need to search fully qualified
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        String[] c = splitTableIdentifierName(dba.getCatalogSeparator(),
            table.getIdentifier().getIdentifierName());
        String catalogName = table.getCatalogName();
        String schemaName = table.getSchemaName();
        String tableName = table.getIdentifier().getIdentifierName();
        if (c[0] != null)
View Full Code Here

Examples of org.datanucleus.store.rdbms.adapter.RDBMSAdapter

    protected RDBMSTableIndexInfo getRDBMSTableIndexInfoForTable(Connection conn,
            String catalogName, String schemaName, String tableName)
    {
        // We don't cache Index info, so retrieve it directly
        RDBMSTableIndexInfo info = new RDBMSTableIndexInfo(catalogName, schemaName, tableName);
        RDBMSAdapter dba = (RDBMSAdapter)storeMgr.getDatastoreAdapter();
        try
        {
            // Note : the table name has no quotes here.
            String schemaNameTmp = schemaName;
            if (schemaName == null && storeMgr.getSchemaName() != null)
            {
                // This is a hack for the DatabaseAdapter method that requires a schema for Oracle
                schemaNameTmp = storeMgr.getSchemaName();
                schemaNameTmp = getIdentifierForUseWithDatabaseMetaData(schemaNameTmp);
            }
            ResultSet rs = dba.getExistingIndexes(conn, catalogName, schemaNameTmp, tableName);
            if (rs == null)
            {
                rs = conn.getMetaData().getIndexInfo(catalogName, schemaName, tableName, false, true);
            }
            try
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.