Peter J. Holzer wrote:

On 2003-09-10 10:40:29 +0100, Steve Hay wrote:


But the question was: How can I arrange for such conversions to be performed automatically by DBI whenever it receives or returns data?



You could subclass DBI or DBD::MySQL and replace all methods with wrappers which perform the conversion. I'm not convinced that this is a good idea, though. I'd rather try to the the conversion in application specific layer above DBI.

Sub-classing DBI wouldn't help me since I'm using Class::DBI which won't know to use my DBI sub-class.

Sub-classing DBD-mysql might be more feasible, though, since I specify what driver to use.

Actually, I had hoped to find some appropriate hooks in Class::DBI, but I don't see any. There are "select" and "before_set" triggers, but the latter are per-column, which would be a real pain to set up.

- Steve



Reply via email to