incubator-empire-db-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Lupo <frank_l...@email.it>
Subject Re: AW: postgresql AUTO_INC
Date Wed, 01 Apr 2009 09:33:35 GMT
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 <frank_lupo@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 <frank_lupo@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message