Re: Re: Announce: PDO beta releases
| From: | Wez Furlong | Date: | Thu, 10 Feb 2005 03:07:18 +0000 |
| Subject: | Re: Re: Announce: PDO beta releases | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1945@lists.php.net to get a copy of this message | ||
On Thu, 10 Feb 2005 03:41:42 +0100, Reini Urban <rurban@x-ray.at> wrote:
> > You're not showing the DSN you passed to PDO.
> I was. DSN: "mysql://wikiuser:@localhost/phpwiki"
> Which means default values only.
You passed that directly to PDO? that probably should raise an error.
> There was some pipe problem I'll have to reproduce and investigate.
> Within the perl libmysqlclient "localhost" tries the socket/pipe,
> 127.0.01 tries TCP/IP. Within PDO I think it's the same.
> The default pipe name "MySQL" should have been okay.
I committed a possible solution to this; I think it might have just
made it into the snaps build. Otherwise you'll have to wait 6 hours
to try it out.
> PDO_ATTR_CHARSET translation is easy and welcome, but a valid utf8 \0 in
> any string will be a problem in a pecl extension.
\0 indicates the end of a valid utf-8 string; it should not appear in
textual data. If you have binary data, then you should use the LOB
api. (to be documented soon).
> PDO_MYSQL doesn't accept setAttribute for valid __construct hash values
> PDO_ATTR_* besides the one and only documented one, but otherwise I
> would consider it ready for general usage. Maybe you should document
> those constants also.
>
> I tried to call
> $pdo->setAttribute(PDO_ATTR_AUTOCOMMIT, true);
> $pdo->setAttribute(PDO_ATTR_TIMEOUT, 10);
> $pdo->setAttribute(PDO_ATTR_PERSISTENT, false);
You can't guarantee that you'll be able to set those attributes after
you have established the connection for all drivers, so it's best to
pass in those attributes in the constructor. The persistent attribute
must be passed into the constructor in any case.
> PDO_FETCH_LAZY is a very cool idea! Shouldn't that be the default
> instead of _BOTH? Doesn't look too costly.
The lazy fetch has some gotchas; for example, this doesn't work like
you might think:
$row_one = $stmt->fetch(PDO_FETCH_LAZY);
$row_two = $stmt->fetch(PDO_FETCH_LAZY);
print_r($row_one);
print_r($row_two);
$row_one references $row_two, because the $stmt is now on $row_two.
--Wez