Closed mindplay-dk closed 8 years ago
The library should mirror Postgres semantics by requiring you to specify up-front what you need, which means the driver and query builder architecture need to be extended to support this
This was attempted and found non-feasible with the MySQL PDO driver, which supports multiple-insert, but provides no means of obtaining more than one generated key afterwards - as opposed to Postgres, which supports the RETURNING
clause.
In other words, this would work only for single-insert under MySQL, so the situation either way, is that differences in functionality cannot be mediated without substantial trade-offs, e.g. lowest common denominator.
Since the goal for this library is not to abstract differences between DBMS, but rather to allow DBMS-specific features to be leveraged, I will not pursue this issue any further at this time.
Suffice it to say, the differences could be mediated, by avoiding PDO, and instead building a suitable driver model based on the postgres
and mysqli
extensions, but this is way beyond the scope of this project, at this time.
The
Connection
interface of the library (like most DB libraries in PHP) currently mirrors the poor semantics ofPDO::lastInsertId()
, in which obtaining an auto-generated ID is dependent on the order in which e.g.Connection
-methods are invoked; e.g. requiring you to ask for the generated ID immediately after executing anINSERT
query.INSERT .. RETURNING
under Postgres has the correct semantics, in which you have to specify up-front (before executing the query) that you need a generated ID - in other words, it's not depedent on execution order.The library should mirror Postgres semantics by requiring you to specify up-front what you need, which means the driver and query builder architecture need to be extended to support this, which will require breaking changes.