creole
[ class tree: creole ] [ index: creole ] [ all elements ]

Class: IdGenerator

Source Location: /creole/IdGenerator.php

Interface Overview


Interface for classes that provide functionality to get SEQUENCE or AUTO-INCREMENT ids from the database.


Author(s):

Version:

  • $Revision: 1.3 $

Constants

Methods


Child classes:

OCI8IdGenerator
Oracle (OCI8) IdGenerator implimenation.

Class Details

[line 10]
Interface for classes that provide functionality to get SEQUENCE or AUTO-INCREMENT ids from the database.



Tags:

version:  $Revision: 1.3 $
author:  Hans Lellelid <hans@xmpl.org>


[ Top ]


Class Methods


method getId [line 54]

int getId( [mixed $keyInfo = null])

Get the autoincrement or sequence id given the current connection and any additional needed info (e.g. sequence name for sequences).

Note: if you take advantage of the fact that $keyInfo may not be specified you should make sure that your code is setup in such a way that it will be portable if you change from an RDBMS that uses AUTOINCREMENT to one that uses SEQUENCE (i.e. in which case you would need to specify sequence name).




Tags:

return:  The last id / next id.
access:  public


Overridden in child classes as:

OCI8IdGenerator::getId()

Parameters:

mixed   $keyInfo   Any additional information (e.g. sequence name) needed to fetch the id.

[ Top ]

method getIdMethod [line 40]

int getIdMethod( )

Get the preferred type / style for generating ids for RDBMS.



Tags:

return:  SEQUENCE or AUTOINCREMENT
access:  public


Overridden in child classes as:

OCI8IdGenerator::getIdMethod()

[ Top ]

method isAfterInsert [line 34]

boolean isAfterInsert( )

Convenience method that returns TRUE if id is generated after an INSERT statement. This is the same as checking whether the generator type is AUTOINCREMENT.



Tags:

return:  TRUE if gen id method is AUTOINCREMENT
access:  public
see:  IdGenerator::getIdMethod()


Overridden in child classes as:

OCI8IdGenerator::isAfterInsert()

[ Top ]

method isBeforeInsert [line 25]

boolean isBeforeInsert( )

Convenience method that returns TRUE if id is generated before an INSERT statement. This is the same as checking whether the generator type is SEQUENCE.



Tags:

return:  TRUE if gen id method is SEQUENCE
access:  public
see:  IdGenerator::getIdMethod()


Overridden in child classes as:

OCI8IdGenerator::isBeforeInsert()

[ Top ]


Class Constants

AUTOINCREMENT =  2

[line 16]

AUTO INCREMENT id generator type


[ Top ]

SEQUENCE =  1

[line 13]

SEQUENCE id generator type


[ Top ]



Documentation generated on Mon, 23 Aug 2004 21:51:30 -0400 by phpDocumentor 1.3.0RC3