Package com.youtube.vitess.vtgate

Examples of com.youtube.vitess.vtgate.VtGate.commit()


        .addBindVar(BindVariable.forULong("id", UnsignedLong.valueOf("1")))
        .addBindVar(BindVariable.forULong("keyspace_id", ((UnsignedLong) kid.getId())))
        .addKeyspaceId(kid).build();
    vtgate.begin();
    vtgate.execute(insertQuery);
    vtgate.commit();
    vtgate.begin();
    try {
      vtgate.execute(insertQuery);
      Assert.fail("failed to throw exception");
    } catch (IntegrityException e) {
View Full Code Here


        .addBindVar(BindVariable.forULong("keyspace_id", (UnsignedLong) kid.getId()))
        .addKeyspaceId(kid)
        .setStreaming(true)
        .build();
    vtgate.execute(query);
    vtgate.commit();
    vtgate.close();
  }
}
View Full Code Here

    String createTable =
        "create table vtocc_ints(tiny tinyint, tinyu tinyint unsigned, small smallint, smallu smallint unsigned, medium mediumint, mediumu mediumint unsigned, normal int, normalu int unsigned, big bigint, bigu bigint unsigned, year year, primary key(tiny)) comment 'vtocc_nocache'\n" + "";
    VtGate vtgate = VtGate.connect("localhost:" + testEnv.port, 0);
    vtgate.begin();
    vtgate.execute(getQuery(createTable));
    vtgate.commit();

    String insertSql =
        "insert into vtocc_ints values(:tiny, :tinyu, :small, :smallu, :medium, :mediumu, :normal, :normalu, :big, :bigu, :year)";
    Query insertQuery = new QueryBuilder(insertSql, testEnv.keyspace, "master")
        .addBindVar(BindVariable.forInt("tiny", -128))
View Full Code Here

        .addBindVar(BindVariable.forShort("year", (short) 2012))
        .addKeyRange(KeyRange.ALL)
        .build();
    vtgate.begin();
    vtgate.execute(insertQuery);
    vtgate.commit();

    String selectSql = "select * from vtocc_ints where tiny = -128";
    Query selectQuery =
        new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyRange(KeyRange.ALL).build();
    Cursor cursor = vtgate.execute(selectQuery);
View Full Code Here

    String createTable =
        "create table vtocc_fracts(id int, deci decimal(5,2), num numeric(5,2), f float, d double, primary key(id)) comment 'vtocc_nocache'\n" + "";
    VtGate vtgate = VtGate.connect("localhost:" + testEnv.port, 0);
    vtgate.begin();
    vtgate.execute(getQuery(createTable));
    vtgate.commit();

    String insertSql = "insert into vtocc_fracts values(:id, :deci, :num, :f, :d)";
    Query insertQuery = new QueryBuilder(insertSql, testEnv.keyspace, "master")
        .addBindVar(BindVariable.forInt("id", 1))
        .addBindVar(BindVariable.forDouble("deci", 1.99))
View Full Code Here

        .addBindVar(BindVariable.forDouble("d", 4.99))
        .addKeyRange(KeyRange.ALL)
        .build();
    vtgate.begin();
    vtgate.execute(insertQuery);
    vtgate.commit();

    String selectSql = "select * from vtocc_fracts where id = 1";
    Query selectQuery =
        new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyRange(KeyRange.ALL).build();
    Cursor cursor = vtgate.execute(selectQuery);
View Full Code Here

    String createTable =
        "create table vtocc_strings(vb varbinary(16), c char(16), vc varchar(16), b binary(4), tb tinyblob, bl blob, ttx tinytext, tx text, en enum('a','b'), s set('a','b'), primary key(vb)) comment 'vtocc_nocache'\n" + "";
    VtGate vtgate = VtGate.connect("localhost:" + testEnv.port, 0);
    vtgate.begin();
    vtgate.execute(getQuery(createTable));
    vtgate.commit();

    String insertSql =
        "insert into vtocc_strings values(:vb, :c, :vc, :b, :tb, :bl, :ttx, :tx, :en, :s)";
    Query insertQuery = new QueryBuilder(insertSql, testEnv.keyspace, "master")
        .addBindVar(BindVariable.forBytes("vb", "a".getBytes()))
View Full Code Here

        .addBindVar(BindVariable.forString("s", "a,b"))
        .addKeyRange(KeyRange.ALL)
        .build();
    vtgate.begin();
    vtgate.execute(insertQuery);
    vtgate.commit();

    String selectSql = "select * from vtocc_strings where vb = 'a'";
    Query selectQuery =
        new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyRange(KeyRange.ALL).build();
    Cursor cursor = vtgate.execute(selectQuery);
View Full Code Here

    String createTable =
        "create table vtocc_misc(id int, b bit(8), d date, dt datetime, t time, primary key(id)) comment 'vtocc_nocache'\n" + "";
    VtGate vtgate = VtGate.connect("localhost:" + testEnv.port, 0);
    vtgate.begin();
    vtgate.execute(getQuery(createTable));
    vtgate.commit();

    String insertSql = "insert into vtocc_misc values(:id, :b, :d, :dt, :t)";
    Query insertQuery = new QueryBuilder(insertSql, testEnv.keyspace, "master")
        .addBindVar(BindVariable.forInt("id", 1))
        .addBindVar(BindVariable.forBytes("b", ByteBuffer.allocate(1).put((byte) 1).array()))
View Full Code Here

            DateTime.parse("15:45:45", ISODateTimeFormat.timeElementParser())))
        .addKeyRange(KeyRange.ALL)
        .build();
    vtgate.begin();
    vtgate.execute(insertQuery);
    vtgate.commit();

    String selectSql = "select * from vtocc_misc where id = 1";
    Query selectQuery =
        new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyRange(KeyRange.ALL).build();
    Cursor cursor = vtgate.execute(selectQuery);
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.