Java Code Examples for com.j256.ormlite.field.SqlType#INTEGER

The following examples show how to use com.j256.ormlite.field.SqlType#INTEGER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseSqliteDatabaseType.java    From ormlite-core with ISC License 5 votes vote down vote up
@Override
protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType,
		List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs,
		List<String> queriesAfter) {
	/*
	 * Even though the documentation talks about INTEGER, it is 64-bit with a maximum value of 9223372036854775807.
	 * See http://www.sqlite.org/faq.html#q1 and http://www.sqlite.org/autoinc.html
	 */
	if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) {
		throw new IllegalArgumentException(
				"Sqlite requires that auto-increment generated-id be integer or long type");
	}
	sb.append("PRIMARY KEY AUTOINCREMENT ");
	// no additional call to configureId here
}
 
Example 2
Source File: ThreadLocalSelectArgTest.java    From ormlite-core with ISC License 5 votes vote down vote up
@Test
public void testSqlTypeValueConst() {
	int val = 12;
	SqlType type = SqlType.INTEGER;
	ThreadLocalSelectArg arg = new ThreadLocalSelectArg(type, val);
	assertTrue(arg.isValueSet());
	assertEquals(val, arg.getValue());
	assertEquals(type, arg.getSqlType());
}
 
Example 3
Source File: DerbyEmbeddedDatabaseType.java    From ormlite-jdbc with ISC License 4 votes vote down vote up
@Override
public SqlType getSqlType() {
	return SqlType.INTEGER;
}
 
Example 4
Source File: IntType.java    From ormlite-core with ISC License 4 votes vote down vote up
private IntType() {
	super(SqlType.INTEGER, new Class<?>[] { int.class });
}
 
Example 5
Source File: DateIntegerType.java    From ormlite-core with ISC License 4 votes vote down vote up
private DateIntegerType() {
	super(SqlType.INTEGER);
}
 
Example 6
Source File: EnumIntegerType.java    From ormlite-core with ISC License 4 votes vote down vote up
private EnumIntegerType() {
	super(SqlType.INTEGER);
}
 
Example 7
Source File: IntegerObjectType.java    From ormlite-core with ISC License 4 votes vote down vote up
private IntegerObjectType() {
	super(SqlType.INTEGER, new Class<?>[] { Integer.class });
}
 
Example 8
Source File: BooleanIntegerType.java    From ormlite-core with ISC License 4 votes vote down vote up
public BooleanIntegerType() {
	super(SqlType.INTEGER);
}
 
Example 9
Source File: IntTypeTest.java    From ormlite-core with ISC License 4 votes vote down vote up
@Test
public void testCoverage() {
	new IntType(SqlType.INTEGER, new Class[0]);
}
 
Example 10
Source File: EnumIntegerTypeTest.java    From ormlite-core with ISC License 4 votes vote down vote up
@Test
public void testCoverage() {
	new EnumIntegerType(SqlType.INTEGER, new Class[0]);
}
 
Example 11
Source File: DateIntegerTypeTest.java    From ormlite-core with ISC License 4 votes vote down vote up
@Test
public void testCoverage() {
	new DateIntegerType(SqlType.INTEGER, new Class[0]);
}