PHP.nl

dba_open

dba_open

Open database

 **dba_open** string $path string $mode  $handler int $permission int $map_size  $flags
establishes a database instance for
with  using

. dba_open``path``mode``handler

pathCommonly a regular path in your filesystem.

mode It is for read access, for read/write access to an already existing database, for read/write access and database creation if it doesn't currently exist, and for create, truncate and read/write access. The database is created in BTree mode, other modes (like Hash or Queue) are not supported. r``w``c``n

  Additionally you can set the database lock method with the next char.
  Use  to lock the database with a 
  file or  to lock the databasefile itself. It is
  important that all of your applications do this consistently.
 `l``d`


  If you want to test the access and do not want to wait for the lock
  you can add  as third character. When you are
  absolutely sure that you do not require database locking you can do
  so by using  instead of  or
  . When none of ,
   or  is used, dba will lock
  on the database file as it would with .
 `t``-``l``d``d``l``-``d`

Opmerking: > There can only be one writer for one database file. When you use dba on a web server and more than one request requires write operations they can only be done one after another. Also read during write is not allowed. The dba extension uses locks to prevent this. See the following table:

  `dba_close``"l"``"d"``mode`

handler The name of the which shall be used for accessing . It is passed all optional parameters given to and can act on behalf of them. If is null, then the default handler is invoked. handlerpath``dba_open``handler

permission Optional integer parameter which is passed to the driver. It has the same meaning as the parameter of , and defaults to . permissions``chmod``0644

  The , , ,
  , , ,
  , and  drivers support the
   parameter.
 `db1``db2``db3``db4``dbm``gdbm``ndbm``lmdb``permission`

map_sizeOptional integer parameter which is passed to the driver. Its value should be a multiple of the page size of the OS, or zero, to use the default map size.

  Only the  driver accepts the  parameter.
 `lmdb``map_size`

flags Flags to pass to the database drivers. If null the default flags will be provided. Currently, only the LMDB driver supports the following flags and . DBA_LMDB_USE_SUB_DIR``DBA_LMDB_NO_SUB_DIR

Returns a instance on successreturn.falseforfailure. Dba\Connection

false is returned and an level error is issued when is null, but there is no default handler. E_WARNING``handler

dba_popen``dba_close