Abstract base class for the KDBM package. More...
#include <kdbm.h>
The KGDbm class is an internal class for implementing KDbm and KIntDbm. For an introductory guide, see KDbm documentation.
Used for the open method.
Create a new database. If a database with the same name already exists, then it is replaced by the new database. The created database is open for reading and writing in exclusive mode.
file | is the name of the file in which the database is stored. |
Open an existing database or, if a database with the given name does not exist and setForceMode(true) has been previously invoked, create a new one.
Many readers can access the database at the same time. If a database is open for writing, the access is exclusive.
file | is the name of the database file. |
mode |
can be either KGDbm::read (default) or KGDbm::readWrite .
KGDbm::readWrite implies exclusive database access.
|
Close the last opened database.
If there is a file system error during a database operation, returns the error code.
If there is a gdbm error during a database operation, returns the
error code. (see gdbm.h
for error codes).
Return true if the last searched item has been found.
Should be checked after using []
or take
to
retrieve database items.
Reorganize the current database.
If you have had a lot of deletions and would like to shrink the space used by the `gdbm' file, this function will reorganize the database. `gdbm' will not shorten the length of a `gdbm' file (deleted file space will be reused) except by using this reorganization. `reorganize' should be used very seldom.
Allows the programmer to make sure the disk version of the database has been completely updated with all changes to the current time.
If the fast mode has been set, the database engine does not wait for writes to the disk to complete before continuing. This allows faster writing of databases at the risk of having a corrupted database if the application terminates in an abnormal fashion. `sync' is usually called after a complete set of changes have been made to the database and before some long waiting time. Note that the close method automatically invokes sync.
Return true if data buffering is enabled.
Enable buffering for retrieved items. Since buffering is enabled by default, this function is meaningful only after a call to disableBuffer.
Disable buffering for retrieved items: users must explicitly release pointers to retrieved database items when no more needed.
If _newSize >= 0
, resizes the current buffer.
resizeBuffer(0) will just return the current
buffer size, leaving it unchanged.
Since the buffer grows to fit retrieved items, this method is useful to reduce the size of the buffer periodically.
Return true if this object is associated to an open database. Can be checked after a create or open operation to test if the database is really opened.
If this property is set to true before an open operation is attempted, then the database is created if it does not exist. Otherwise (default) open will fail.
See setForceFlag.
Used during the database creation to determine the size of various constructs. It is the size of a single transfer from disk to memory. This parameter is ignored if the file has been previously initialized. The minimum size is 512. If the value is less than 512, the file system blocksize is used, otherwise this value is used.
Default is 1024.
See setBlockSize.
The permission to use if a new database is created. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask).
See also man pages for chmod(2) and open(2).
Should be set before an operation in which a new database is created.
Default is S_IRUSR | S_IWUSR
, i.e. user has read and write
permission.
See setAccessMode.
If this property is set to true then the database will be written without any disk file synchronization. This allows faster writes, but may produce an inconsistent database in the event of abnormal termination of the writer. Can be set at any time.
Default is false.
See setFastMode.
Set the size of the internal bucket cache. This option may only be set once after a database has been open and should be set prior to accessing it in any way.
Default is 100.
See setCacheSize.
| Kdoc |