ISequenceMgr interface (deprecated)
ISequenceMgr is deprecated and is provided for backward compatibility only.
The ISequenceMgr interface provides methods for creating and retrieving an ISequence object, which represents a sequence in an underlying database. Sequences provide unique, incremental numbers assigned to records in a database. After creating a sequence by calling createSequence( ), the AppLogic can use methods in the ISequence interface (deprecated) to retrieve sequence values.
The ISequenceMgr interface is part of the Data Access Engine (DAE) service.
The ISequenceMgr interface is implemented by the IDataConn object. To use it, cast IDataConn to the ISequenceMgr interface, as shown in the following example:
IDataConn dc;
dc = createDataConn(...);
ISequenceMgr sm;
sm = (ISequenceMgr) dc;
Package
com.kivasoft
Methods
Related Topics
ISequence interface (deprecated)
createSequence( )
Creates a new sequence object in the underlying database.
Syntax
public ISequence createSequence(
String szName,
String szCol,
int dwStart,
int dwIncrement,
String szOptions);
szName.
Name of the sequence. The name can be simple (such as "mySeq") or qualified with the name of the database owner (such as "mary.mySeq").
szCol.
Name of the column in the database table to use if the database supports sequence column types. For more information, see your database vendor's documentation. If null, defaults to "SEQVAL".
dwStart.
Starting value of the sequence. Must be a positive integer.
dwIncrement.
Value by which to increment the sequence with each call to getNext( ). Must be a positive integer. Defaults to one (1). Not all databases support this feature. For more information, see your database vendor's documentation.
szOptions.
Additional sequence creation options that are database vendor-specific:
For more information, see your database vendor's documentation.
Usage
Use createSequence( ) to create a new ISequence object, representing an incremental number generator, with the specified starting value. The AppLogic can then use methods in the ISequence interface (deprecated) to obtain the current or next value of this sequence object.
Sequences provide unique, incremental numbers assigned to records in a database. For example, you can create a customer ID sequence to generate customer IDs, or create a purchase order sequence to generate purchase order numbers.
Tip
For Oracle databases, createSequence( ) creates a sequence object. For Sybase, Informix, and Microsoft SQL Server databases, createSequence( ) creates a table object with a sequence column.
Return Value
ISequence object, or null for failure (such as an invalid database connection).
Example
IDataConn conn;
conn = createDataConn(0, GX_DA_DAD_DRIVERS.GX_DA_DRIVER_ODBC,
"salesDB", "salesDB", "steve", "pass7878");
// Cast the connection to an ISequenceMgr interface
// and set up the sequence
ISequence seq;
seq = ((ISequenceMgr) conn).createSequence("mySeq", "orders.ID", 100, 1,
null)
// To start the sequence, call getNext().
int seqVal;
seqVal = seq.getNext();
// Use the sequence number to perform the task for
// which you created it.
IQuery qry = createQuery();
qry.setSQL("INSERT into orders (ID) values ("+ seqVal +")," +
"(cust) values ("+ custname +")");
Related Topics
ISequence interface (deprecated)
getSequence( )
Returns an existing sequence object, for the specified sequence name, from the underlying database.
Syntax
szName.
Name of the sequence. The name can be simple (such as "mySeq") or qualified with the name of the database owner (such as "mary.mySeq").
szCol.
Name of the column in the database table to use if the database supports sequence column types. For more information, see your database vendor's documentation. If null, defaults to "SEQVAL".
Usage
Use getSequence( ) to obtain the ISequence object with the specified name in the underlying database. The AppLogic can then use methods in the ISequence interface (deprecated) to obtain the current or next value of this sequence object.
Sequences provide unique, incremental numbers assigned to records in a database. For example, you can create a customer ID sequence to generate customer IDs, or create a purchase order sequence to generate purchase order numbers.
Rules
Return Value
ISequence object, or null for failure (such as an invalid sequence name).
Related Topics
ISequence interface (deprecated)
|