Search in sources :

Example 1 with FormatableProperties

use of org.apache.derby.iapi.services.io.FormatableProperties in project derby by apache.

the class InternalDriver method getAttributes.

/*
	** URL manipulation
	*/
/**
 *		Convert all the attributes in the url into properties and
 *		combine them with the set provided.
 *		<BR>
 *		If the caller passed in a set of attributes (info != null)
 *		then we set that up as the default of the returned property
 *		set as the user's set. This means we can easily break the link
 *		with the user's set, ensuring that we don't hang onto the users object.
 *		It also means that we don't add our attributes into the user's
 *		own property object.
 *
 *		@exception SQLException thrown if URL form bad
 */
protected FormatableProperties getAttributes(String url, Properties info) throws SQLException {
    // We use FormatableProperties here to take advantage
    // of the clearDefaults, method.
    FormatableProperties finfo = new FormatableProperties(info);
    // ensure we don't use this reference directly again.
    info = null;
    StringTokenizer st = new StringTokenizer(url, ";");
    // skip the first part of the url
    st.nextToken();
    while (st.hasMoreTokens()) {
        String v = st.nextToken();
        int eqPos = v.indexOf('=');
        if (eqPos == -1)
            throw Util.generateCsSQLException(SQLState.MALFORMED_URL, url);
        // if (eqPos != v.lastIndexOf('='))
        // throw Util.malformedURL(url);
        finfo.put((v.substring(0, eqPos)).trim(), (v.substring(eqPos + 1)).trim());
    }
    // now validate any attributes we can
    // 
    // Boolean attributes -
    // dataEncryption,create,createSource,convertToSource,shutdown,upgrade,current
    checkBoolean(finfo, Attribute.DATA_ENCRYPTION);
    checkBoolean(finfo, Attribute.CREATE_ATTR);
    checkBoolean(finfo, Attribute.SHUTDOWN_ATTR);
    checkBoolean(finfo, Attribute.DEREGISTER_ATTR);
    checkBoolean(finfo, Attribute.UPGRADE_ATTR);
    return finfo;
}
Also used : StringTokenizer(java.util.StringTokenizer) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 2 with FormatableProperties

use of org.apache.derby.iapi.services.io.FormatableProperties in project derby by apache.

the class DeleteNode method getEmptyDeleteNode.

private DeleteNode getEmptyDeleteNode(String schemaName, String targetTableName) throws StandardException {
    ValueNode whereClause = null;
    TableName tableName = new TableName(schemaName, targetTableName, getContextManager());
    FromList fromList = new FromList(getContextManager());
    FromTable fromTable = new FromBaseTable(tableName, null, FromBaseTable.DELETE, null, getContextManager());
    // we would like to use references index & table scan instead of
    // what optimizer says for the dependent table scan.
    Properties targetProperties = new FormatableProperties();
    targetProperties.put("index", "null");
    ((FromBaseTable) fromTable).setTableProperties(targetProperties);
    fromList.addFromTable(fromTable);
    SelectNode rs = new SelectNode(null, fromList, /* FROM list */
    whereClause, /* WHERE clause */
    null, /* GROUP BY list */
    null, /* having clause */
    null, /* windows */
    null, /* optimizer override plan */
    getContextManager());
    return new DeleteNode(tableName, rs, null, getContextManager());
}
Also used : FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties) Properties(java.util.Properties) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 3 with FormatableProperties

use of org.apache.derby.iapi.services.io.FormatableProperties in project derby by apache.

the class RealHashTableStatistics method getScanPropsDescriptor.

