Hi,
I wanted to change a parameter in my PDO class, with the fourth
PDO::_construct arg. But, I've many projects, which uses PDO, with one
"new PDO" per project. The problem is that I have to change the source
of every projects...
Why isn't there an PDO section in the php.ini file ? For instance:
pdo.is_persistent = 1
pdo.fetch_notices = 1
...and more !
There isn't because nobody developed that or because it is contradicted ?
Samuel.
hi,
The general consensus is to do not add new ini settings unless it is
absolutely necessary. It is not the case for your example as it is
cleary an application configuration problem (user land configuration).
Cheers,
Pierre
Hi,
I wanted to change a parameter in my PDO class, with the fourth
PDO::_construct arg. But, I've many projects, which uses PDO, with one
"new PDO" per project. The problem is that I have to change the source
of every projects...Why isn't there an PDO section in the php.ini file ? For instance:
pdo.is_persistent = 1
pdo.fetch_notices = 1...and more !
There isn't because nobody developed that or because it is contradicted ?
Samuel.
--
--
Pierre
It isn't. :-)
Thanks.
2009/10/9 Pierre Joye pierre.php@gmail.com:
hi,
The general consensus is to do not add new ini settings unless it is
absolutely necessary. It is not the case for your example as it is
cleary an application configuration problem (user land configuration).Cheers,
Pierre
Hi,
I wanted to change a parameter in my PDO class, with the fourth
PDO::_construct arg. But, I've many projects, which uses PDO, with one
"new PDO" per project. The problem is that I have to change the source
of every projects...Why isn't there an PDO section in the php.ini file ? For instance:
pdo.is_persistent = 1
pdo.fetch_notices = 1...and more !
There isn't because nobody developed that or because it is contradicted ?
Samuel.
--
--
Pierre
Hi
There isn't because nobody developed that or because it is contradicted ?
here we extends the PDO class to configure it like we want.
For example :
class ourPDO
{
public function __construct( $dsn, $user = NULL, $password = NULL,
$options =NULL
)
{
$defaultOptions = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::ATTR_TIMEOUT => 5,
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
);
if( is_array($options) )
$defaultOptions = $options + $defaultOptions;
parent::__construct($dsn, $user, $password, $defaultOptions);
}
}
and in code, we use $db = new ourPDO( ... );
And I still have to modifiy my source. ;-)
In fact I'm using a personnaly Database class using PDO for add
execution times and array/string transformations. Actually, I just
wanted to know why there isn't any pdo propreties in the php.ini file.
Pierre replied.
Thanks !
Samuel.
2009/10/9 Olivier B. php-dev.list@daevel.net:
Hi
There isn't because nobody developed that or because it is contradicted ?
here we extends the PDO class to configure it like we want.
For example :
class ourPDO
{
public function __construct( $dsn, $user = NULL, $password = NULL,
$options =NULL
)
{
$defaultOptions = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::ATTR_TIMEOUT => 5,
PDO::ATTR_CASE => PDO::CASE_NATURAL,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
);if( is_array($options) ) $defaultOptions = $options + $defaultOptions; parent::__construct($dsn, $user, $password, $defaultOptions);
}
}and in code, we use $db = new ourPDO( ... );
Hi,
I wanted to change a parameter in my PDO class, with the fourth
PDO::_construct arg. But, I've many projects, which uses PDO, with one
"new PDO" per project. The problem is that I have to change the source
of every projects...Why isn't there an PDO section in the php.ini file ? For instance:
pdo.is_persistent = 1
pdo.fetch_notices = 1
Using these means two places have to be changed and monitored - the
application-specify configuration holding DSN, username and password and
the php.ini additionally. Some applications might have trouble if there
expectations about the environment isn't correct. The more ini settings
you have the more trouble ... these won'T be as troublesome as
magic_quotes but could still lead to unexpected behavior if the
developer doesn't expect them in some cases.
johannes