Development  »  Libraries  »  Rdo

  • Add query logging/profiling (also something like ?)
  • Remove Horde_Rdo::CUSTOM, allow custom 'query' arrays on all relationships as possible, and have a new type (not relationships, but mixins? extra_fields? that can be defined by a Query and that allows the flexibility of CUSTOM without being smooshed into relationships.
  • Allow Horde_Rdo_Query objects to be turned into just WHERE (or JOIN) clauses
  • Allow relationships to be defined by Query objects?
  • allow for using php.ini-set database configs for security, or perhaps $ENV variables - see Ilia's security presentation. Example php.ini dsn: [PDO] pdo.dsn.MYDB="odbc:SAMPLE"
  • Ensure that Rdo_Base objects are serializable
  • Charset support: support a database charset config parameter, and convert field values to the requested client charset.
  • Implement named queries (
  • Support composite primary keys. Discussion of surragate vs. natural primary keys:
  • Saving arrays, hashes, and other non-mappable objects in text columns ?
  • Allow setting $key field explicitly (not just by overriding the model)
  • Some check for whether or not an object is new (has been saved to the backend yet)?
  • Freezing: implement $frozen variable for Rdo objects for when the object has been deleted, or similar?
  • Caching hooks - not required, but allow caching of models, query generation, etc. with a passed-in Cache object.
  • Work on the basic Horde_Support_Inflector enough that it supports standard Horde table naming.
  • Use fetchObject (at least in PDO drivers) for performance?
  • Eager loading of MANY relationships - see
  • Two-query eager loading of a specific relationship (load the main object in one query, then all foreign-key objects in a 2nd, and join the two.
  • Implement eager loading with several relationships to the same table.
  • Observer hooks: beforeDelete, afterDelete, beforeUpdate, afterUpdate, beforeCreate, afterCreate
  • Support fixtures (YAML?) for testing
  • Test suite for Rdo:


things that can be specified on relationships: className - only if it can't be inferred from the field name foreignKey - also if can't be inferred criteria - restrict associations by more than foreign keys dependent - if true, associated object is destroyed when main object is order - of associated objects?

  • cascading deletes/updates: ?
  • Single table inheritance ?
class Company extends Rdo
class Firm extends Company
class Client extends Company
class PriorityClient extends Client

CREATE TABLE companies (
  id int(11) unsigned NOT NULL AUTO_INCREMENT,
  client_of int(11),
  name varchar(255),
  type varchar(100),

  id int(11) unsigned NOT NULL AUTO_INCREMENT,
  name text,
  company_id text,

potential field parameters: size maxsize fixedsize numeric null canbenull default canhavedefault unsigned canbeunsigned realname description type base

>> Here I disagree. To me the key point of a DBAL compared to just a DBL (database layer) is that it provides almost everything necessary to manually build portable SQL. This means that instead of passing of an array that magically builds my SQL, the user remains in the driver seat and is provided with a rich enough API to build almost everything in the SQL spec (and a bit beyond that) in a portable manner.

> What you want to say is that a DBAL must additionally provide: > a Query Builder, maybe extendable by the driver to provide RDBMS specific options/methods

no .. not a query builder .. that would imply that you just pass of some data and it magically constructs the entire SQL for you .. that is the job for some OO<->SQL tool. what I think a DBAL should provide is methods to generate pieces of SQL that are then assembled by the user.

so for example setLimit() would either return or automatically append to an supplied SQL string. same applies to field abstraction, you still call quote() to get the necessary SQL fragment to embedd in your SQL statement.

Pierre Minnieur wrote: > Must a DBAL then provide OO access to executed statements, prepared statements and results sets, too (like PDO does)?

absolutely .. a DBAL also needs to cover the reading part. so you need to have a portable way to read data from the database (including data type abstraction, handling of trimming off empty spaces etc).