updating oE db_create


include eds.e 
namespace eds 
public function db_create(sequence path, integer lock_method = DB_LOCK_NO, 
        integer init_tables = DEF_INIT_TABLES, 
        integer init_free = DEF_INIT_FREE) 

creates a new database given a file path and a lock method.

  1. path : a sequence, the path to the file that will contain the database.
  2. lock_method : an integer specifying which type of access can be granted to the database. The value of lock_method can be either DB_LOCK_NO (no lock) or DB_LOCK_EXCLUSIVE (exclusive lock).
  3. init_tables : an integer giving the initial number of tables to reserve space for. The default is 5 and the minimum is 1 .
  4. init_free : an integer giving the initial amount of free space pointers to reserve space for. The default is 5 and the minimum is 0 .

An integer, status code, either DB_OK if creation successful or anything else on an error.


On success, the newly created database becomes the current database to which all other database operations will apply.

If the file in the path does not have an extention, .edb will be added automatically.

A version number is stored in the database file so future versions of the database software can recognize the format, and possibly read it and deal with it in some way.

If the database already exists, it will not be overwritten. db_create will return DB_EXISTS_ALREADY.

Example 1:
if db_create("mydata", DB_LOCK_NO) != DB_OK then 
    puts(2, "Couldn't create the database!\n") 
end if 
See Also:

db_open, db_select

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu