You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by Frank Lupo <fr...@email.it> on 2009/03/27 10:14:03 UTC

postgresql AUTO_INC

Hi,
current datatype auto_inc in postgresql definition create a separate 
sequence.
Why is not used serial type in postgresql?

Best regards
 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Con Poker Club anche a Marzo il montepremi è garantito: ogni lunedì, giovedì e domenica vinci fino a 25.000€!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3

re: postgresql AUTO_INC

Posted by Rainer Döbele <do...@esteam.de>.
Dear Frank,

creating a new datatype as you suggested is IMO not the right approach.
If we would do that, we'd have to give an implementation for every other driver. And what would the logical meaning of a type called "Native" be?

As far as the AUTOINC type is concerned there are basically there are three ways to implement it:
1. use a sequence if supported by the database (see e.g. DBDatabaseDriverOracle)
2. use a dbms native type for identity or autoinc columns (see DBDatabaseDriverMySQL or DBDatabaseDriverMSSQL)
3. use an additional table by which the Empire-db can manage sequences itself. The is support for this in the framework through the class DBDatabaseDriver.DBSeqTable. 

It is up to the driver to decide which option to use. The driver may also give a configuration option on which method to use. As an example both the DBDatabaseDriverMySQL and DBDatabaseDriverMSSQL allow to use a SequenceTable instead of the navtive autoinc column type (see setUseSequenceTable(...)). 

Hence you might extend the postgree sql driver to specify which implmentation to use for the AUTOINC column type. You can use any of the three mentioned above or even a new method. But it should all be done in the driver. If you need to disinguish individual columns you may even set a column attribute and evaluate it in the driver (see DBColumn.setAttribute(...)).

If a column is set to type DataType.AUTOINC but not in the primary key it should still be initialized with a value if - and only if - the driver supports sequences. For this the driver must return true for a call to  isSupported(DBDriverFeature.SEQUENCES) and implment the method getNextSequenceValue(...).

I hope this answers your questions.
Regards

Rainer

Frank Lupo wrote:
> Re: postgresql AUTO_INC
> 
> The (DataType.AUTOINC) sequence has emulated using
> getRecordDefaultValue
> in DBTableColumn is a good idea.
> If using serial the value are insert in automatic mode on postgresql.
> My idea is create a new dataType DataType.AUTOINC_NATIVE.
> 
> Second question...
> I have create a column "version" DataType.AUTOINC no primarykey column.
> If update record AUTOINC is not update.
> In my opinion if column is not a primarykey the AUTOINC column must be
> updated.
> 
> 
> Francis De Brabandere ha scritto:
> > I'll have a look at all these issues this weekend, but if you have it
> > all fixed locally can you post a patch on jira?
> >
> > 2009/3/27 Frank Lupo <fr...@email.it>:
> >
> >> Hi,
> >> current datatype auto_inc in postgresql definition create a separate
> >> sequence.
> >> Why is not used serial type in postgresql?
> >>
> >> Best regards
> >>
> >>
> >> --
> >> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP
> >> autenticato? GRATIS solo con Email.it http://www.email.it/f
> >>
> >> Sponsor:
> >> Con Poker Club anche a Marzo il montepremi è garantito: ogni lunedì,
> giovedì
> >> e domenica vinci fino a 25.000 !
> >> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> >
> > Nessun virus nel messaggio in arrivo.
> > Controllato da AVG - www.avg.com
> > Versione: 8.0.238 / Database dei virus: 270.11.29/2024 -  Data di
> rilascio: 03/26/09 07:12:00
> >
> >
> 
> 
> 
> 
>  --
>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
> 
>  Sponsor:
>  Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana
> puoi vincere oltre 240.000€!
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3

Re: AW: postgresql AUTO_INC

Posted by Frank Lupo <fr...@email.it>.
Postgresql have the sequence, this idea if for not using native sequence 
but one table.

Matthew Bond ha scritto:
> I think Frank's the idea was to create one solution for all databases that don't support AUTO Increment fields.
> If you want to keep the DBDatabaseDriver free of the code then the best solution may be a new DBEmulatedSequenceDriver class that extends DBDatabaseDriver and put the code in there. Then the PostgreSQL Driver would just extend that.
>
> Cheers
> Matt
>
> -----Ursprüngliche Nachricht-----
> Von: Rainer Döbele [mailto:doebele@esteam.de] 
> Gesendet: Mittwoch, 1. April 2009 08:33
> An: empire-db-dev@incubator.apache.org
> Betreff: re: postgresql AUTO_INC
>
> Hi Frank,
>
> I am not quite sure what the intention of your email is.
>
> Empire-db has been designed in a way that allows easy application specific implementation of most functions.
> You may simply create a class that inherits from DBDatabaseDriverPostgreSQL and implement the methods below.
> There is no need to implement them further down in the hierarchy.
>
> You may however send us your implementation and we'll check wether we can add the code to our existing code-base.
>
> Regards
> Rainer
>
>
> Frank Lupo wrote:
>   
>> Re: postgresql AUTO_INC
>>
>> Ok
>> I implementig the emulate sequence table in DBDatabaseDriver
>> rename default getNextSequenceValue in getNextSequenceValueImpl
>> =====================================
>>     private boolean emulateSequenceTable = false;
>>     private String emulateSequenceTableName = "Sequences";
>>
>>     public boolean isEmulateSequenceTable() {
>>         return emulateSequenceTable;
>>     }
>>
>>     public void setEmulateSequenceTable(boolean emulateSequenceTable) {
>>         this.emulateSequenceTable = emulateSequenceTable;
>>     }
>>
>>     public String getEmulateSequenceTableName() {
>>         return emulateSequenceTableName;
>>     }
>>
>>     public void setEmulateSequenceTableName(String
>> emulateSequenceTableName) {
>>         this.emulateSequenceTableName = emulateSequenceTableName;
>>     }
>>
>>     public Object getNextSequenceValue(DBDatabase db,String seqName,
>> int
>> minValue, Connection conn){
>>         //check if emulated
>>         if (emulateSequenceTable)
>>         {
>>             // Use a sequence Table to generate Sequences
>>             DBSeqTable table =
>> (DBSeqTable)db.getTable(emulateSequenceTableName);
>>             if (table == null) {
>>                 table = new DBSeqTable(emulateSequenceTableName, db);
>>             }
>>
>>             return table.getNextValue(seqName, minValue, conn);
>>         }else {
>>             return getNextSequenceValueImpl(db, seqName, minValue,
>> conn);
>>         }
>>     }
>> ================================
>>
>>
>> Francis De Brabandere ha scritto:
>>     
>>> Rainer, what do you think about these ideas?
>>>
>>> Frank, could you create an issue for the second question (non-pk auto
>>>       
>> inc)?
>>     
>>> On Fri, Mar 27, 2009 at 11:32 AM, Frank Lupo <fr...@email.it>
>>>       
>> wrote:
>>     
>>>> The (DataType.AUTOINC) sequence has emulated using
>>>>         
>> getRecordDefaultValue in
>>     
>>>> DBTableColumn is a good idea.
>>>> If using serial the value are insert in automatic mode on
>>>>         
>> postgresql.
>>     
>>>> My idea is create a new dataType DataType.AUTOINC_NATIVE.
>>>>
>>>> Second question...
>>>> I have create a column "version" DataType.AUTOINC no primarykey
>>>>         
>> column.
>>     
>>>> If update record AUTOINC is not update.
>>>> In my opinion if column is not a primarykey the AUTOINC column must
>>>>         
>> be
>>     
>>>> updated.
>>>>
>>>>
>>>> Francis De Brabandere ha scritto:
>>>>
>>>>         
>>>>> I'll have a look at all these issues this weekend, but if you have
>>>>>           
>> it
>>     
>>>>> all fixed locally can you post a patch on jira?
>>>>>
>>>>> 2009/3/27 Frank Lupo <fr...@email.it>:
>>>>>
>>>>>
>>>>>           
>>>>>> Hi,
>>>>>> current datatype auto_inc in postgresql definition create a
>>>>>>             
>> separate
>>     
>>>>>> sequence.
>>>>>> Why is not used serial type in postgresql?
>>>>>>
>>>>>> Best regards
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3
>>>>>>             
>> e SMTP
>>     
>>>>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>>>>>
>>>>>> Sponsor:
>>>>>> Con Poker Club anche a Marzo il montepremi č garantito: ogni
>>>>>>             
>> lunedě,
>>     
>>>>>> giovedě
>>>>>> e domenica vinci fino a 25.000 !
>>>>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-
>>>>>>             
>> 3
>>     
>>>>>>
>>>>>>             
>>>>>  ------------------------------------------------------------------
>>>>>           
>> ------
>>     
>>>>> Nessun virus nel messaggio in arrivo.
>>>>> Controllato da AVG - www.avg.com Versione: 8.0.238 / Database dei
>>>>>           
>> virus:
>>     
>>>>> 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> --
>>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
>>>>         
>> SMTP
>>     
>>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>>>
>>>> Sponsor:
>>>> Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana
>>>>         
>> puoi
>>     
>>>> vincere oltre 240.000 EURO!
>>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3
>>>>
>>>>
>>>>         
>>>
>>>
>>> ---------------------------------------------------------------------
>>>       
>> ---
>>     
>>> Nessun virus nel messaggio in arrivo.
>>> Controllato da AVG - www.avg.com
>>> Versione: 8.0.238 / Database dei virus: 270.11.30/2026 -  Data di
>>>       
>> rilascio: 03/27/09 07:13:00
>>     
>>>       
>>
>>
>>  --
>>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
>> SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
>>
>>  Sponsor:
>>  Apre VideoAnnunciLavoro.net: dove domanda ed offerta di lavoro hanno
>> una marcia in piů. Se credi in te stesso fatti vedere! č gratuito
>>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8863&d=31-3
>> ------------------------------------------------------------------------
>>
>>
>> Nessun virus nel messaggio in arrivo.
>> Controllato da AVG - www.avg.com 
>> Versione: 8.0.238 / Database dei virus: 270.11.35/2033 -  Data di rilascio: 03/31/09 13:05:00
>>
>>     


 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana puoi vincere oltre 240.000€!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8802&d=1-4

AW: postgresql AUTO_INC

Posted by Matthew Bond <bo...@esteam.de>.
I think Frank's the idea was to create one solution for all databases that don't support AUTO Increment fields.
If you want to keep the DBDatabaseDriver free of the code then the best solution may be a new DBEmulatedSequenceDriver class that extends DBDatabaseDriver and put the code in there. Then the PostgreSQL Driver would just extend that.

Cheers
Matt

-----Ursprüngliche Nachricht-----
Von: Rainer Döbele [mailto:doebele@esteam.de] 
Gesendet: Mittwoch, 1. April 2009 08:33
An: empire-db-dev@incubator.apache.org
Betreff: re: postgresql AUTO_INC

Hi Frank,

I am not quite sure what the intention of your email is.

Empire-db has been designed in a way that allows easy application specific implementation of most functions.
You may simply create a class that inherits from DBDatabaseDriverPostgreSQL and implement the methods below.
There is no need to implement them further down in the hierarchy.

You may however send us your implementation and we'll check wether we can add the code to our existing code-base.

Regards
Rainer


Frank Lupo wrote:
> Re: postgresql AUTO_INC
> 
> Ok
> I implementig the emulate sequence table in DBDatabaseDriver
> rename default getNextSequenceValue in getNextSequenceValueImpl
> =====================================
>     private boolean emulateSequenceTable = false;
>     private String emulateSequenceTableName = "Sequences";
> 
>     public boolean isEmulateSequenceTable() {
>         return emulateSequenceTable;
>     }
> 
>     public void setEmulateSequenceTable(boolean emulateSequenceTable) {
>         this.emulateSequenceTable = emulateSequenceTable;
>     }
> 
>     public String getEmulateSequenceTableName() {
>         return emulateSequenceTableName;
>     }
> 
>     public void setEmulateSequenceTableName(String
> emulateSequenceTableName) {
>         this.emulateSequenceTableName = emulateSequenceTableName;
>     }
> 
>     public Object getNextSequenceValue(DBDatabase db,String seqName,
> int
> minValue, Connection conn){
>         //check if emulated
>         if (emulateSequenceTable)
>         {
>             // Use a sequence Table to generate Sequences
>             DBSeqTable table =
> (DBSeqTable)db.getTable(emulateSequenceTableName);
>             if (table == null) {
>                 table = new DBSeqTable(emulateSequenceTableName, db);
>             }
> 
>             return table.getNextValue(seqName, minValue, conn);
>         }else {
>             return getNextSequenceValueImpl(db, seqName, minValue,
> conn);
>         }
>     }
> ================================
> 
> 
> Francis De Brabandere ha scritto:
> > Rainer, what do you think about these ideas?
> >
> > Frank, could you create an issue for the second question (non-pk auto
> inc)?
> >
> > On Fri, Mar 27, 2009 at 11:32 AM, Frank Lupo <fr...@email.it>
> wrote:
> >
> >> The (DataType.AUTOINC) sequence has emulated using
> getRecordDefaultValue in
> >> DBTableColumn is a good idea.
> >> If using serial the value are insert in automatic mode on
> postgresql.
> >> My idea is create a new dataType DataType.AUTOINC_NATIVE.
> >>
> >> Second question...
> >> I have create a column "version" DataType.AUTOINC no primarykey
> column.
> >> If update record AUTOINC is not update.
> >> In my opinion if column is not a primarykey the AUTOINC column must
> be
> >> updated.
> >>
> >>
> >> Francis De Brabandere ha scritto:
> >>
> >>> I'll have a look at all these issues this weekend, but if you have
> it
> >>> all fixed locally can you post a patch on jira?
> >>>
> >>> 2009/3/27 Frank Lupo <fr...@email.it>:
> >>>
> >>>
> >>>> Hi,
> >>>> current datatype auto_inc in postgresql definition create a
> separate
> >>>> sequence.
> >>>> Why is not used serial type in postgresql?
> >>>>
> >>>> Best regards
> >>>>
> >>>>
> >>>> --
> >>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3
> e SMTP
> >>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
> >>>>
> >>>> Sponsor:
> >>>> Con Poker Club anche a Marzo il montepremi č garantito: ogni
> lunedě,
> >>>> giovedě
> >>>> e domenica vinci fino a 25.000 !
> >>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-
> 3
> >>>>
> >>>>
> >>>>
> >>>
> >>>  ------------------------------------------------------------------
> ------
> >>>
> >>>
> >>> Nessun virus nel messaggio in arrivo.
> >>> Controllato da AVG - www.avg.com Versione: 8.0.238 / Database dei
> virus:
> >>> 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
> >>>
> >>>
> >>>
> >>
> >>
> >> --
> >> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP
> >> autenticato? GRATIS solo con Email.it http://www.email.it/f
> >>
> >> Sponsor:
> >> Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana
> puoi
> >> vincere oltre 240.000 EURO!
> >> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> >
> > Nessun virus nel messaggio in arrivo.
> > Controllato da AVG - www.avg.com
> > Versione: 8.0.238 / Database dei virus: 270.11.30/2026 -  Data di
> rilascio: 03/27/09 07:13:00
> >
> >
> 
> 
> 
> 
>  --
>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
> 
>  Sponsor:
>  Apre VideoAnnunciLavoro.net: dove domanda ed offerta di lavoro hanno
> una marcia in piů. Se credi in te stesso fatti vedere! č gratuito
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8863&d=31-3

