Package com.youtube.vitess.vtgate.Row

Examples of com.youtube.vitess.vtgate.Row.Cell


      val = value;
    }
    if (val == null) {
      throw new RuntimeException("unknown type in RowWritable: " + clazz);
    }
    return new Cell(name, val, clazz);
  }
View Full Code Here


      Iterator<Field> fieldsIter = fields.iterator();
      for (Object col : cols) {
        byte[] val = col != null ? (byte[]) col : null;
        Field field = fieldsIter.next();
        FieldType ft = field.getType();
        cells.add(new Cell(field.getName(), ft.convert(val), ft.javaType));
      }
      rowList.add(new Row(cells));
    }
    return rowList;
  }
View Full Code Here

    Cursor cursor = new CursorImpl(qr);
    Assert.assertEquals(12L, cursor.getRowsAffected());
    Assert.assertEquals(12345L, cursor.getLastRowId());

    Row firstRow = cursor.next();
    Cell cell0 = firstRow.next();
    Assert.assertEquals("col_0", cell0.getName());
    Assert.assertEquals(BigDecimal.class, cell0.getType());
    Assert.assertEquals(new BigDecimal("0.0"), firstRow.getBigDecimal(cell0.getName()));

    Cell cell1 = firstRow.next();
    Assert.assertEquals("col_1", cell1.getName());
    Assert.assertEquals(Integer.class, cell1.getType());
    Assert.assertEquals(new Integer(0), firstRow.getInt(cell1.getName()));

    Cell cell2 = firstRow.next();
    Assert.assertEquals("col_2", cell2.getName());
    Assert.assertEquals(Integer.class, cell2.getType());
    Assert.assertEquals(new Integer(0), firstRow.getInt(cell2.getName()));

    Cell cell3 = firstRow.next();
    Assert.assertEquals("col_3", cell3.getName());
    Assert.assertEquals(Long.class, cell3.getType());
    Assert.assertEquals(new Long(0), firstRow.getLong(cell3.getName()));
  }
View Full Code Here

        new QueryBuilder(selectSql, testEnv.keyspace, "master").addKeyspaceId(firstKid).build();
    cursor = vtgate.execute(query);

    // Check field types and values
    Row row = cursor.next();
    Cell idCell = row.next();
    Assert.assertEquals("id", idCell.getName());
    Assert.assertEquals(UnsignedLong.class, idCell.getType());
    UnsignedLong id = row.getULong(idCell.getName());

    Cell nameCell = row.next();
    Assert.assertEquals("name", nameCell.getName());
    Assert.assertEquals(byte[].class, nameCell.getType());
    Assert.assertTrue(
        Arrays.equals(("name_" + id.toString()).getBytes(), row.getBytes(nameCell.getName())));

    Cell ageCell = row.next();
    Assert.assertEquals("age", ageCell.getName());
    Assert.assertEquals(Integer.class, ageCell.getType());
    Assert.assertEquals(Integer.valueOf(2 * id.intValue()), row.getInt(ageCell.getName()));

    vtgate.close();
  }
View Full Code Here

TOP

Related Classes of com.youtube.vitess.vtgate.Row.Cell

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.