diff --git a/.travis.yml b/.travis.yml index d971715..e948a62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,18 @@ language: java sudo: false dist: trusty +services: + - postgresql + +addons: + mariadb: '10.2' + +before_script: + - psql -c 'create database test_db;' -U postgres || travis_terminate 1; + - mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test_db;' || travis_terminate 1; + +script: mvn test -B '-DjdbcUrl1=jdbc:postgresql:test_db' '-DjdbcUrl2=jdbc:mariadb://127.0.0.1:3306/test_db?user=root' + matrix: include: - env: JDK='OpenJDK 6' diff --git a/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java b/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java index d8b87a4..9c9a1af 100644 --- a/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java +++ b/common/src/main/java/com/moparisthebest/jdbc/codegen/JdbcMapper.java @@ -128,7 +128,7 @@ public interface JdbcMapper extends Closeable { public enum DatabaseType { DEFAULT(null, null), - STANDARD("number", "text"), + STANDARD("numeric", "text"), ORACLE("ARRAY_NUM_TYPE", "ARRAY_STR_TYPE"); public final String arrayNumberTypeName, arrayStringTypeName; diff --git a/querymapper/src/main/java/com/moparisthebest/jdbc/ArrayInList.java b/querymapper/src/main/java/com/moparisthebest/jdbc/ArrayInList.java index e92db62..7245d58 100644 --- a/querymapper/src/main/java/com/moparisthebest/jdbc/ArrayInList.java +++ b/querymapper/src/main/java/com/moparisthebest/jdbc/ArrayInList.java @@ -24,7 +24,7 @@ public class ArrayInList implements InList { } public ArrayInList() { - this("number", "text"); + this("numeric", "text"); } protected String columnAppend(final String columnName) { diff --git a/test/src/main/java/com/moparisthebest/jdbc/codegen/QueryMapperQmDao.java b/test/src/main/java/com/moparisthebest/jdbc/codegen/QueryMapperQmDao.java index bc02cf3..83278be 100644 --- a/test/src/main/java/com/moparisthebest/jdbc/codegen/QueryMapperQmDao.java +++ b/test/src/main/java/com/moparisthebest/jdbc/codegen/QueryMapperQmDao.java @@ -58,7 +58,10 @@ public class QueryMapperQmDao implements QmDao { static { Collection> no = new ArrayList>(); for(final String connectionClassName : new String[]{ - "org.hsqldb.jdbc.JDBCConnection", "org.apache.derby.impl.jdbc.EmbedConnection", "org.sqlite.jdbc3.JDBC3Connection" + "org.apache.derby.impl.jdbc.EmbedConnection" + , "org.hsqldb.jdbc.JDBCConnection" + , "org.sqlite.jdbc3.JDBC3Connection" + , "org.mariadb.jdbc.MariaDbConnection" // h2 doesn't support this with java6 either... /*IFJAVA6_START , "org.h2.jdbc.JdbcConnection" diff --git a/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java b/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java index 729b030..9074884 100644 --- a/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java +++ b/test/src/test/java/com/moparisthebest/jdbc/QueryMapperTest.java @@ -32,14 +32,15 @@ import static org.junit.Assert.assertNull; @RunWith(Parameterized.class) public class QueryMapperTest { - public static final Person fieldPerson1 = new FieldPerson(1, new Date(0), "First", "Person"); - public static final Boss fieldBoss1 = new FieldBoss(2, new Date(0), "Second", "Person", "Finance", "Second"); - public static final Boss fieldBoss2 = new FieldBoss(3, new Date(0), "Third", "Person", "Finance", null); - public static final Boss fieldBoss3 = new FieldBoss(4, new Date(0), null, "Person", "Finance", "Fourth"); - public static final Person fieldPerson2 = new FieldPerson(5, new Date(0), "Second", "Person"); - public static final Person fieldPerson3 = new FieldPerson(6, new Date(0), "Third", "Person"); + private static final long birthDateMillis = 1000; // this used to be 0 but mysql TIMESTAMP can only represent '1970-01-01 00:00:01' not '1970-01-01 00:00:00', nice! o_O + public static final Person fieldPerson1 = new FieldPerson(1, new Date(birthDateMillis), "First", "Person"); + public static final Boss fieldBoss1 = new FieldBoss(2, new Date(birthDateMillis), "Second", "Person", "Finance", "Second"); + public static final Boss fieldBoss2 = new FieldBoss(3, new Date(birthDateMillis), "Third", "Person", "Finance", null); + public static final Boss fieldBoss3 = new FieldBoss(4, new Date(birthDateMillis), null, "Person", "Finance", "Fourth"); + public static final Person fieldPerson2 = new FieldPerson(5, new Date(birthDateMillis), "Second", "Person"); + public static final Person fieldPerson3 = new FieldPerson(6, new Date(birthDateMillis), "Third", "Person"); - public static final Person fieldPerson1NullName = new FieldPerson(1, new Date(0), null, null); + public static final Person fieldPerson1NullName = new FieldPerson(1, new Date(birthDateMillis), null, null); public static final Person[] people = new Person[]{fieldPerson1, fieldPerson2, fieldPerson3}; public static final Boss[] bosses = new Boss[]{fieldBoss1, fieldBoss2, fieldBoss3};