Property changes on: reference/chdb ___________________________________________________________________ Added: svn:ignore + entities.*.xml Index: reference/chdb/chdb.xml =================================================================== --- reference/chdb/chdb.xml (revision 0) +++ reference/chdb/chdb.xml (revision 0) @@ -0,0 +1,67 @@ + + + + + + The chdb class + chdb + + + + +
+ &reftitle.intro; + + Represents a loaded chdb file. + +
+ + +
+ &reftitle.classsynopsis; + + + + chdb + + + + + chdb + + + + + Methods + + + + +
+ +
+ + &reference.chdb.entities.chdb; + +
+ + Index: reference/chdb/setup.xml =================================================================== --- reference/chdb/setup.xml (revision 0) +++ reference/chdb/setup.xml (revision 0) @@ -0,0 +1,53 @@ + + + + + &reftitle.setup; + +
+ &reftitle.required; + + This module uses cmph (version 0.9) for + providing the perfect hashing function. + + + cmph 0.9 is required to install this module. + +
+ + + &reference.chdb.configure; + + +
+ &reftitle.runtime; + &no.config; +
+ +
+ &reftitle.resources; + &no.resource; +
+ +
+ + Index: reference/chdb/chdb/construct.xml =================================================================== --- reference/chdb/chdb/construct.xml (revision 0) +++ reference/chdb/chdb/construct.xml (revision 0) @@ -0,0 +1,83 @@ + + + + + + chdb::__construct + Creates a chdb instance + + + + &reftitle.description; + + chdb::__construct + stringpathname + + + Loads a chdb file, by mapping it into memory. + + + While some validity checks are performed on the specified file, they are + mostly there to avoid the possibility of common mistakes (for example, + loading a file which is not a chdb database, or that is somehow + incompatible with the current system). A maliciously crafted chdb file can + thus be dangerous if loaded, so chdb files should be trusted and treated + with the same security protections used for PHP shared libraries. + + + + + + + &reftitle.parameters; + + + pathname + + + The name of the file to load. + + + + + + + + &reftitle.errors; + + Throws an exception in case the chdb file hasn't been successfully loaded. + + + + A valid chdb file might fail to load in case it was created on an + architecture with a different endianness, with a different version of chdb, + or if the file is too big to be mapped into memory (mostly in case of huge + files and 32-bit architectures). In these cases the load will fail by + throwing an exception, but otherwise not performing any illegal operation. + + + + + + + + Index: reference/chdb/chdb/get.xml =================================================================== --- reference/chdb/chdb/get.xml (revision 0) +++ reference/chdb/chdb/get.xml (revision 0) @@ -0,0 +1,100 @@ + + + + + + chdb::get + Gets the value associated with a key + + + + &reftitle.description; + + public stringchdb::get + stringkey + + + Gets the value associated with a key from a chdb database. + + + + + &reftitle.parameters; + + + key + + + The key for which to get the value. + + + + + + + + &reftitle.returnvalues; + + Returns a string containing the value associated with the given + key, or &null; if not found. + + + + + &reftitle.examples; + + <function>chdb::get</function> example + + 'value1', + 'key2' => 'value2', + // ... +); +chdb_create('data.chdb', $data); + +$chdb = new chdb('data.chdb'); +$value1 = $chdb->get('key1'); +$value2 = $chdb->get('key2'); + +echo $value1, PHP_EOL; +echo $value2, PHP_EOL; + +?> +]]> + + &example.outputs.similar; + + + + + + + + + + Index: reference/chdb/configure.xml =================================================================== --- reference/chdb/configure.xml (revision 0) +++ reference/chdb/configure.xml (revision 0) @@ -0,0 +1,42 @@ + + + +
+ &reftitle.install; + + + &pecl.info; + &url.pecl.package;chdb + + + + cmph (version 0.9) is required + for installing this extension. If cmph is installed in a + non-standard directory, use the + switch, + where DIR is the cmph install prefix. + + +
+ + + Index: reference/chdb/versions.xml =================================================================== --- reference/chdb/versions.xml (revision 0) +++ reference/chdb/versions.xml (revision 0) @@ -0,0 +1,34 @@ + + + + + + + + + + + + + Index: reference/chdb/functions/chdb-create.xml =================================================================== --- reference/chdb/functions/chdb-create.xml (revision 0) +++ reference/chdb/functions/chdb-create.xml (revision 0) @@ -0,0 +1,123 @@ + + + + + + chdb_create + Creates a chdb file + + + + &reftitle.description; + + voidchdb_create + stringpathname + arraydata + + + chdb_create creates a chdb file containing the + specified key-value pairs. + + + + chdb files are not portable across little-endian and big-endian + environments. Except for that, they are portable across different + architectures. Also compatibility across different versions of chdb is not + guaranteed. + + + + + + &reftitle.parameters; + + + pathname + + + The name of the file to create. + + + If a file with the same name already exists, it is overwritten. + + + + + data + + + An array containing the key-value pairs to store in the chdb file. + + + Keys and values are converted to strings before being written to the file, + as chdb only support the string type. Note that binary strings are + supported as well, both as keys and values. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.errors; + + Throws an exception in case the chdb file hasn't been successfully created. + + + + + &reftitle.examples; + + <function>chdb_create</function> example + + 'value1', + 'key2' => 'value2', + // ... +); +chdb_create('data.chdb', $data); + +?> +]]> + + + The above example will generate a chdb file named + data.chdb and containing the key-value pairs defined in + $data. + + + + + + + + Index: reference/chdb/book.xml =================================================================== --- reference/chdb/book.xml (revision 0) +++ reference/chdb/book.xml (revision 0) @@ -0,0 +1,75 @@ + + + + + Constant hash database + chdb + + + &reftitle.intro; + + CHDB (constant hash database) is a fast key-value database for constant data, + realized by using a memory-mapped file and thus providing the following + functionalities: + + + + Extremely fast initial load, regardless of the size of the database. + + + + + Only the pages of the file which are actually used are loaded from the + disk. + + + + + Once a page is loaded it is shared across multiple processes. + + + + + Loaded pages are cached across multiple requests and even process recycling. + + + + + + A typical use of CHDB is as a faster alternative to defining many PHP + constants. + + + CHDB is internally implemented as a hash-table using a perfect hashing + function, thus guaranteeing worst case O(1) lookup time. + + + + &reference.chdb.setup; + &reference.chdb.constants; + &reference.chdb.examples; + &reference.chdb.chdb; + &reference.chdb.reference; + + + + Index: reference/chdb/constants.xml =================================================================== --- reference/chdb/constants.xml (revision 0) +++ reference/chdb/constants.xml (revision 0) @@ -0,0 +1,28 @@ + + + + + &reftitle.constants; + &no.constants; + + + Index: reference/chdb/reference.xml =================================================================== --- reference/chdb/reference.xml (revision 0) +++ reference/chdb/reference.xml (revision 0) @@ -0,0 +1,30 @@ + + + + + chdb &Functions; + + &reference.chdb.entities.functions; + + + + Index: reference/chdb/examples.xml =================================================================== --- reference/chdb/examples.xml (revision 0) +++ reference/chdb/examples.xml (revision 0) @@ -0,0 +1,73 @@ + + + + + &reftitle.examples; + + Creating a chdb file + + 'value1', + 'key2' => 'value2', + // ... +); +chdb_create('data.chdb', $data); + +?> +]]> + + + The above example will generate a chdb file named + data.chdb and containing the key-value pairs defined in + $data. + + + + Loading and looking up a chdb file + +get('key1'); +$value2 = $chdb->get('key2'); + +echo $value1, PHP_EOL; +echo $value2, PHP_EOL; + +?> +]]> + + &example.outputs.similar; + + + + + + + Index: appendices/extensions.xml =================================================================== --- appendices/extensions.xml (revision 300444) +++ appendices/extensions.xml (working copy) @@ -21,6 +21,7 @@ + @@ -310,6 +311,7 @@ + @@ -405,6 +407,7 @@ +