Package com.j256.ormlite.support

Examples of com.j256.ormlite.support.DatabaseResults.findColumn()


    // it can't be null
    foo.name = nameArg + " not that";
    assertEquals(nameArg, fieldType.extractJavaFieldToSqlArgValue(foo));

    DatabaseResults resultMock = createMock(DatabaseResults.class);
    expect(resultMock.findColumn("name")).andReturn(0);
    expect(resultMock.wasNull(0)).andReturn(false);
    replay(resultMock);
    assertEquals(nameResult, fieldType.resultToJava(resultMock, new HashMap<String, Integer>()));
    verify(resultMock);
  }
View Full Code Here


    FieldType fieldType =
        FieldType.createFieldType(connectionSource, ThrowIfNullNonPrimitive.class.getSimpleName(), field,
            ThrowIfNullNonPrimitive.class);
    DatabaseResults results = createMock(DatabaseResults.class);
    int fieldNum = 1;
    expect(results.findColumn(field.getName())).andReturn(fieldNum);
    expect(results.getInt(fieldNum)).andReturn(0);
    expect(results.wasNull(fieldNum)).andReturn(true);
    replay(results);
    fieldType.resultToJava(results, new HashMap<String, Integer>());
    verify(results);
View Full Code Here

    FieldType fieldType =
        FieldType.createFieldType(connectionSource, SerializableField.class.getSimpleName(), field,
            SerializableField.class);
    DatabaseResults results = createMock(DatabaseResults.class);
    int fieldNum = 1;
    expect(results.findColumn(field.getName())).andReturn(fieldNum);
    expect(results.getTimestamp(fieldNum)).andReturn(null);
    expect(results.wasNull(fieldNum)).andReturn(true);
    replay(results);
    assertNull(fieldType.resultToJava(results, new HashMap<String, Integer>()));
    verify(results);
View Full Code Here

    Field field = fields[0];
    FieldType fieldType =
        FieldType.createFieldType(connectionSource, InvalidType.class.getSimpleName(), field, InvalidType.class);
    DatabaseResults results = createMock(DatabaseResults.class);
    int fieldNum = 1;
    expect(results.findColumn(field.getName())).andReturn(fieldNum);
    expect(results.wasNull(fieldNum)).andReturn(true);
    replay(results);
    assertNull(fieldType.resultToJava(results, new HashMap<String, Integer>()));
    verify(results);
  }
View Full Code Here

    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      int colNum = results.findColumn(STRING_COLUMN);
      DataType.DATE_STRING.getDataPersister().resultToJava(null, results, colNum);
    } finally {
      if (stmt != null) {
        stmt.close();
      }
View Full Code Here

    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      int colNum = results.findColumn(STRING_COLUMN);
      DataType.JAVA_DATE_STRING.getDataPersister().resultToJava(null, results, colNum);
    } finally {
      if (stmt != null) {
        stmt.close();
      }
View Full Code Here

      assertTrue(results.next());
      FieldType fieldType =
          FieldType.createFieldType(connectionSource, TABLE_NAME,
              clazz.getDeclaredField(SERIALIZABLE_COLUMN), clazz);
      assertNull(DataType.SERIALIZABLE.getDataPersister().resultToJava(fieldType, results,
          results.findColumn(SERIALIZABLE_COLUMN)));
    } finally {
      if (stmt != null) {
        stmt.close();
      }
      connectionSource.releaseConnection(conn);
View Full Code Here

      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      FieldType fieldType =
          FieldType.createFieldType(connectionSource, TABLE_NAME,
              LocalSerializable.class.getDeclaredField(SERIALIZABLE_COLUMN), LocalSerializable.class);
      DataType.SERIALIZABLE.getDataPersister().resultToJava(fieldType, results, results.findColumn(BYTE_COLUMN));
    } finally {
      if (stmt != null) {
        stmt.close();
      }
      connectionSource.releaseConnection(conn);
View Full Code Here

      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      assertEquals(val.toString(),
          DataType.ENUM_STRING.getDataPersister()
              .resultToJava(null, results, results.findColumn(ENUM_COLUMN)));
    } finally {
      if (stmt != null) {
        stmt.close();
      }
      connectionSource.releaseConnection(conn);
View Full Code Here

      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      assertEquals(
          val.ordinal(),
          DataType.ENUM_INTEGER.getDataPersister().resultToJava(null, results,
              results.findColumn(ENUM_COLUMN)));
    } finally {
      if (stmt != null) {
        stmt.close();
      }
      connectionSource.releaseConnection(conn);
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.