[
https://issues.apache.org/jira/browse/IGNITE-2169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058201#comment-15058201
]
Michael Griggs commented on IGNITE-2169:
----------------------------------------
src/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
line 609 requires a conditional check for null:
{code}
add2(src, "jdbcType.setDatabaseSchema(pojo. \"" + pojo.schema() + "\");");
{code}
> Ignite-import-schema tool generates incorrect null schema for JDBC
> ------------------------------------------------------------------
>
> Key: IGNITE-2169
> URL: https://issues.apache.org/jira/browse/IGNITE-2169
> Project: Ignite
> Issue Type: Bug
> Components: wizards
> Affects Versions: 1.5
> Reporter: Michael Griggs
>
> Given a SQLite database file that contains tables that are not inside a
> schema, i.e.:
> {code}
> sqlite> .schema
> CREATE TABLE INFO_LIST(aType varchar(64), aCode varchar(128), aInt INTEGER,
> aDate datetime, PRIMARY KEY(aType, aCode));
> {code}
> The ignite-import-schema.sh tool generates a {{CacheConfig.java}} with the
> following schema:
> {code}
> type.setDatabaseSchema("null");
> {code}
> When the {{CacheAbstractJdbcStore#EntryMapping}} class is instantiated, it
> performs the following check:
> {code}
> fullTblName = F.isEmpty(schema) ? tblName : schema + "." + tblName;
> {code}
> and generates the following {{insQuery}} and {{updQuery}}
> {code}
> INSERT INTO null.INTEREST_LIST(type,code,EAGER_LOAD,SUBSCRIBE_DATE)
> VALUES(?,?,?,?)
> UPDATE null.INTEREST_LIST SET EAGER_LOAD=?,SUBSCRIBE_DATE=? WHERE (type=? AND
> code=?)
> {code}
> This is incorrect, and the code generated in CacheConfig.java should be:
> {code}
> type.setDatabaseSchema(null);
> {code}
> i.e., *without* quotes. Then the {{F#isEmpty(schema)}} call returns the
> correct value.
> *Right now, the code generated by ignite-import-schema.sh is not usable
> without finding this problem one's self, and fixing it.*
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)