What Don means is that both INSERT INTO sometable (foo, bar, baz) VALUES (:foo, ':bar', ':baz') and %(name)s be supported. I think the time has come to move from the mysql connector to the PDO connector as this support such features already, rewriting an abstraction layer while an existing compiled version is already available is waistful resources. I also think we need to move as many Query PHP methods over to call compiled PDO methods rather as in general should be much faster than how we can handle and manipulate query results in PHP.
I will be creating a wishlist bug report for this and assign Don to deal with the PDO connector implimentation which was started by Greg. The situation Don is in, is currently favoratible for PHPDevShell as high strain complicated and fast queries is required for his project. This will allow him continual testing and benchmarking of the different scenarios. I too have been working and trying out various PDO related things in the past and it was determined back then, that this is the way to go forward. Although I assign the completion of this development and documentation cycle to Don, this will be a multi development initiative. -- You received this bug notification because you are a member of PHPDevShell, which is subscribed to PHPDevShell. https://bugs.launchpad.net/bugs/943159 Title: Support required for named SQL parameters Status in Open Source PHP RAD Framework with UI.: New Bug description: The PHPDS_db and PHPDS_query classes needs to support named SQL parameters, this will help future compatibility with PDO Objects as well as allow for the formatting of SQL statements to be improved upon before we fully support PDO. An example of currently used non-parameter based queries: $sql = "INSERT INTO sometable (foo, bar, baz) VALUES (%d, '%s', '%s')" To add data into the query you would then usually do something like: $query = sprintf($sql, 1, 'text', 'some more text'); Although the above example is extremely simple, the ordering of the parameters is extremely important and in complex queries with many fields it is easy to misalign the format parameters with the fields given. To solve this problem PDO supports named SQL parameters (as does most other non PHP mysql database API's): Example: $sql = "INSERT INTO sometable (foo, bar, baz) VALUES (:foo, ':bar', ':baz')" For now, a PHPDevShell a function could then take a named array and simply replace the named parameters with the actual values, for example: $query = $this->fmtParamSQL($sql, array(':foo' => 1, ':bar' => 'text', ':baz' => 'some more text')); The fmtParamSQL() function can work like this: function fmtParamSQL($sql, $params = false) { $result = $sql; foreach($params as $name => $value) { $result = str_ireplace(':'.$name, $value, $result); } return $result; } I propose that we build an additional function into PHPDS_db called invokeNamedQuery() to differentiate between the standard invokeQuery() function and a function which supports named parameters. This is going to take quite a lot of work since all the supporting functions will also then have to support named parameters. If we convert all queries to named queries eventually we will then be able to support PDO and NoSQL much easier in the future. To manage notifications about this bug go to: https://bugs.launchpad.net/phpdevshell/+bug/943159/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~phpdevshell Post to : [email protected] Unsubscribe : https://launchpad.net/~phpdevshell More help : https://help.launchpad.net/ListHelp

