jnicli
Interface DatabaseSession

All Known Implementing Classes:
DatabaseSessionServer

public interface DatabaseSession

Database session interface. This interface is used for communication with remote database server using RMI.


Method Summary
 long attach()
          Attach thread to the database.
 void close(long session)
          Close database
 void commit(long session)
          Commit current transaction.
 int delete(long session, java.lang.Class table, java.lang.String condition)
          Delete all objects from the table matching specified condition
 void detach(long session, int flags)
          Detach thread to the database.
 long insert(long session, java.lang.Object obj)
          Insert new object in the database.
 void lock(long session)
          Lock database in exclusive mode.
 long open(int accessType, java.lang.String databaseName, java.lang.String databasePath, long initSize, int transactionCommitDelay)
          Open database
 void rollback(long session)
          Commit current transaction Transaction is implicitly started when any database operation is perfromed.
 Cursor select(long session, java.lang.Class table, java.lang.String condition, int flags)
          Select objects from table matching condition
 void update(long session, long oid, java.lang.Object obj)
          Update object with soecified OID
 

Method Detail

open

public long open(int accessType,
                 java.lang.String databaseName,
                 java.lang.String databasePath,
                 long initSize,
                 int transactionCommitDelay)
Open database

Parameters:
accessType - database access type: one of READ_ONLY, READ_WRITE, CONCURRENT_READ or CONCURRENT_UPDATE
databaseName - database name
databasePath - path to the database file
initSize - initial size of database
transactionCommitDelay - transaction commit delay (specify 0 to disable)
Returns:
database session identifier

close

public void close(long session)
Close database

Parameters:
session - session identifier

select

public Cursor select(long session,
                     java.lang.Class table,
                     java.lang.String condition,
                     int flags)
Select objects from table matching condition

Parameters:
session - session identifier
table - class corresponding to the table
condition - SubSQL condition (to select all records pass empty string)
flags - combination of FOR_UPDATE and AUTOCOMMIT flags
Returns:
cursor for selected objects

update

public void update(long session,
                   long oid,
                   java.lang.Object obj)
Update object with soecified OID

Parameters:
session - session identifier
oid - OID of updated object
obj - updated object

insert

public long insert(long session,
                   java.lang.Object obj)
Insert new object in the database. Object will be inserted in the table with the same name as object class

Parameters:
session - session identifier
obj - inserted object
Returns:
OID of inserted object

delete

public int delete(long session,
                  java.lang.Class table,
                  java.lang.String condition)
Delete all objects from the table matching specified condition

Parameters:
session - session identifier
table - class corresponding to the table
condition - SubSQL condition (to delete all records pass empty string)
Returns:
number of deleted objects

commit

public void commit(long session)
Commit current transaction. Transaction is implicitly started when any database operation is perfromed.

Parameters:
session - session identifier

rollback

public void rollback(long session)
Commit current transaction Transaction is implicitly started when any database operation is perfromed.

Parameters:
session - session identifier

lock

public void lock(long session)
Lock database in exclusive mode. Lock is automatically released when transaction is committed or aborted

Parameters:
session - session identifier

attach

public long attach()
Attach thread to the database. All threads except the one opened the database should invoke this method before start working with database

Returns:
database session identifier

detach

public void detach(long session,
                   int flags)
Detach thread to the database. All threads except the one opened the database should invoke this method before start working with database

Parameters:
flags - combination of CLI_DETACH_COMMIT and CLI_DETACH_DESTROY_CONTEXT flags
session - session identifier