Michael Griggs created IGNITE-2169:
--------------------------------------

             Summary: 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.:

{{
sqlite> .schema
CREATE TABLE INFO_LIST(aType varchar(64), aCode varchar(128), aInt INTEGER, 
aDate datetime, PRIMARY KEY(aType, aCode));
}}

The ignite-import-schema.sh tool generates a {{CacheConfig.java}} with the 
following schema:
{{
type.setDatabaseSchema("null");
}}

When the {{CacheAbstractJdbcStore#EntryMapping}} class is instantiated, it 
performs the following check:
{{
fullTblName = F.isEmpty(schema) ? tblName : schema + "." + tblName;
}}

and generates the following {{insQuery}} and {{updQuery}}

{{

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=?)

}}

This is incorrect, and the code generated in CacheConfig.java should be:

{{

type.setDatabaseSchema(null);

}}

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)

Reply via email to