public Object getScanPropsDescriptor(Object scanPropsID) {
    FormatableProperties props = this.scanProperties;
    String isoLevel = XPLAINUtil.getIsolationLevelCode(this.isolationLevel);
    String hashkey_columns = XPLAINUtil.getHashKeyColumnNumberString(this.hashKeyColumns);
    // create new scan info descriptor with some basic information
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor(// the scan props UUID
    (UUID) scanPropsID, // the index/table name
    "Temporary HashTable", // the scan object, either (C)onstraint, (I)ndex or (T)able
    null, // the scan type: heap, btree, sort
    null, // the isolation level
    isoLevel, // the number of visited pages
    null, // the number of visited rows
    null, // the number of qualified rows
    null, // the number of visited deleted rows
    null, // the number of fetched columns
    null, // the bitset of fetched columns
    null, // the btree height
    null, // the fetch size
    null, // the start position, internal encoding
    null, // the stop position, internal encoding
    null, // the scan qualifiers
    null, // the next qualifiers
    this.nextQualifiers, // the hash key column numbers
    hashkey_columns, // the hash table size
    this.hashtableSize);
    // fill additional information from scan properties
    return XPLAINUtil.extractScanProps(scanRSDescriptor, props);
}
Also used : XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 4 with FormatableProperties

use of org.apache.derby.iapi.services.io.FormatableProperties in project derby by apache.

the class RealSortStatistics method getSortPropsDescriptor.

public Object getSortPropsDescriptor(Object sortPropsID) {
    FormatableProperties props = this.sortProperties;
    // create new scan info descriptor with some basic information
    XPLAINSortPropsDescriptor sortRSDescriptor = new XPLAINSortPropsDescriptor(// the sort props UUID
    (UUID) sortPropsID, // the sort type, either (C)onstraint, (I)ndex or (T)able
    null, // the number of input rows
    null, // the number of output rows
    null, // the number of merge runs
    null, // merge run details
    null, XPLAINUtil.getYesNoCharFromBoolean(// eliminate duplicates
    this.eliminateDuplicates), XPLAINUtil.getYesNoCharFromBoolean(// in sorted order
    this.inSortedOrder), // distinct_aggregate
    null);
    // fill additional information from scan properties
    return XPLAINUtil.extractSortProps(sortRSDescriptor, props);
}
Also used : XPLAINSortPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Example 5 with FormatableProperties

use of org.apache.derby.iapi.services.io.FormatableProperties in project derby by apache.

the class RealHashScanStatistics method getScanPropsDescriptor.

public Object getScanPropsDescriptor(Object scanPropsID) {
    String scanObjectType, scanObjectName;
    if (this.indexName != null) {
        if (this.isConstraint) {
            // constraint
            scanObjectType = "C";
            scanObjectName = this.indexName;
        } else {
            // index
            scanObjectType = "I";
            scanObjectName = this.indexName;
        }
    } else {
        // table
        scanObjectType = "T";
        scanObjectName = this.tableName;
    }
    String isoLevel = XPLAINUtil.getIsolationLevelCode(this.isolationLevel);
    String hashkey_columns = XPLAINUtil.getHashKeyColumnNumberString(this.hashKeyColumns);
    XPLAINScanPropsDescriptor scanRSDescriptor = new XPLAINScanPropsDescriptor(// the scan props UUID
    (UUID) scanPropsID, scanObjectName, scanObjectType, // the scan type: heap, btree, sort
    null, // the isolation level
    isoLevel, // the number of visited pages
    null, // the number of visited rows
    null, // the number of qualified rows
    null, // the number of visited deleted rows
    null, // the number of fetched columns
    null, // the bitset of fetched columns
    null, // the btree height
    null, // the fetch size
    null, this.startPosition, this.stopPosition, this.scanQualifiers, this.nextQualifiers, hashkey_columns, this.hashtableSize);
    FormatableProperties props = this.scanProperties;
    return XPLAINUtil.extractScanProps(scanRSDescriptor, props);
}
Also used : XPLAINScanPropsDescriptor(org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor) FormatableProperties(org.apache.derby.iapi.services.io.FormatableProperties)

Aggregations

FormatableProperties (org.apache.derby.iapi.services.io.FormatableProperties)9 XPLAINScanPropsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINScanPropsDescriptor)3 Properties (java.util.Properties)2 DriverPropertyInfo (java.sql.DriverPropertyInfo)1 StringTokenizer (java.util.StringTokenizer)1 XPLAINSortPropsDescriptor (org.apache.derby.impl.sql.catalog.XPLAINSortPropsDescriptor)1