|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class is used as interface to local or remote database (through RMI). In case of local connections you should create instance of DatabaseJNI class directly. In case of remote connection, it is necessary to create instance of DatabaseSessionClient class and path reference to the stub object implementing DatabaseSession interface.
Methods of this interface are mostly one-to-one mapped to methods of C++ dbDatabase class. In case of remote application, it should either open or create new database at server using Database.open method, either attach to the existing database using Database.attach method. In case of local application, Database.attach should be used by all application threads except one opened the database.
All database access errors are reported by means of CliException. In case of remote database there are also can be exceptions related with server communication.
Field Summary | |
static int |
AUTOCOMMIT
Select flag AUTOCOMMIT: automatically commit current transaction after completion of selection |
static int |
CLI_DETACH_COMMIT
|
static int |
CLI_DETACH_DEFAULT
|
static int |
CLI_DETACH_DESTROY_CONTEXT
|
static int |
CONCURRENT_READ
|
static int |
CONCURRENT_UPDATE
|
static int |
FOR_UPDATE
Select flag FOR_UPDATE: make it possible to update selected records |
static int |
READ_ONLY
|
static int |
READ_WRITE
|
Method Summary | |
void |
attach()
Attach thread to the database. |
void |
close()
Close database |
void |
commit()
Commit current transaction. |
int |
delete(java.lang.Class table,
java.lang.String condition)
Delete all objects from the table matching specified condition |
void |
detach(int flags)
Detach thread to the database. |
long |
insert(java.lang.Object obj)
Insert new object in the database. |
void |
lock()
Lock database in exclusive mode. |
void |
open(int accessType,
java.lang.String databaseName,
java.lang.String databasePath,
long initSize,
int transactionCommitDelay)
Open database |
void |
rollback()
Commit current transaction Transaction is implicitly started when any database operation is perfromed. |
Cursor |
select(java.lang.Class table,
java.lang.String condition,
int flags)
Select objects from table matching condition |
void |
update(long oid,
java.lang.Object obj)
Update object with soecified OID |
Field Detail |
public static final int READ_ONLY
public static final int READ_WRITE
public static final int CONCURRENT_READ
public static final int CONCURRENT_UPDATE
public static final int FOR_UPDATE
public static final int AUTOCOMMIT
public static final int CLI_DETACH_COMMIT
public static final int CLI_DETACH_DESTROY_CONTEXT
public static final int CLI_DETACH_DEFAULT
Method Detail |
public void open(int accessType, java.lang.String databaseName, java.lang.String databasePath, long initSize, int transactionCommitDelay)
accessType
- database access type: one of READ_ONLY, READ_WRITE, CONCURRENT_READ or CONCURRENT_UPDATEdatabaseName
- database namedatabasePath
- path to the database fileinitSize
- initial size of databasetransactionCommitDelay
- transaction commit delay (specify 0 to disable)public void close()
public Cursor select(java.lang.Class table, java.lang.String condition, int flags)
table
- class corresponding to the tablecondition
- SubSQL condition (to select all records pass empty string)flags
- combination of FOR_UPDATE and AUTOCOMMIT flags
public void update(long oid, java.lang.Object obj)
oid
- OID of updated objectobj
- updated objectpublic long insert(java.lang.Object obj)
obj
- inserted object
public int delete(java.lang.Class table, java.lang.String condition)
table
- class corresponding to the tablecondition
- SubSQL condition (to delete all records pass empty string)
public void commit()
public void rollback()
public void lock()
public void attach()
public void detach(int flags)
flags
- combination of CLI_DETACH_COMMIT and CLI_DETACH_DESTROY_CONTEXT flags
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |