Method Gdbm.DB()->create()
- Method
create
Gdbm.DB Gdbm.DB(void|stringfile,void|string(99..119)mode)- Description
Without arguments, this function does nothing. With one argument it opens the given file as a gdbm database, if this fails for some reason, an error will be generated. If a second argument is present, it specifies how to open the database using one or more of the follow flags in a string:
rOpen database for reading
wOpen database for writing
cCreate database if it does not exist
tOverwrite existing database
fFast mode
sSynchronous mode
lLocking mode
The fast mode prevents the database from syncronizing each change in the database immediately. This is dangerous because the database can be left in an unusable state if Pike is terminated abnormally.
The default mode is
"rwc".- Note
The gdbm manual states that it is important that the database is closed properly. Unfortunately this will not be the case if Pike calls exit() or returns from main(). You should therefore make sure you call close or destruct your gdbm objects when exiting your program.
atexit might be useful.
This is very important if the database is used with the 'l' flag.