You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Eike Kettner <ne...@eknet.org> on 2010/12/22 15:53:17 UTC

how to use bigint integers

Hello,

I have a question regarding the integer type and ddl script generation.
I'm using empire-db with postgre-sql and apache derby. I'd like the
primary keys to be BIGINT and not INT and I didn't find a good way how
to tell empiredb when to use BIGINT and when to use INT - the datatype
is DataType.INTEGER and the drivers for postgre and derby do always say
INT (not sure about the newest trunk version).

What I do is overwriting the method

 boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean alter)

of the DBDatabaseDriver class and checking for an given size. So a
column with DataType.INTEGER and size=8 is then created as BIGINT. 

Did I miss something, or how would you recommend to address this? 

Thanks in advance
Eike



Re: how to use bigint integers

Posted by Francis De Brabandere <fr...@gmail.com>.
Hi Eike,

Could you attach your patch to
https://issues.apache.org/jira/browse/EMPIREDB-94

and check the 'Grant license to ASF for inclusion in ASF works (as per
the Apache License §5) '

Thanks,
Francis

On Thu, Dec 23, 2010 at 9:58 AM, Eike Kettner <ne...@eknet.org> wrote:
> Hello,
>
> here is the patch. I modified the appendColumnDesc() method of the
> postgresql and derby driver so it suits my needs. I ran some example
> code against postgresql 8.4.5 and apache derby 10.6.2 - created the
> database, inserted some data and executed some selects.
>
> hope this is of some help.
>
> kind regards,
> Eike
>
>
> On [Wed, 22.12.2010 16:01], Rainer Döbele wrote:
>> Hi Eike,
>>
>> your suggested solution is exactly the one I would recommend.
>> (Besides I would suggest to make the condition "size>=8" rather than "size==8")
>>
>> I cannot test postgre SQL, but if you send us your implementation of appendColumnDesc we will check it and change our implementation accordingly.
>>
>> Thanks and regards,
>> Rainer
>>
>> Eike Kettner wrote:
>> > from: Eike Kettner [mailto:news@eknet.org]
>> > to: empire-db-user@incubator.apache.org
>> > re: how to use bigint integers
>> >
>> > Hello,
>> >
>> > I have a question regarding the integer type and ddl script generation.
>> > I'm using empire-db with postgre-sql and apache derby. I'd like the
>> > primary keys to be BIGINT and not INT and I didn't find a good way how
>> > to tell empiredb when to use BIGINT and when to use INT - the datatype
>> > is DataType.INTEGER and the drivers for postgre and derby do always say
>> > INT (not sure about the newest trunk version).
>> >
>> > What I do is overwriting the method
>> >
>> >  boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean
>> > alter)
>> >
>> > of the DBDatabaseDriver class and checking for an given size. So a
>> > column with DataType.INTEGER and size=8 is then created as BIGINT.
>> >
>> > Did I miss something, or how would you recommend to address this?
>> >
>> > Thanks in advance
>> > Eike
>> >
>>
>
> --
> email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Re: how to use bigint integers

Posted by Eike Kettner <ne...@eknet.org>.
Hello,

here is the patch. I modified the appendColumnDesc() method of the
postgresql and derby driver so it suits my needs. I ran some example
code against postgresql 8.4.5 and apache derby 10.6.2 - created the
database, inserted some data and executed some selects.

hope this is of some help.

kind regards,
Eike


