Package com.j256.ormlite.field

Examples of com.j256.ormlite.field.FieldType$LevelCounters


  @Test
  public void testToString() throws Exception {
    Where<Foo, String> where = new Where<Foo, String>(createTableInfo(), null, databaseType);
    assertTrue(where.toString().contains("empty where clause"));
    String value = "bar";
    FieldType numberFieldType =
        FieldType.createFieldType(connectionSource, "foo", Foo.class.getDeclaredField(Foo.VAL_COLUMN_NAME),
            Foo.class);
    SimpleComparison eq =
        new SimpleComparison(Foo.VAL_COLUMN_NAME, numberFieldType, value, SimpleComparison.EQUAL_TO_OPERATION);
    where.eq(Foo.VAL_COLUMN_NAME, value);
View Full Code Here


      if (logger.isLevelEnabled(Level.TRACE) && argHolders.length > 0) {
        argValues = new Object[argHolders.length];
      }
      for (int i = 0; i < argHolders.length; i++) {
        Object argValue = argHolders[i].getSqlArgValue();
        FieldType fieldType = argFieldTypes[i];
        SqlType sqlType;
        if (fieldType == null) {
          sqlType = argHolders[i].getSqlType();
        } else {
          sqlType = fieldType.getSqlType();
        }
        stmt.setObject(i, argValue, sqlType);
        if (argValues != null) {
          argValues[i] = argValue;
        }
View Full Code Here

  }

  @Test
  public void testFindForeign() throws Exception {
    Dao<Foreign, String> dao = createDao(Foreign.class, false);
    FieldType fieldType = dao.findForeignFieldType(Foo.class);
    assertNotNull(fieldType);
    assertEquals("foo", fieldType.getFieldName());

    // this should be none
    fieldType = dao.findForeignFieldType(Foreign.class);
    assertNull(fieldType);
  }
View Full Code Here

  @Test(expected = SQLException.class)
  public void testForeignIdNull() throws Exception {
    StringBuilder sb = new StringBuilder();
    Field field = ForeignNull.class.getDeclaredField("foreign");
    FieldType fieldType = FieldType.createFieldType(connectionSource, "BaseFoo", field, ForeignNull.class);
    fieldType.configDaoInformation(connectionSource, ForeignNull.class);
    ForeignNullForeign foo = new ForeignNullForeign();
    foo.id = null;
    cmpForeign.appendArgOrValue(databaseType, fieldType, sb, new ArrayList<ArgumentHolder>(), foo);
  }
View Full Code Here

    expect(mockDb.getFieldConverter(isA(DataPersister.class), isA(FieldType.class))).andReturn(dataPersister);
    expect(mockDb.isEntityNamesMustBeUpCase()).andReturn(false);
    replay(mockDb);
    connectionSource.setDatabaseType(mockDb);
    try {
      FieldType fieldType = FieldType.createFieldType(connectionSource, "foo", field, GeneratedId.class);
      verify(mockDb);
      StringBuilder sb = new StringBuilder();
      List<String> statementsBefore = new ArrayList<String>();
      databaseType.appendColumnArg(null, sb, fieldType, null, statementsBefore, null, null);
    } finally {
View Full Code Here

  public void testDropSequence() throws Exception {
    if (connectionSource == null) {
      return;
    }
    Field field = GeneratedId.class.getField("id");
    FieldType fieldType = FieldType.createFieldType(connectionSource, "foo", field, GeneratedId.class);
    List<String> statementsBefore = new ArrayList<String>();
    List<String> statementsAfter = new ArrayList<String>();
    databaseType.dropColumnArg(fieldType, statementsBefore, statementsAfter);
    assertEquals(0, statementsBefore.size());
    assertEquals(1, statementsAfter.size());
View Full Code Here

    }
    TableInfo<GeneratedIdSequenceAutoName, Integer> tableInfo =
        new TableInfo<GeneratedIdSequenceAutoName, Integer>(connectionSource, null,
            GeneratedIdSequenceAutoName.class);
    assertEquals(2, tableInfo.getFieldTypes().length);
    FieldType idField = tableInfo.getFieldTypes()[0];
    StringBuilder sb = new StringBuilder();
    List<String> additionalArgs = new ArrayList<String>();
    List<String> statementsBefore = new ArrayList<String>();
    List<String> queriesAfter = new ArrayList<String>();
    databaseType.appendColumnArg(null, sb, idField, additionalArgs, statementsBefore, null, queriesAfter);
View Full Code Here

      return;
    }
    TableInfo<AllTypes, Integer> tableInfo =
        new TableInfo<AllTypes, Integer>(connectionSource, null, AllTypes.class);
    assertEquals(9, tableInfo.getFieldTypes().length);
    FieldType booleanField = tableInfo.getFieldTypes()[1];
    assertEquals("booleanField", booleanField.getColumnName());
    StringBuilder sb = new StringBuilder();
    List<String> additionalArgs = new ArrayList<String>();
    List<String> statementsBefore = new ArrayList<String>();
    databaseType.appendColumnArg(null, sb, booleanField, additionalArgs, statementsBefore, null, null);
    assertTrue(sb.toString().contains("BOOLEAN"));
View Full Code Here

      return;
    }
    TableInfo<AllTypes, Integer> tableInfo =
        new TableInfo<AllTypes, Integer>(connectionSource, null, AllTypes.class);
    assertEquals(9, tableInfo.getFieldTypes().length);
    FieldType byteField = tableInfo.getFieldTypes()[3];
    assertEquals("byteField", byteField.getColumnName());
    StringBuilder sb = new StringBuilder();
    List<String> additionalArgs = new ArrayList<String>();
    List<String> statementsBefore = new ArrayList<String>();
    databaseType.appendColumnArg(null, sb, byteField, additionalArgs, statementsBefore, null, null);
    assertTrue(sb.toString().contains("SMALLINT"));
View Full Code Here

  @Test
  public void testBoolean() throws Exception {
    TableInfo<AllTypes, Void> tableInfo = new TableInfo<AllTypes, Void>(connectionSource, null, AllTypes.class);
    assertEquals(9, tableInfo.getFieldTypes().length);
    FieldType booleanField = tableInfo.getFieldTypes()[1];
    assertEquals("booleanField", booleanField.getColumnName());
    StringBuilder sb = new StringBuilder();
    List<String> additionalArgs = new ArrayList<String>();
    List<String> statementsBefore = new ArrayList<String>();
    databaseType.appendColumnArg(null, sb, booleanField, additionalArgs, statementsBefore, null, null);
    assertTrue(sb.toString().contains("SMALLINT"));
View Full Code Here

TOP

Related Classes of com.j256.ormlite.field.FieldType$LevelCounters

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.