You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Michael Griggs (JIRA)" <ji...@apache.org> on 2015/12/15 15:16:46 UTC

[jira] [Updated] (IGNITE-2169) Ignite-import-schema tool generates incorrect null schema for JDBC

     [ https://issues.apache.org/jira/browse/IGNITE-2169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Griggs updated IGNITE-2169:
-----------------------------------
    Description: 
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.*  

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


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