jon * <[EMAIL PROTECTED]> writes:

> 
> gag...why is there an autoupdate in the MySQL schema? You don't need to do
> that if you use Turbine's IDBroker...
> 

The table locking used by the IDBroker could possibly prove to be a
performance problem with applications that do have a lot of updates. I
do personally like to depend  on the way the database allocates new ids.

Maybe one should look into a simple API that allowed you to use 
sequences for Oracle and PostgreSQL, IDENTITY for Sybase and SQL Server,
auto increment for MySQL and some other hack for databases like Progress
that don't have sequences or auto increment.

I think the DB interface in Turbine would be a good place to add such an
API. I see that there already are couple of undocumented methods there that
are related.  

Maybe something like this could be enough :

// Returns -1 if an autoincrement/identity field is used. 
long nextID = db.getNewID(conn, tableName);

-- perform the database insert, with the parameters depending on the 
   the value nextID 
--

if(nextID == -1){
    // For autoincrement fields we will have to read out the value
    // after the insert.
    nextID = db.getLastInsertID(conn);  
}


I think something like this would be a reasonable abstraction of the id
generation that may give us a lot more scalable implementations than the
current IDBroker interface. 

The "long" datatype above should maybe also be something else, so one
doesn't put any silly restrictions on precision of an id column. BigDecimal
is probably the right datatype for this.

Regards, 

        Gunnar



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to