History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-150
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Gavin
Reporter: Aleksey V. Zapparov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Error in driver selection

Created: 27/Jun/06 12:07 AM   Updated: 05/Jul/07 02:44 PM
Component/s: Zend_Db
Affects Version/s: 0.1.3
Fix Version/s: 0.1.5

Time Tracking:
Not Specified

Resolution Date: 03/Jul/06 05:44 PM


 Description  « Hide
When trying to use 'pdo_mysql' it throws exceptions that it can't find Zend_Db_Adapter_Pdo__Mysql
Error is on line: 166
$adapterName = 'Zend_Db_Adapter_Pdo_' . substr($adapterName, 3);

To fix it it must be replaced with:
$adapterName = 'Zend_Db_Adapter_Pdo_' . substr($adapterName, 4);



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Gavin - 27/Jun/06 12:38 AM
This problem has been reported multiple times on the mail list.
The current solution: use 'pdomysql' instead of 'pdo_mysql'

However, the current code's inflexibility towards '_' and capitalization is not "user-friendly".

Untested solution follows:

$ svn diff
Index: Db.php
===================================================================
--- Db.php      (revision 698)
+++ Db.php      (working copy)
@@ -165,8 +165,12 @@
             throw new Zend_Db_Exception('Configuration must be an array');
         }

-        if (substr($adapterName, 0, 3) == 'pdo') {
-            $adapterName = 'Zend_Db_Adapter_Pdo_' . substr($adapterName, 3);
+        $adapterName = strtolower($adapterName); # normalize input
+        if (substr($adapterName, 0, 3) === 'pdo') {
+            $adapterName = 'Zend_Db_Adapter_Pdo_' .
+                           str_replace(' ',
+                                       '_' ,
+                                       ucfirst(ltrim(substr($adapterName, 3),'_')));
         } else {
             $adapterName = 'Zend_Db_Adapter_' .
                            str_replace(' ',

Aleksey V. Zapparov - 27/Jun/06 10:16 PM
Sorry, didn't found any reports on such topic. Well, I'm not very clear of how to use this issue tracker and other things on this project that's why I've reported. By the way, where I can find unreleased versions? I haven't found any links on them.

Both versions, yours and mine will work, but imho my version is easier. Maybe I'm wrong. Because your version is more universally.


Gavin - 28/Jun/06 10:55 AM
First, thank you for creating an issue for this problem. Problems get solved because people have patience to report them using our issue tracker.

> By the way, where I can find unreleased versions?

I was just about to discuss this with the dev team.
The link isn't as obvious as it could be, especially since the unreleased, development version often is "superior" to the 0.1.x build. Please look here:
Developer Version of ZF

Your version will break all existing, working ZF apps that use pdomysql instead of pdo_mysql.
I don't like how much code my patch uses, but it allows:

  • pdomysql
  • pdoMysql
  • pdo_mysql
  • pdo_MySQL
  • PDO_mysql
  • etc.

Our goal: make ZF easy to use. Since we don't want developers to study the relationship between "pdo<name of PDO adapter" and our file naming structure for these subcomponents, we choose to make the code more forgiving of capitalization variances and make the '_' optional.


Aleksey V. Zapparov - 29/Jun/06 12:11 AM
Thank you for your responses.

I agree with you about pdo... Even totally agree.
About downloading other versions, I have to note that it's very hard to find where i can download.
Link that you gave - I saw, but even this fact doesn't help me to find what I'm looking for
Anyway I'll try to understand where I should look for

> Our goal: make ZF easy to use.
IMHO, it's would be beter if people can choose, what brach they want to look for, 0.1.3, 0.1.5 or 0.2.0,
So they can download latest snapshot of framework and try it. I guess it can accelerate bug discovering.
And it will also raise usability


Gavin - 03/Jul/06 05:44 PM
Fixed. Click the FishEye link above for more information.

Gavin - 11/Jul/06 01:21 PM
Note: There were numerous commits repeatedly fixing and breaking this issue (by breaking support for 'pdomysql'), but release 0.1.5 will support both 'pdo_mysql' and 'pdomysql'. Release 0.2 will not support 'pdomysql'. The use of underscores is now deprecated.