org.openstreetmap.osmosis.core.apidb.common
Class MysqlIdentityValueLoader

java.lang.Object
  extended by org.openstreetmap.osmosis.core.apidb.common.MysqlIdentityValueLoader
All Implemented Interfaces:
IdentityValueLoader, Releasable

public class MysqlIdentityValueLoader
extends java.lang.Object
implements IdentityValueLoader

Mysql implementation of an identity value loader.

Author:
Brett Henderson

Constructor Summary
MysqlIdentityValueLoader(DatabaseContext dbCtx)
          Creates a new instance.
 
Method Summary
 long getLastInsertId()
          Returns the id of the most recently inserted row on the current connection.
 long getLastSequenceId(java.lang.String sequenceName)
          Returns the most recently returned value from the specified sequence on the current connection.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MysqlIdentityValueLoader

public MysqlIdentityValueLoader(DatabaseContext dbCtx)
Creates a new instance.

Parameters:
dbCtx - The database context to use for all database access.
Method Detail

getLastInsertId

public long getLastInsertId()
Returns the id of the most recently inserted row on the current connection.

Specified by:
getLastInsertId in interface IdentityValueLoader
Returns:
The newly inserted id.

getLastSequenceId

public long getLastSequenceId(java.lang.String sequenceName)
Returns the most recently returned value from the specified sequence on the current connection.

Specified by:
getLastSequenceId in interface IdentityValueLoader
Parameters:
sequenceName - The name of the sequence to query.
Returns:
The most recent sequence id.

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable