clonefish
http://phpformclass.com/forum/

PDO Database wrapper
http://phpformclass.com/forum/viewtopic.php?f=4&t=225
Page 1 of 1

Author:  Magic [ Thu Nov 20, 2008 2:50 pm ]
Post subject:  PDO Database wrapper

Hello,

I wonder if someone can help to build a PDO Database Wrapper for Clonefish.
I'm using PDO with prepared statements in my local PHP Project and I want to use clonefish also. Can somebody help me out?

Thanks in advance,

Magic

Author:  Magic [ Mon Nov 24, 2008 6:51 am ]
Post subject: 

Hmm,

no one? Is it maybe not possible?

Author:  clonefish [ Mon Nov 24, 2008 11:10 am ]
Post subject: 

Hi Magic,

Apologies for the delay! As PDO is very similar to the database abstractions layers already supported by Clonefish, it's possible to build a wrapper for this one too. It's not only possible, it's just happened: I've emailed the wrapper in question to you.

There are two things to know when using this wrapper:

- I've read that you're using prepared statements in your application. While it's a good practice in general and provides performance benefits for repeated queries, according to our experiences it's highly unlikely that prepared statements could be reused while rendering a form instance. This way the prepare-bind process would not provide better performance compared to queries built on-the-fly, that's the main reason why wrappers - including the PDO wrapper - were built without support for prepared statements. Anyways, it's still possible to do ;), we just don't feel that it's adequate for a form generator (meanwhile this also helps maintaining a consistent and universal selection of wrappers).

- you may have already seen the <code>minrows</code> and <code>maxrows</code> options for database validation. These options rely on the <code>RecordCount()</code> method of the database wrapper result object. Unfortunately counting rows for a SELECT statement is not supported by several RDBMSes. While some database abstraction layers (like AdoDB) provide rowcount emulation in such cases, there's no such feature in PDO, so the PDO wrapper runs another query in these cases as it's suggested in the PDO manual. To maintain portability, you may have to modify this method to support your RDBMS of choice.

Author:  Magic [ Mon Nov 24, 2008 3:11 pm ]
Post subject: 

Wow,

what a support. Thank you for your detailed answer and the packet that you sent. Great!

Regards.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/