re: postgresql AUTO_INC

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

I am not quite sure what the intention of your email is.

Empire-db has been designed in a way that allows easy application specific implementation of most functions.
You may simply create a class that inherits from DBDatabaseDriverPostgreSQL and implement the methods below.
There is no need to implement them further down in the hierarchy.

You may however send us your implementation and we'll check wether we can add the code to our existing code-base.

Regards
Rainer


Frank Lupo wrote:
> Re: postgresql AUTO_INC
> 
> Ok
> I implementig the emulate sequence table in DBDatabaseDriver
> rename default getNextSequenceValue in getNextSequenceValueImpl
> =====================================
>     private boolean emulateSequenceTable = false;
>     private String emulateSequenceTableName = "Sequences";
> 
>     public boolean isEmulateSequenceTable() {
>         return emulateSequenceTable;
>     }
> 
>     public void setEmulateSequenceTable(boolean emulateSequenceTable) {
>         this.emulateSequenceTable = emulateSequenceTable;
>     }
> 
>     public String getEmulateSequenceTableName() {
>         return emulateSequenceTableName;
>     }
> 
>     public void setEmulateSequenceTableName(String
> emulateSequenceTableName) {
>         this.emulateSequenceTableName = emulateSequenceTableName;
>     }
> 
>     public Object getNextSequenceValue(DBDatabase db,String seqName,
> int
> minValue, Connection conn){
>         //check if emulated
>         if (emulateSequenceTable)
>         {
>             // Use a sequence Table to generate Sequences
>             DBSeqTable table =
> (DBSeqTable)db.getTable(emulateSequenceTableName);
>             if (table == null) {
>                 table = new DBSeqTable(emulateSequenceTableName, db);
>             }
> 
>             return table.getNextValue(seqName, minValue, conn);
>         }else {
>             return getNextSequenceValueImpl(db, seqName, minValue,
> conn);
>         }
>     }
> ================================
> 
> 
> Francis De Brabandere ha scritto:
> > Rainer, what do you think about these ideas?
> >
> > Frank, could you create an issue for the second question (non-pk auto
> inc)?
> >
> > On Fri, Mar 27, 2009 at 11:32 AM, Frank Lupo <fr...@email.it>
> wrote:
> >
> >> The (DataType.AUTOINC) sequence has emulated using
> getRecordDefaultValue in
> >> DBTableColumn is a good idea.
> >> If using serial the value are insert in automatic mode on
> postgresql.
> >> My idea is create a new dataType DataType.AUTOINC_NATIVE.
> >>
> >> Second question...
> >> I have create a column "version" DataType.AUTOINC no primarykey
> column.
> >> If update record AUTOINC is not update.
> >> In my opinion if column is not a primarykey the AUTOINC column must
> be
> >> updated.
> >>
> >>
> >> Francis De Brabandere ha scritto:
> >>
> >>> I'll have a look at all these issues this weekend, but if you have
> it
> >>> all fixed locally can you post a patch on jira?
> >>>
> >>> 2009/3/27 Frank Lupo <fr...@email.it>:
> >>>
> >>>
> >>>> Hi,
> >>>> current datatype auto_inc in postgresql definition create a
> separate
> >>>> sequence.
> >>>> Why is not used serial type in postgresql?
> >>>>
> >>>> Best regards
> >>>>
> >>>>
> >>>> --
> >>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3
> e SMTP
> >>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
> >>>>
> >>>> Sponsor:
> >>>> Con Poker Club anche a Marzo il montepremi č garantito: ogni
> lunedě,
> >>>> giovedě
> >>>> e domenica vinci fino a 25.000 !
> >>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-
> 3
> >>>>
> >>>>
> >>>>
> >>>
> >>>  ------------------------------------------------------------------
> ------
> >>>
> >>>
> >>> Nessun virus nel messaggio in arrivo.
> >>> Controllato da AVG - www.avg.com Versione: 8.0.238 / Database dei
> virus:
> >>> 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
> >>>
> >>>
> >>>
> >>
> >>
> >> --
> >> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP
> >> autenticato? GRATIS solo con Email.it http://www.email.it/f
> >>
> >> Sponsor:
> >> Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana
> puoi
> >> vincere oltre 240.000 EURO!
> >> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> >
> > Nessun virus nel messaggio in arrivo.
> > Controllato da AVG - www.avg.com
> > Versione: 8.0.238 / Database dei virus: 270.11.30/2026 -  Data di
> rilascio: 03/27/09 07:13:00
> >
> >
> 
> 
> 
> 
>  --
>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
> 
>  Sponsor:
>  Apre VideoAnnunciLavoro.net: dove domanda ed offerta di lavoro hanno
> una marcia in piů. Se credi in te stesso fatti vedere! č gratuito
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8863&d=31-3

