Repository: metamodel Updated Branches: refs/heads/master 2d291f49d -> 75abac663
METAMODEL-218: Fixed Fixes #76 Project: http://git-wip-us.apache.org/repos/asf/metamodel/repo Commit: http://git-wip-us.apache.org/repos/asf/metamodel/commit/75abac66 Tree: http://git-wip-us.apache.org/repos/asf/metamodel/tree/75abac66 Diff: http://git-wip-us.apache.org/repos/asf/metamodel/diff/75abac66 Branch: refs/heads/master Commit: 75abac66380069edb1351327d994f1ea8895c4a6 Parents: 2d291f4 Author: Kasper Sørensen <i.am.kasper.soren...@gmail.com> Authored: Wed Dec 9 16:13:40 2015 +0100 Committer: Kasper Sørensen <i.am.kasper.soren...@gmail.com> Committed: Wed Dec 9 16:13:40 2015 +0100 ---------------------------------------------------------------------- CHANGES.md | 1 + .../org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java | 4 ++-- .../test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/metamodel/blob/75abac66/CHANGES.md ---------------------------------------------------------------------- diff --git a/CHANGES.md b/CHANGES.md index 384c8b7..13629d0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ * [METAMODEL-195] - Added new function MAP_VALUE which allows extracting a nested value from within a key/value map field. * [METAMODEL-15] - Query parser support for table names with space. Delimitters can be double quote or square brackets. * [METAMODEL-215] - Improved the capability of NumberComparator to support Integer, Long, Double, BigInteger and other built-in Number classes. + * [METAMODEL-218] - Fixed conversion of STRING and NUMBER types to database-specific types in JDBC module. * [METAMODEL-205] - Added validation of Excel sheet name before attempting to create table (sheet). ### Apache MetaModel 4.4.1 http://git-wip-us.apache.org/repos/asf/metamodel/blob/75abac66/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java index cbdb3c5..fcefb9f 100644 --- a/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java +++ b/jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java @@ -88,11 +88,11 @@ public class DefaultQueryRewriter extends AbstractQueryRewriter { public String rewriteColumnType(ColumnType columnType, Integer columnSize) { if (columnType == ColumnType.STRING) { // convert STRING to VARCHAR as the default SQL type for strings - rewriteColumnType(ColumnType.VARCHAR, columnSize); + return rewriteColumnType(ColumnType.VARCHAR, columnSize); } if (columnType == ColumnType.NUMBER) { // convert NUMBER to FLOAT as the default SQL type for numbers - rewriteColumnType(ColumnType.FLOAT, columnSize); + return rewriteColumnType(ColumnType.FLOAT, columnSize); } return super.rewriteColumnType(columnType, columnSize); } http://git-wip-us.apache.org/repos/asf/metamodel/blob/75abac66/jdbc/src/test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java ---------------------------------------------------------------------- diff --git a/jdbc/src/test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java b/jdbc/src/test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java index 2d5840f..f7d0cf2 100644 --- a/jdbc/src/test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java +++ b/jdbc/src/test/java/org/apache/metamodel/jdbc/JdbcTestTemplates.java @@ -549,7 +549,7 @@ public class JdbcTestTemplates { dataContext.executeUpdate(new CreateTable(defaultSchema, testTableName).withColumn("mykey") .ofType(ColumnType.INTEGER).nullable(false).asPrimaryKey().withColumn("name") - .ofType(ColumnType.VARCHAR).ofSize(20)); + .ofType(ColumnType.STRING).ofSize(20)); try { final Table table = defaultSchema.getTableByName(testTableName); assertNotNull(table);