Examples of BatchQuery


Examples of com.youtube.vitess.vtgate.BatchQuery

    int rowsPerShard = 5;
    for (String shardName : testEnv.shardKidMap.keySet()) {
      Util.insertRowsInShard(testEnv, shardName, rowsPerShard);
    }
    VtGate vtgate = VtGate.connect("localhost:" + testEnv.port, 0);
    BatchQuery query = new BatchQueryBuilder(testEnv.keyspace, "master")
        .addSqlAndBindVars("select * from vtgate_test where id = 3", null).addSqlAndBindVars(
            "select * from vtgate_test where id = :id",
            Lists.newArrayList(BindVariable.forULong("id", UnsignedLong.valueOf("4"))))
        .withKeyspaceIds(testEnv.getAllKeyspaceIds()).build();
    List<Long> expected = Lists.newArrayList(3L, 3L, 4L, 4L);
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = (DataRow) keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        Iterator it = batch.getDbEntity().getGeneratedAttributes().iterator();
        while (it.hasNext()) {
            DbAttribute attribute = (DbAttribute) it.next();

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
View Full Code Here

Examples of org.apache.cayenne.query.BatchQuery

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
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.