On [Wed, 22.12.2010 16:01], Rainer D�bele wrote:
> Hi Eike,
> 
> your suggested solution is exactly the one I would recommend.
> (Besides I would suggest to make the condition "size>=8" rather than "size==8")
> 
> I cannot test postgre SQL, but if you send us your implementation of appendColumnDesc we will check it and change our implementation accordingly.
> 
> Thanks and regards,
> Rainer
> 
> Eike Kettner wrote:
> > from: Eike Kettner [mailto:news@eknet.org]
> > to: empire-db-user@incubator.apache.org
> > re: how to use bigint integers
> > 
> > Hello,
> > 
> > I have a question regarding the integer type and ddl script generation.
> > I'm using empire-db with postgre-sql and apache derby. I'd like the
> > primary keys to be BIGINT and not INT and I didn't find a good way how
> > to tell empiredb when to use BIGINT and when to use INT - the datatype
> > is DataType.INTEGER and the drivers for postgre and derby do always say
> > INT (not sure about the newest trunk version).
> > 
> > What I do is overwriting the method
> > 
> >  boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean
> > alter)
> > 
> > of the DBDatabaseDriver class and checking for an given size. So a
> > column with DataType.INTEGER and size=8 is then created as BIGINT.
> > 
> > Did I miss something, or how would you recommend to address this?
> > 
> > Thanks in advance
> > Eike
> > 
> 

-- 
email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0

Re: how to use bigint integers

Posted by Eike Kettner <ne...@eknet.org>.
Hi Rainer,

thank you for your quick response! Sure, I can send my code - I will
have a look at it again today or tomorrow to clean it up a bit. I can do
some tests with postgre and derby on my machine.

regards
Eike


On [Wed, 22.12.2010 16:01], Rainer Döbele wrote:
> Hi Eike,
> 
> your suggested solution is exactly the one I would recommend.
> (Besides I would suggest to make the condition "size>=8" rather than "size==8")
> 
> I cannot test postgre SQL, but if you send us your implementation of appendColumnDesc we will check it and change our implementation accordingly.
> 
> Thanks and regards,
> Rainer
> 
> Eike Kettner wrote:
> > from: Eike Kettner [mailto:news@eknet.org]
> > to: empire-db-user@incubator.apache.org
> > re: how to use bigint integers
> > 
> > Hello,
> > 
> > I have a question regarding the integer type and ddl script generation.
> > I'm using empire-db with postgre-sql and apache derby. I'd like the
> > primary keys to be BIGINT and not INT and I didn't find a good way how
> > to tell empiredb when to use BIGINT and when to use INT - the datatype
> > is DataType.INTEGER and the drivers for postgre and derby do always say
> > INT (not sure about the newest trunk version).
> > 
> > What I do is overwriting the method
> > 
> >  boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean
> > alter)
> > 
> > of the DBDatabaseDriver class and checking for an given size. So a
> > column with DataType.INTEGER and size=8 is then created as BIGINT.
> > 
> > Did I miss something, or how would you recommend to address this?
> > 
> > Thanks in advance
> > Eike
> > 
> 

-- 
email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0

re: how to use bigint integers

Posted by Rainer Döbele <do...@esteam.de>.
Hi Eike,

your suggested solution is exactly the one I would recommend.
(Besides I would suggest to make the condition "size>=8" rather than "size==8")

I cannot test postgre SQL, but if you send us your implementation of appendColumnDesc we will check it and change our implementation accordingly.

Thanks and regards,
Rainer

Eike Kettner wrote:
> from: Eike Kettner [mailto:news@eknet.org]
> to: empire-db-user@incubator.apache.org
> re: how to use bigint integers
> 
> Hello,
> 
> I have a question regarding the integer type and ddl script generation.
> I'm using empire-db with postgre-sql and apache derby. I'd like the
> primary keys to be BIGINT and not INT and I didn't find a good way how
> to tell empiredb when to use BIGINT and when to use INT - the datatype
> is DataType.INTEGER and the drivers for postgre and derby do always say
> INT (not sure about the newest trunk version).
> 
> What I do is overwriting the method
> 
>  boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean
> alter)
> 
> of the DBDatabaseDriver class and checking for an given size. So a
> column with DataType.INTEGER and size=8 is then created as BIGINT.
> 
> Did I miss something, or how would you recommend to address this?
> 
> Thanks in advance
> Eike
>