ramblings on PHP, SQL, the web, politics, ultimate frisbee and what else is on in my life
back «  1  2  3 

Re: What don't you like about PDO?

Perl's DBI->prepare_cached() ?

Re: What don't you like about PDO?

Another thing 64 bit integer support, or clarification what is expected to work.. does PDO::PARAM_INT allow 64 bit ints, even if PHP on 32 bit platforms don't have 64 bits.. ?!

"The suggestions about binding lists of values or whole statements are non-starters."

I dont think they are, as if RDBMs developers are getting involved they could add it to their own APIs, and therefore make it available in PDO. Only reason I see it hasn't been done before is just no low level prepared API for it.

Re: What don't you like about PDO?

Hi Lukas,

I read in the wiki that IN (?) will be not supported, but I think it would be nice, but I understand the decision.

We implemented in our DB layer a nice feature. The getCol, and getAll methods have a $collectBy parameter. Without this parameter the returned array is an array index from 0. If you specify a field the keys of the returned array will be the value of the given field. This could very handy for example data for a select list.

The notation is a bit more complex. If you want more dimension: "userId+bookId". In the form is the resultset has more userId with the same value only the last row will be presented in the results. This is not good for example selecting tags for users, but you can append "[]" after the field name, for example: "userId[]". In this case in the results to every user id will belong an array which holds the rows.

We found this feature very useful it helps to remove a lot of repetitive code fragments.

Re: What don't you like about PDO?

This is already supported in PDO, though I find the API very cumbersome. So I can never remember how to do this form the top of my head. Have a look at example #3 in the fetchAll() docs. As you can see from this and the other examples there are some very powerful ways in which to structure your multi row results sets with this method.

Re: What don't you like about PDO?

Simple things sould be simple,

please add new methods for insert, update and replace.

For example:
$pdo->insert($tablename, array $valuePairs);
$pdo->update($tablename, array $valuePairs, string $where);
$pdo->replace($tablename, array $valuePairs, $primaryKey);

It donsn't need to solve all cases, but most of them.

And it should be possible to get the $last_query for debugging and logging.

«  1  2  3