PDOpecl::PDO |
[ AdvancedSearch | AreaMap ]
|
| Welcome | Installation | FAQ | User Notes | Links |
| User Notes | bindParam | DSN | exec | API differences | fetchCol | setAttribute | API |
|
Areas In PDO |
bindParamhttp://de2.php.net/pdo-prepare
This code looks nice for people using Oracle. But most people do not use Oracle. What about:
(without ':') Wez has mentioned that some RDBMS require the use of "@" versus ":" and that making the user apply the proper prefix makes it possible to directly send of the data to the RDBMS. However the performance improvements are likely to be hardly measureable. In constrast it is a major stumbling block for beginners. Also its likely to be a huge pain for developers as well. A very common case will be to store some metadata of the fields inside arrays (like is the field required, what type is the field etc) and key these arrays by column name and then build the SQL from that. Also it means that data fetched from result sets will not directly match up with the structure inside the data send to an execute. Therefore it is very likely that a large number of users will have to add additional code to append the colon just for PDO. This is even worse when using execute()'s ability to accept an array of data. the above request is being implemented --- I also noticed that bindParam() and bindColumn() are 1-indexed, which will raise inconviniences with people using arrays for example to stored the numeric indexes, similar in how having to add the ":" was a problem for people using arrays to store the string parameters. Answer by Wez: "Passing an array with numeric indices to execute() expects 0 based indices, to cater for this case. Manually calling a bind function expects 1 based indices, as this is the convention for the majority of database APIs."
This site powered by YaWiki 0.22 beta.
Add A CommentYour comment will be added immediately; please check your comments, and be nice. :-) Please use plain text only; HTML and PHP code will be converted to entities. Your email address will be obfuscated with [AT] and [DOT] after you post your comment. |