Search in sources :

Example 1 with BitField

use of com.wplatform.ddal.util.BitField in project jdbc-shards by wplatform.

the class Optimizer method calculateGenetic.

private void calculateGenetic() {
    TableFilter[] best = new TableFilter[filters.length];
    TableFilter[] list = new TableFilter[filters.length];
    for (int x = 0; x < MAX_GENETIC; x++) {
        if (canStop(x)) {
            break;
        }
        boolean generateRandom = (x & 127) == 0;
        if (!generateRandom) {
            System.arraycopy(best, 0, list, 0, filters.length);
            if (!shuffleTwo(list)) {
                generateRandom = true;
            }
        }
        if (generateRandom) {
            switched = new BitField();
            System.arraycopy(filters, 0, best, 0, filters.length);
            shuffleAll(best);
            System.arraycopy(best, 0, list, 0, filters.length);
        }
        if (testPlan(list)) {
            switched = new BitField();
            System.arraycopy(list, 0, best, 0, filters.length);
        }
    }
}
Also used : BitField(com.wplatform.ddal.util.BitField) TableFilter(com.wplatform.ddal.dbobject.table.TableFilter)

Example 2 with BitField

use of com.wplatform.ddal.util.BitField in project jdbc-shards by wplatform.

the class JdbcCallableStatement method registerOutParameter.

private void registerOutParameter(int parameterIndex) throws SQLException {
    try {
        checkClosed();
        if (outParameters == null) {
            maxOutParameters = Math.min(getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount());
            outParameters = new BitField();
        }
        checkIndexBounds(parameterIndex);
        ParameterInterface param = command.getParameters().get(--parameterIndex);
        if (!param.isValueSet()) {
            param.setValue(ValueNull.INSTANCE, false);
        }
        outParameters.set(parameterIndex);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : ParameterInterface(com.wplatform.ddal.command.expression.ParameterInterface) BitField(com.wplatform.ddal.util.BitField) DbException(com.wplatform.ddal.message.DbException)

Aggregations

BitField (com.wplatform.ddal.util.BitField)2 ParameterInterface (com.wplatform.ddal.command.expression.ParameterInterface)1 TableFilter (com.wplatform.ddal.dbobject.table.TableFilter)1 DbException (com.wplatform.ddal.message.DbException)1