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 <[email protected]>: > > > >> 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
