Hello Everyone!

 

Currently PDOStatement::bindValue is declared as

public bool PDOStatement::bindValue ( mixed $parameter , mixed $value [, int
$data_type = PDO::PARAM_STR ] )

where third parameter is data type, string type as default.

 

It may be useful in terms of providing meta info and handle it accordingly,
like quote, cast or do some additional stuff.

 

But there are DBMSes where this "feature" is more a burden than a helper.

 

It's because after PDO::prepare, driver and server already knows all
statement parameters and expected types.

Yes, it can be "forced", saying to pass for a integer parameter a string
value, server will convert it to required type.

It is convenient in most cases to pass them as strings, for example by
simply assign all params in a cycle before execute.

 

But when implementing FB Boolean data type parameters and doing ->bindValue
('bool_param', false) I get an empty string internally.

Yes, true ZVAL is converted as string as '1', but false as an empty string,
not so consistent here ;)

 

That's why I think, it will be great to have a special type like
PDO::PARAM_AUTO and a config flag to set it as default instead of PARAM_STR.


 

Any thoughts?

 

-

  Dorin

Reply via email to