Welcome Guest, Not a member yet? Register   Sign In
Bug in PDO driver class?
#1

[eluser]musonic[/eluser]
I tried using the new PDO driver that is included with CI 2.1.0. It didn't go well. It was unable to create a connection. I think I tracked down the problem and fixed it, but I never like adding (or removing) anything from the core.
The problem seemed to be when instantiating a new PDO instance. On line 114 of pro_driver.php we have:
Code:
return new PDO($this->hostname, $this->username, $this->password, $this->options);
The problem is that
Code:
$this->hostname
is incorrect. In my case this is currently just localhost.
Currently it is set on line 81:
Code:
$this->hostname .= ";dbname=".$this->database;
The problem is that it is missing the first bit of the string that PDO needs. Immediately before line 81 I have added
Code:
$this->hostname = 'mysql:host='.$this->hostname;
This builds the correct string and I can now connect as expected. Of course the problem with this fix is that I've hardcoded mysql...


Messages In This Thread
Bug in PDO driver class? - by El Forum - 01-26-2012, 05:15 AM
Bug in PDO driver class? - by El Forum - 02-29-2012, 05:52 PM
Bug in PDO driver class? - by El Forum - 02-29-2012, 06:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB