[habari-dev] Postgres DBConnection Question

0 views
Skip to first unread message

Chris Meller

unread,
May 4, 2010, 11:43:59 AM5/4/10
to Habari Dev
I posted some questions about r3530 on the ticket that they originated from: https://trac.habariproject.org/habari/ticket/924#comment:7

Unfortunately, I don't know how to get back in touch with mnacos, he didn't register with an email address. Anyone else able to answer my questions?

--
To post to this group, send email to habar...@googlegroups.com
To unsubscribe from this group, send email to habari-dev-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/habari-dev

Michael Nacos

unread,
May 4, 2010, 2:30:44 PM5/4/10
to habar...@googlegroups.com
Hi there,

will have a look and let you know...

regards, Michael

Michael Nacos

unread,
May 4, 2010, 3:07:58 PM5/4/10
to habar...@googlegroups.com
Dear Chris,

in my local (pg) installation, PDO::ATTR_EMULATE_PREPARES is only set in the following two files:

classes/databaseconnection.php
schema/mysql/connection.php

i.e. there is no such setting in schema/pgsql/connection.php
and, even though this emulate thing is set for each prepared statement,
habari seems to work fine (postgres has supported prepared statements for a long time now :-)

can't really help you with your second question, as I have not used PDO much myself, although this feels like it should be a per-connection setting.

finally, this emulate thing is a mysql-specific hack rather than a pg-specific one, please see comments about prepared statements above

hope I'm helping

Michael

PS. why did I register without an email address? I cannot even reset my trac password now...
can somebody help?

Matt Read

unread,
May 5, 2010, 9:24:46 AM5/5/10
to habar...@googlegroups.com
PDO::ATTR_EMULATE_PREPARES was originally put in the mysql connection
class to deal with problems of mysql's qcache not working with
prepared statements. I would wonder if the new mysqlnd (native driver)
would solve that issue; but it's only there to enable qcache to
function properly with mysql/php.
--
Matt Read
http://mattread.info
http://mattread.com

Chris Meller

unread,
May 5, 2010, 1:51:19 PM5/5/10
to habar...@googlegroups.com
So to sum up:

It's not needed for Postgres, since it supports prepared statements, so we don't know why it was added to databaseconnection.php in the big Postgres commit (r3530).

It is needed for MySQL (which we knew), but we're not sure if the one in mysql/connection.php in the connect() method is enough or if it actually needs to be applied to each query?

Matt Read

unread,
May 7, 2010, 10:26:50 AM5/7/10
to habar...@googlegroups.com
On Wed, May 5, 2010 at 1:51 PM, Chris Meller <ch...@doesnthaveone.com> wrote:
> So to sum up:
>
> It's not needed for Postgres, since it supports prepared statements, so we don't know why it was added to databaseconnection.php in the big Postgres commit (r3530).

I only found one reference about using it in PG that had to do with
data types. But since mysql (other than mysqlnd) doesn't do types
properly, it's of no concern to us.

> It is needed for MySQL (which we knew), but we're not sure if the one in mysql/connection.php in the connect() method is enough or if it actually needs to be applied to each query?

It only needs to be in connect. And to be clear, MySQL supports
prepared statements without it, the ONLY reason it is there (for us),
is to enable qcache to work with prepared statements. There are other
reason to use it for queries like SHOW TABLES in prepared statements,
but the main reason is qcache.
Reply all
Reply to author
Forward
0 new messages