internals:pdo:brainstorming

This is an old revision of the document!


Thoughts and ideas about improving PDO. Wez's PDOv1 spec could be useful: http://www.php.net/~wez/pdo/pdo-spec.html

Relevant RFC

Questions

  • What have we learned about the PDO architecture in the past years (that needs fixing)?
  • How do we deal with features that only related to one (or few) drivers?

PDO Bugs / PDO2 Improvements

PDO

Documentation

  • FETCH_SERIALIZE description is wrong, it works like FETCH_CLASS not FETCH_INTO
  • document finally remaining FETCH constants like FETCH_KEY_VALUE, FETCH_FUNC
  • better document fetchAll() constants

Parameter binding & explicit data type set

  • bindValue() & bindParam() should enforce the type giving, currently it uses the current zval type for MySQL Bug #44639 / PDO: Fixing bug #44639 for mysql
    • PARAM_INT with strings => it should try to convert to the type, otherwise throw an Exception or create an error.
    • PARAM_BOOLEAN with strings => Exception or Error.
    • a new PARAM_AUTO could be used to determine the type by zval (old mysql behavior)
  • execute() could use an automatic approach PARAM_AUTO, could be a BC break http://news.php.net/php.pdo/235
    • allows automatic convert to PARAM_INT if zval is integer / float

fetchObject

  • Bug#49521 “PDO fetchObject sets values before calling constructor”
    • add note to FETCH_PROPS_LATE
    • allow setting FETCH_PROPS_LATE or assume it as default?

Unified API meta data access

see http://news.php.net/php.pdo/233

  • PDOStatement::getColumnMeta with a new parameter to get only one meta type back ml#123127892009423 wouldn't break the current api.
    • META_NAME => column name
    • META_TABLENAME => table name
    • ...

PDO2

fetchAll

  • add fetchAll() FETCH_UNIQUE without FETCH_GROUP (PHP5.3 seems to support it already?)
    • allow the column id to be set
    • allow to receive the key column in the result
    • allow with FETCH_CLASS

XML Support

Asynchronous requests

PDO Binding behaviour (5.3)

mysql sqlite firebird odbc
PDO_PARAM_STR zval type convert_to_string/null zval type/null convert_to_string/
PDO_PARAM_INT convert_to_long/null convert_to_string
PDO_PARAM_BOOL convert_to_long/null convert_to_string
PDO_PARAM_NULL always null always null
PDO_PARAM_LOB “ * convert_to_string*/null convert_to_string*
stream support * Supports streams * Supports streams * Supports streams

mysql:

firebird: Check if field allows null, for empty strings and field type is SQL_SHORT, SQL_LONG, SQL_INT64, SQL_FLOAT, SQL_DOUBLE, SQL_TIMESTAMP, SQL_TYPE_DATE, SQL_TYPE_TIME null is assumed as input

odbc: zval == IS_NULL or PDO_PARAM_NULL => always SQL_NULL_DATA

internals/pdo/brainstorming.1257173206.txt.gz · Last modified: 2017/09/22 13:28 (external edit)