Re: DBM Compatibility layer

From: Date: Sun, 28 Apr 2002 19:26:19 +0000
Subject: Re: DBM Compatibility layer
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5858@lists.php.net to get a copy of this message
Hello, Brent Cook wrote:
Second: What is the <create></create> section for? I didn't touch it because I haven't seen this before.
Ah! so I looked in the docs included with binarycloud r2, an behold, create: "Boolean flag that indicates whether the database manager class should create the specified database or use a previously installed database of the same name." Hmm...should a schema really tell a database manager whether to actually create a table? What's the point of a schema then if the database manager
As it was explained in the other message, sometimes is not possible or desirable.
is given permission to ignore it ;)? Also, what was with the variable element inside <create> in the test schema, e.g.: <create><variable>create</variable></create>
Sometimes you need to redefine some values of the schema tags with contextual information that is only known at the installation time. So, the <variable> tag specified the name of a text variable that is passed to the Metabase schema parser that will be used as a sort of text macro replacement when the schema is evaluated. The <create> tag takes the values 1 or 0 . So a text variable named create should be passed to the parser with either the values "1" or "0". In the case of the test.schema that was necessary because this schema could be tested with database drivers that there may be no way to know how to create a database. That is the case for instance of the ODBC driver because the Metabase ODBC driver does not have away to create databases since that is database specific operation. Another very useful use of the <variable> tag is for instance when you need to prefix the names of the tables and sequences of your schemas to avoid the name space collision. So you can define tables like this: <table> <name><variable>prefix</variable>_users</name> ... </table> <table> <name><variable>prefix</variable>_polls</name> ... </table> Where prefix is a variable with the prefix assigned to the module being installed. Regards, Manuel Lemos

« previous php.pear.dev (#5858) next »