You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Guoyou Jiang <gu...@jsvest.com> on 2009/08/13 16:52:41 UTC

migration tools support sql comment

seems if the sql file contains comment at line end will cause error, like
this:
CREATE TABLE groups
(
  id bigserial NOT NULL,                              *--the primary key*
  group_code varchar(50),*                           --code*
  group_name varchar(50) NOT NULL,
  group_type varchar(100) NOT NULL,
  parent_id bigint,
  department_type varchar(50),
  business_relation_type varchar(50),
  business_relation_value varchar(50),
  memo varchar(200),
  PRIMARY KEY (id),
  CONSTRAINT groups_parent_id_fkey FOREIGN KEY (parent_id)
      REFERENCES groups (id)
);

can we support this type comment? thanks!

Re: migration tools support sql comment

Posted by Clinton Begin <cl...@gmail.com>.
Then should support all comment styles from various databases... We don't
want DB specific stuff in iBATIS.

Clinton

On Thu, Aug 13, 2009 at 9:21 AM, Guoyou Jiang <gu...@jsvest.com>wrote:

> ok, thanks,
> but i think when read line from file, we can search this line, if contains
> "--" , just use substring to cut the comment begin with "--".
>
> 2009/8/13 Clinton Begin <cl...@gmail.com>
>
> the problem is that many JDBC drivers have problems with newline
>> characters.  So we have to put the SQL all in one line.  I think there's an
>> open request to make it optional, and if I recall correctly, in iBATIS 3 I
>> send the statement as is... so we'll see how many JDBC drivers/databases
>> still have the problem!
>>
>>
>>
>> On Thu, Aug 13, 2009 at 8:52 AM, Guoyou Jiang <gu...@jsvest.com>wrote:
>>
>>> seems if the sql file contains comment at line end will cause error, like
>>> this:
>>> CREATE TABLE groups
>>> (
>>>   id bigserial NOT NULL,                              *--the primary key
>>> *
>>>   group_code varchar(50),*                           --code*
>>>   group_name varchar(50) NOT NULL,
>>>   group_type varchar(100) NOT NULL,
>>>   parent_id bigint,
>>>   department_type varchar(50),
>>>   business_relation_type varchar(50),
>>>   business_relation_value varchar(50),
>>>   memo varchar(200),
>>>   PRIMARY KEY (id),
>>>   CONSTRAINT groups_parent_id_fkey FOREIGN KEY (parent_id)
>>>       REFERENCES groups (id)
>>> );
>>>
>>> can we support this type comment? thanks!
>>>
>>
>>
>

Re: migration tools support sql comment

Posted by Guoyou Jiang <gu...@jsvest.com>.
ok, thanks,
but i think when read line from file, we can search this line, if contains
"--" , just use substring to cut the comment begin with "--".

2009/8/13 Clinton Begin <cl...@gmail.com>

> the problem is that many JDBC drivers have problems with newline
> characters.  So we have to put the SQL all in one line.  I think there's an
> open request to make it optional, and if I recall correctly, in iBATIS 3 I
> send the statement as is... so we'll see how many JDBC drivers/databases
> still have the problem!
>
>
>
> On Thu, Aug 13, 2009 at 8:52 AM, Guoyou Jiang <gu...@jsvest.com>wrote:
>
>> seems if the sql file contains comment at line end will cause error, like
>> this:
>> CREATE TABLE groups
>> (
>>   id bigserial NOT NULL,                              *--the primary key*
>>   group_code varchar(50),*                           --code*
>>   group_name varchar(50) NOT NULL,
>>   group_type varchar(100) NOT NULL,
>>   parent_id bigint,
>>   department_type varchar(50),
>>   business_relation_type varchar(50),
>>   business_relation_value varchar(50),
>>   memo varchar(200),
>>   PRIMARY KEY (id),
>>   CONSTRAINT groups_parent_id_fkey FOREIGN KEY (parent_id)
>>       REFERENCES groups (id)
>> );
>>
>> can we support this type comment? thanks!
>>
>
>

Re: migration tools support sql comment

Posted by Clinton Begin <cl...@gmail.com>.
the problem is that many JDBC drivers have problems with newline
characters.  So we have to put the SQL all in one line.  I think there's an
open request to make it optional, and if I recall correctly, in iBATIS 3 I
send the statement as is... so we'll see how many JDBC drivers/databases
still have the problem!


On Thu, Aug 13, 2009 at 8:52 AM, Guoyou Jiang <gu...@jsvest.com>wrote:

> seems if the sql file contains comment at line end will cause error, like
> this:
> CREATE TABLE groups
> (
>   id bigserial NOT NULL,                              *--the primary key*
>   group_code varchar(50),*                           --code*
>   group_name varchar(50) NOT NULL,
>   group_type varchar(100) NOT NULL,
>   parent_id bigint,
>   department_type varchar(50),
>   business_relation_type varchar(50),
>   business_relation_value varchar(50),
>   memo varchar(200),
>   PRIMARY KEY (id),
>   CONSTRAINT groups_parent_id_fkey FOREIGN KEY (parent_id)
>       REFERENCES groups (id)
> );
>
> can we support this type comment? thanks!
>