Re: postgresql AUTO_INC

Posted by Frank Lupo <fr...@email.it>.
Ok
I implementig the emulate sequence table in DBDatabaseDriver
rename default getNextSequenceValue in getNextSequenceValueImpl
=====================================
    private boolean emulateSequenceTable = false;
    private String emulateSequenceTableName = "Sequences";

    public boolean isEmulateSequenceTable() {
        return emulateSequenceTable;
    }

    public void setEmulateSequenceTable(boolean emulateSequenceTable) {
        this.emulateSequenceTable = emulateSequenceTable;
    }

    public String getEmulateSequenceTableName() {
        return emulateSequenceTableName;
    }

    public void setEmulateSequenceTableName(String 
emulateSequenceTableName) {
        this.emulateSequenceTableName = emulateSequenceTableName;
    }

    public Object getNextSequenceValue(DBDatabase db,String seqName, int 
minValue, Connection conn){
        //check if emulated
        if (emulateSequenceTable)
        {  
            // Use a sequence Table to generate Sequences
            DBSeqTable table = 
(DBSeqTable)db.getTable(emulateSequenceTableName);
            if (table == null) {
                table = new DBSeqTable(emulateSequenceTableName, db);
            }
           
            return table.getNextValue(seqName, minValue, conn);
        }else {
            return getNextSequenceValueImpl(db, seqName, minValue, conn);
        }
    }
