/**
  * Reads a Short out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the
  * ContentValues if the column isn't present or if its value is null.
  *
  * @param cursor The cursor to read from
  * @param column The column to read
  * @param values The {@link ContentValues} to put the value into
  */
 public static void cursorShortToContentValuesIfPresent(
     Cursor cursor, ContentValues values, String column) {
   final int index = cursor.getColumnIndexOrThrow(column);
   if (!cursor.isNull(index)) {
     values.put(column, cursor.getShort(index));
   }
 }
 public static void cursorShortToContentValuesIfPresent(Cursor paramCursor, ContentValues paramContentValues, String paramString)
 {
   int i = paramCursor.getColumnIndex(paramString);
   if ((i != -1) && (!paramCursor.isNull(i))) {
     paramContentValues.put(paramString, Short.valueOf(paramCursor.getShort(i)));
   }
 }
Exemple #3
0
 @Test
 public void testGetShort() throws Exception {
   try (Cursor cursor =
       new SimpleCursor(
           QueryResult.newBuilder()
               .addFields(Field.newBuilder().setName("col0").setType(Field.Type.TYPE_YEAR).build())
               .addRows(Row.newBuilder().addValues(ByteString.copyFromUtf8("1234")))
               .build())) {
     cursor.next();
     Assert.assertEquals(1234, cursor.getShort("col0"));
   }
 }