Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

look::DbUniqueId Class Reference

A class for managing unique ids. More...

#include <dbuniqueid.h>

List of all members.

Public Methods

 DbUniqueId (const LookString &theName, const DbConnection *theConnection)
 Constructor. More...

virtual ~DbUniqueId ()
 Destructor.

long Generate (void)
 Get the next id. More...


Detailed Description

A class for managing unique ids.

(this really belongs somewhere else)

Some databases provide a mechanism for providing unique numbers - eg SEQUENCES in Oracle. Some don't, and this can be used on these.

Concurrency may be an issue with this, so it needs thinking about before using on really big systems.

It relies on having a table 'control_fs' with columns 'name' (VARCHAR?) and 'next_number' (NUMBER/INTEGER?).

Each time a unique id is asked for for a name, the row in control_fs corresponding to that name is queried and the next_number incremented. The old next_number is returned. (If necessary, a new row is inserted into control_fs).

The insert/update is performed on a separate connection and hence transaction.


Constructor & Destructor Documentation

look::DbUniqueId::DbUniqueId ( const LookString & theName,
const DbConnection * theConnection )
 

Constructor.

Parameters:
name   ' in control_fs
theConnection   Connection to copy from.


Member Function Documentation

long look::DbUniqueId::Generate ( void )
 

Get the next id.

Returns:
Next id


The documentation for this class was generated from the following files:
Generated at Thu Jan 17 12:53:08 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001