|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
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 |
CLI_OPEN_DEFAULT
|
static int |
CLI_OPEN_NO_BUFFERING
|
static int |
CLI_OPEN_NO_SYNC
|
static int |
CLI_OPEN_READONLY
|
static int |
CLI_OPEN_SEQUENTIAL
|
static int |
CLI_OPEN_TRUNCATE
|
static int |
FOR_UPDATE
Select flag FOR_UPDATE: make it possible to update selected records |
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(java.lang.String databasePath,
int poolSize,
int openAttr,
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 |
---|
static final int CLI_OPEN_DEFAULT
static final int CLI_OPEN_READONLY
static final int CLI_OPEN_TRUNCATE
static final int CLI_OPEN_SEQUENTIAL
static final int CLI_OPEN_NO_BUFFERING
static final int CLI_OPEN_NO_SYNC
static final int FOR_UPDATE
static final int AUTOCOMMIT
static final int CLI_DETACH_COMMIT
static final int CLI_DETACH_DESTROY_CONTEXT
static final int CLI_DETACH_DEFAULT
Method Detail |
---|
void open(java.lang.String databasePath, int poolSize, int openAttr, int transactionCommitDelay)
databasePath
- - path to the database filepoolSize
- - size of page pool (in pages), specify 0 to let Gigabase automatically detect pool sizeopenAttr
- - mask of CLI_OPEN_* attributes (0 default value)transactionCommitDelay
- - transaction commit delay (specify 0 to disable)void close()
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
void update(long oid, java.lang.Object obj)
oid
- OID of updated objectobj
- updated objectlong insert(java.lang.Object obj)
obj
- inserted object
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)
void commit()
void rollback()
void lock()
void attach()
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 |