MDB questions
| From: | Lorenzo Alberton | Date: | Fri, 27 Sep 2002 10:56:23 +0000 |
| Subject: | MDB questions | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2394@lists.php.net to get a copy of this message | ||
First of all, I MUST praise all MDB developers for such an interesting concept.
The true portability seems now a lot more feasible.
I started playing with this tool only yesterday, but it's a while since I've followed it.
I have some questions, though...
1) When setting default values in our dbschema.xml, should we quote text fields?
I mean: if I have sth like
<field>
<name>pattern</name>
<type>text</type>
<length>16</length>
<default>abcdefghilmnop</default>
<notnull>1</notnull>
</field>
should I write
<default>"abcdefghilmnop"</default>instead? 2) What happens to "text" fields with a length inferior to the one specified in the schema? Are they space-padded? In particular, how are we supposed to declare "varchar" fields? And what are the size limits of a "text" field? I mean, should we consider it like a mysql's "text", or "tinytext", or what? Yes, I've read the manual, but I'd like to know what specific mysql datatype matched the "text" MDB datatype... 3) Do you plan to add a "set" or "enum" datatype? How can we "emulate" it in the meanwhile? 4) Is current CVS' MDB_Frontend supposed to work already? I tried it under winXP,Apache2,Mysql,PHP4.2.3 and I always get a blank page after the login. 5) I tried some queries with MDB, and all worked fine for one-row results. On the other hand, while looping thru a multi-row result I could only fetch the first row. I checked the sources, then I think I found the problem: in fetch* methods (MDB/common.php) there's this check: if (!$this->options['autofree'] && $res != NULL) { $this->freeResult($result); } Is this the wanted behaviour? I mean, it's a little bit counter-intuitive this behaviour for the 'autofree' option... I tried setting "$db->setOption('autofree',true);" and all worked fine. But IMHO a result should be automatically freed only if autofree is set to true, not the opposite... So (IMVHO) the check should be:
if ($this->options['autofree'] && $res != NULL) { $this->freeResult($result); }
Just my 2 cents...
6) I read somewhere that you (Lukas) stated that MDB methods are pretty much the same as PearDB...
But the conversion between the 2 isn't really painless... The biggest difference I noticed regards the fetch* methods.
In fact, while with PearDB I used the sintax "$result->fetch*()", with MDB I had to use "$db->fetch*($result)".
Yeah, that's not so terrible, but shouldn't be a common API desirable?
I already coded a lot of work using PearDB, and I look forward to anything that could make the switch to MDB easier...
Thank you for your attention and for your excellent work. You can have all my moral support, if nothing else :)
---
[Quipo ISP - Questa E-mail e' stata controllata dal programma Declude Virus]
[Quipo ISP - This E-mail was scanned for viruses by Declude Virus]