views:

579

answers:

2

It appears the class constants only cover PDO::PARAM_BOOL, PDO::PARAM_INT and PDO::PARAM_STR for binding. Do you just bind decimal / float / double values as strings or is there a better way to treat them?

MySQLi allows the 'd' type for double, it's surprising that PDO doesn't have an equivalent when it seems better in so many other ways.

A: 

If you really want to use PDO you'll have to enter it as an PARAM_INT, but I never use a specification for double.

It is an optional parameter to specify the PDO type.

I guess you would beter not set the pdo type for doubles.

Kennethvr
I don't think I'd want to lose precision by binding it as an INT but you make a good point about just not specifying the type, thanks.
Rob
Actually, if no param_TYPE is given then PARAM_STR is assumed.
Xeoncross
A: 

AFAIK PDO::PARAM_STR is the way to go.

Alix Axel
thanks! i'm probably just going to do this and validate myself.
Rob