Re: Conf: argue !

Manuel Holtgrewe <[email protected]>
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
Wim Niemans ri schrieb:
> On 23 Feb 2005 at 0:22, Manuel Holtgrewe wrote:
> 
> 
>>>Trees aren't that hard, but I agree that in this case they seem excessive.
> 
> 
> Anyway, it is important to remember that the structure of the
> config_variables is a hierachy, and multi-dimensional arrays of 
> variables must be allowed.
> 
> 
>>They are bad and ineffective in SQL because
>>
>>- The implementation of the relational model SUCKS
>>- There is the need for a generic "EXPLODE" command to get a tree from 
>>the table rows (tuples) within the database.
> 
> 
> Config_values form a tree. Trees are hierarchies and by-default hard to 
> implement in a relational model because they don't adhere to that.

Oh, they adhere perfectly. The relational model handles them well, too. 
The only weak spot in the relational model is the implementation and 
specification of SQL: If SQL would implement the relational model, it 
would be easy to use, easier to implement and smell less of hacks.

Read Fabian Pascal's "Practical Issues In Database Management" about a 
short but pretty complete explanation of that topic.

> Implementation is ergo a flat table. No harm done.
> 
> You don't need an explode at all, though it can be done with that:
> 
> From current code of Conf:, method get(path):
> $assign='return $this->domains'."['".str_replace('/',"']['",$path)."'];";
> return eval($assign);
> 
> A similar construction is used to transform the tree (row by row) into an 
> multiple associative array. The eval is used too to transform php-
> constants and others in raw format into string_values and arrays.

Okay, so it seems to be simple to expand the data in the database into a 
PHP array tree.


Manuel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.