================================


Francis De Brabandere ha scritto:
> Rainer, what do you think about these ideas?
>
> Frank, could you create an issue for the second question (non-pk auto inc)?
>
> On Fri, Mar 27, 2009 at 11:32 AM, Frank Lupo <fr...@email.it> wrote:
>   
>> The (DataType.AUTOINC) sequence has emulated using getRecordDefaultValue in
>> DBTableColumn is a good idea.
>> If using serial the value are insert in automatic mode on postgresql.
>> My idea is create a new dataType DataType.AUTOINC_NATIVE.
>>
>> Second question...
>> I have create a column "version" DataType.AUTOINC no primarykey column.
>> If update record AUTOINC is not update.
>> In my opinion if column is not a primarykey the AUTOINC column must be
>> updated.
>>
>>
>> Francis De Brabandere ha scritto:
>>     
>>> I'll have a look at all these issues this weekend, but if you have it
>>> all fixed locally can you post a patch on jira?
>>>
>>> 2009/3/27 Frank Lupo <fr...@email.it>:
>>>
>>>       
>>>> Hi,
>>>> current datatype auto_inc in postgresql definition create a separate
>>>> sequence.
>>>> Why is not used serial type in postgresql?
>>>>
>>>> Best regards
>>>>
>>>>
>>>> --
>>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
>>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>>>
>>>> Sponsor:
>>>> Con Poker Club anche a Marzo il montepremi č garantito: ogni lunedě,
>>>> giovedě
>>>> e domenica vinci fino a 25.000 !
>>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3
>>>>
>>>>
>>>>         
>>>
>>>  ------------------------------------------------------------------------
>>>
>>>
>>> Nessun virus nel messaggio in arrivo.
>>> Controllato da AVG - www.avg.com Versione: 8.0.238 / Database dei virus:
>>> 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
>>>
>>>
>>>       
>>
>>
>> --
>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>
>> Sponsor:
>> Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana puoi
>> vincere oltre 240.000 EURO!
>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
>
> Nessun virus nel messaggio in arrivo.
> Controllato da AVG - www.avg.com 
> Versione: 8.0.238 / Database dei virus: 270.11.30/2026 -  Data di rilascio: 03/27/09 07:13:00
>
>   


 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Apre VideoAnnunciLavoro.net: dove domanda ed offerta di lavoro hanno una marcia in piů. Se credi in te stesso fatti vedere! č gratuito
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8863&d=31-3

Re: postgresql AUTO_INC

Posted by Francis De Brabandere <fr...@gmail.com>.
Rainer, what do you think about these ideas?

Frank, could you create an issue for the second question (non-pk auto inc)?

On Fri, Mar 27, 2009 at 11:32 AM, Frank Lupo <fr...@email.it> wrote:
> The (DataType.AUTOINC) sequence has emulated using getRecordDefaultValue in
> DBTableColumn is a good idea.
> If using serial the value are insert in automatic mode on postgresql.
> My idea is create a new dataType DataType.AUTOINC_NATIVE.
>
> Second question...
> I have create a column "version" DataType.AUTOINC no primarykey column.
> If update record AUTOINC is not update.
> In my opinion if column is not a primarykey the AUTOINC column must be
> updated.
>
>
> Francis De Brabandere ha scritto:
>>
>> I'll have a look at all these issues this weekend, but if you have it
>> all fixed locally can you post a patch on jira?
>>
>> 2009/3/27 Frank Lupo <fr...@email.it>:
>>
>>>
>>> Hi,
>>> current datatype auto_inc in postgresql definition create a separate
>>> sequence.
>>> Why is not used serial type in postgresql?
>>>
>>> Best regards
>>>
>>>
>>> --
>>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
>>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>>
>>> Sponsor:
>>> Con Poker Club anche a Marzo il montepremi č garantito: ogni lunedě,
>>> giovedě
>>> e domenica vinci fino a 25.000 !
>>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3
>>>
>>>
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>
>> Nessun virus nel messaggio in arrivo.
>> Controllato da AVG - www.avg.com Versione: 8.0.238 / Database dei virus:
>> 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
>>
>>
>
>
>
>
> --
> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it http://www.email.it/f
>
> Sponsor:
> Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana puoi
> vincere oltre 240.000 EURO!
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3
>



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

Re: postgresql AUTO_INC

Posted by Frank Lupo <fr...@email.it>.
The (DataType.AUTOINC) sequence has emulated using getRecordDefaultValue 
in DBTableColumn is a good idea.
If using serial the value are insert in automatic mode on postgresql.
My idea is create a new dataType DataType.AUTOINC_NATIVE.

Second question...
I have create a column "version" DataType.AUTOINC no primarykey column.
If update record AUTOINC is not update.
In my opinion if column is not a primarykey the AUTOINC column must be 
updated.


Francis De Brabandere ha scritto:
> I'll have a look at all these issues this weekend, but if you have it
> all fixed locally can you post a patch on jira?
>
> 2009/3/27 Frank Lupo <fr...@email.it>:
>   
>> Hi,
>> current datatype auto_inc in postgresql definition create a separate
>> sequence.
>> Why is not used serial type in postgresql?
>>
>> Best regards
>>
>>
>> --
>> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
>> autenticato? GRATIS solo con Email.it http://www.email.it/f
>>
>> Sponsor:
>> Con Poker Club anche a Marzo il montepremi è garantito: ogni lunedì, giovedì
>> e domenica vinci fino a 25.000 !
>> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
>
> Nessun virus nel messaggio in arrivo.
> Controllato da AVG - www.avg.com 
> Versione: 8.0.238 / Database dei virus: 270.11.29/2024 -  Data di rilascio: 03/26/09 07:12:00
>
>   


 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Gioca con Poker Club! Scegli il torneo che fa per te, ogni settimana puoi vincere oltre 240.000€!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8805&d=27-3

Re: postgresql AUTO_INC

Posted by Francis De Brabandere <fr...@gmail.com>.
I'll have a look at all these issues this weekend, but if you have it
all fixed locally can you post a patch on jira?

2009/3/27 Frank Lupo <fr...@email.it>:
> Hi,
> current datatype auto_inc in postgresql definition create a separate
> sequence.
> Why is not used serial type in postgresql?
>
> Best regards
>
>
> --
> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it http://www.email.it/f
>
> Sponsor:
> Con Poker Club anche a Marzo il montepremi è garantito: ogni lunedì, giovedì
> e domenica vinci fino a 25.000 !
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8806&d=27-3
>



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