@Test void dbDateTimeTest() { assertThat(dbTypeSelector.create(Types.TIMESTAMP, 0)).isInstanceOf(DBDateTime.class); }
public DBType create(int dataType, int length) { switch (dataType) { case Types.DOUBLE: return new DBDouble(); case Types.REAL: return new DBDouble("REAL"); case Types.DECIMAL: return new DBDouble("DECIMAL"); case Types.INTEGER: return new DBInteger(); case Types.SMALLINT: return new DBInteger("SMALLINT"); case Types.TINYINT: return new DBInteger("TINYINT"); case Types.BIGINT: return new DBInteger(); case Types.VARCHAR: return new DBString(length); case Types.NVARCHAR: return new DBString(length, "NVARCHAR"); case Types.LONGVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGVARCHAR"); case Types.LONGNVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGNVARCHAR"); case Types.CHAR: return new DBString(length, "CHAR(" + length + ")"); case Types.NCHAR: return new DBString(length, "NCHAR"); case Types.BIT: return new DBBoolean("BIT"); case Types.BOOLEAN: return new DBBoolean("BOOLEAN"); case Types.DATE: return new DBDate(); case Types.TIME: return new DBTime(); case Types.TIMESTAMP: return new DBDateTime("TIMESTAMP"); case Types.NUMERIC: return new DBDouble("NUMERIC(18, 6)"); case Types.ARRAY: throw new UnsupportedOperationException("The ARRAY data type is currently not supported by EvoSQL."); default: throw new UnsupportedOperationException("This database type is not currently supported: " + dataType); } }
DBTypeSelector { public DBType create(int dataType, int length) { switch (dataType) { case Types.DOUBLE: return new DBDouble(); case Types.REAL: return new DBDouble("REAL"); case Types.DECIMAL: return new DBDouble("DECIMAL"); case Types.INTEGER: return new DBInteger(); case Types.SMALLINT: return new DBInteger("SMALLINT"); case Types.TINYINT: return new DBInteger("TINYINT"); case Types.BIGINT: return new DBInteger(); case Types.VARCHAR: return new DBString(length); case Types.NVARCHAR: return new DBString(length, "NVARCHAR"); case Types.LONGVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGVARCHAR"); case Types.LONGNVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGNVARCHAR"); case Types.CHAR: return new DBString(length, "CHAR(" + length + ")"); case Types.NCHAR: return new DBString(length, "NCHAR"); case Types.BIT: return new DBBoolean("BIT"); case Types.BOOLEAN: return new DBBoolean("BOOLEAN"); case Types.DATE: return new DBDate(); case Types.TIME: return new DBTime(); case Types.TIMESTAMP: return new DBDateTime("TIMESTAMP"); case Types.NUMERIC: return new DBDouble("NUMERIC(18, 6)"); case Types.ARRAY: throw new UnsupportedOperationException("The ARRAY data type is currently not supported by EvoSQL."); default: throw new UnsupportedOperationException("This database type is not currently supported: " + dataType); } } }
DBTypeSelector { public DBType create(int dataType, int length) { switch (dataType) { case Types.DOUBLE: return new DBDouble(); case Types.REAL: return new DBDouble("REAL"); case Types.DECIMAL: return new DBDouble("DECIMAL"); case Types.INTEGER: return new DBInteger(); case Types.SMALLINT: return new DBInteger("SMALLINT"); case Types.TINYINT: return new DBInteger("TINYINT"); case Types.BIGINT: return new DBInteger(); case Types.VARCHAR: return new DBString(length); case Types.NVARCHAR: return new DBString(length, "NVARCHAR"); case Types.LONGVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGVARCHAR"); case Types.LONGNVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGNVARCHAR"); case Types.CHAR: return new DBString(length, "CHAR(" + length + ")"); case Types.NCHAR: return new DBString(length, "NCHAR"); case Types.BIT: return new DBBoolean("BIT"); case Types.BOOLEAN: return new DBBoolean("BOOLEAN"); case Types.DATE: return new DBDate(); case Types.TIME: return new DBTime(); case Types.TIMESTAMP: return new DBDateTime("TIMESTAMP"); case Types.NUMERIC: return new DBDouble("NUMERIC(18, 6)"); case Types.ARRAY: throw new UnsupportedOperationException("The ARRAY data type is currently not supported by EvoSQL."); default: throw new UnsupportedOperationException("This database type is not currently supported: " + dataType); } }  }
DBTypeSelector { public DBType create(int dataType, int length) { switch (dataType) { case Types.DOUBLE: return new DBDouble(); case Types.REAL: return new DBDouble("REAL"); case Types.DECIMAL: return new DBDouble("DECIMAL"); case Types.INTEGER: return new DBInteger(); case Types.SMALLINT: return new DBInteger("SMALLINT"); case Types.TINYINT: return new DBInteger("TINYINT"); case Types.BIGINT: return new DBInteger(); case Types.VARCHAR: return new DBString(length); case Types.NVARCHAR: return new DBString(length, "NVARCHAR"); case Types.LONGVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGVARCHAR"); case Types.LONGNVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGNVARCHAR"); case Types.CHAR: return new DBString(length, "CHAR(" + length + ")"); case Types.NCHAR: return new DBString(length, "NCHAR"); case Types.BIT: return new DBBoolean("BIT"); case Types.BOOLEAN: return new DBBoolean("BOOLEAN"); case Types.DATE: return new DBDate(); case Types.TIME: return new DBTime(); case Types.TIMESTAMP: return new DBDateTime("TIMESTAMP"); case Types.NUMERIC: return new DBDouble("NUMERIC(18, 6)"); case Types.ARRAY: throw new UnsupportedOperationException("The ARRAY data type is currently not supported by EvoSQL."); default: throw new UnsupportedOperationException("This database type is not currently supported: " + dataType); } }  DBType create(int dataType, int length); }
DBTypeSelector { public DBType create(int dataType, int length) { switch (dataType) { case Types.DOUBLE: return new DBDouble(); case Types.REAL: return new DBDouble("REAL"); case Types.DECIMAL: return new DBDouble("DECIMAL"); case Types.INTEGER: return new DBInteger(); case Types.SMALLINT: return new DBInteger("SMALLINT"); case Types.TINYINT: return new DBInteger("TINYINT"); case Types.BIGINT: return new DBInteger(); case Types.VARCHAR: return new DBString(length); case Types.NVARCHAR: return new DBString(length, "NVARCHAR"); case Types.LONGVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGVARCHAR"); case Types.LONGNVARCHAR: return new DBString(EvoSQLConfiguration.MAX_STRING_LENGTH, "LONGNVARCHAR"); case Types.CHAR: return new DBString(length, "CHAR(" + length + ")"); case Types.NCHAR: return new DBString(length, "NCHAR"); case Types.BIT: return new DBBoolean("BIT"); case Types.BOOLEAN: return new DBBoolean("BOOLEAN"); case Types.DATE: return new DBDate(); case Types.TIME: return new DBTime(); case Types.TIMESTAMP: return new DBDateTime("TIMESTAMP"); case Types.NUMERIC: return new DBDouble("NUMERIC(18, 6)"); case Types.ARRAY: throw new UnsupportedOperationException("The ARRAY data type is currently not supported by EvoSQL."); default: throw new UnsupportedOperationException("This database type is not currently supported: " + dataType); } }  DBType create(int dataType, int length);  }