Package com.mysql.ndbjtie.ndbapi

Examples of com.mysql.ndbjtie.ndbapi.NdbOperation


    public Operation getUpdateOperation(Table storeTable) {
        enlist();
        TableConst ndbTable = ndbDictionary.getTable(storeTable.getName());
        handleError(ndbTable, ndbDictionary);
        NdbOperation ndbOperation = ndbTransaction.getNdbOperation(ndbTable);
        handleError(ndbOperation, ndbTransaction);
        int returnCode = ndbOperation.updateTuple();
        handleError(returnCode, ndbTransaction);
        if (logger.isTraceEnabled()) logger.trace("Table: " + storeTable.getName());
        return new OperationImpl(storeTable, ndbOperation, this);
    }
View Full Code Here


    public Operation getWriteOperation(Table storeTable) {
        enlist();
        TableConst ndbTable = ndbDictionary.getTable(storeTable.getName());
        handleError(ndbTable, ndbDictionary);
        NdbOperation ndbOperation = ndbTransaction.getNdbOperation(ndbTable);
        handleError(ndbOperation, ndbTransaction);
        int returnCode = ndbOperation.writeTuple();
        handleError(returnCode, ndbTransaction);
        if (logger.isTraceEnabled()) logger.trace("Table: " + storeTable.getName());
        return new OperationImpl(storeTable, ndbOperation, this);
    }
View Full Code Here

    protected void ins(TableConst table, int from, int to,
                       boolean setAttrs, boolean batch) {
        beginTransaction();
        for (int i = from; i <= to; i++) {
            // get an insert operation for the table
            NdbOperation op = tx.getNdbOperation(table);
            if (op == null)
                throw new RuntimeException(toStr(tx.getNdbError()));
            if (op.insertTuple() != 0)
                throw new RuntimeException(toStr(tx.getNdbError()));

            // set values; key attribute needs to be set first
            if (op.equal(model.attr_id, i) != 0)
                throw new RuntimeException(toStr(tx.getNdbError()));
            if (setAttrs) {
                if (op.setValue(model.attr_cint, -i) != 0)
                    throw new RuntimeException(toStr(tx.getNdbError()));
                if (op.setValue(model.attr_clong, (long)-i) != 0)
                    throw new RuntimeException(toStr(tx.getNdbError()));
                if (op.setValue(model.attr_cfloat, (float)-i) != 0)
                    throw new RuntimeException(toStr(tx.getNdbError()));
                if (op.setValue(model.attr_cdouble, (double)-i) != 0)
                    throw new RuntimeException(toStr(tx.getNdbError()));
            }

            // execute the operation now if in non-batching mode
            if (!batch)
View Full Code Here

    protected void delByPK(TableConst table, int from, int to,
                           boolean batch) {
        beginTransaction();
        for (int i = from; i <= to; i++) {
            // get a delete operation for the table
            NdbOperation op = tx.getNdbOperation(table);
            if (op == null)
                throw new RuntimeException(toStr(tx.getNdbError()));
            if (op.deleteTuple() != 0)
                throw new RuntimeException(toStr(tx.getNdbError()));

            // set key attribute
            if (op.equal(model.attr_id, i) != 0)
                throw new RuntimeException(toStr(tx.getNdbError()));

            // execute the operation now if in non-batching mode
            if (!batch)
                executeOperations();
View Full Code Here

TOP

Related Classes of com.mysql.ndbjtie.ndbapi.NdbOperation

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.