Matt Sergeant wrote: > > DBI uses "pull" - you execute a statement then pull the results one by > one - exactly the same as a cursor in SQL terms. > > But I'm working on a DBD driver [1] for a "push" engine - you pass a > callback function to execute() and it calls that for every row in the > result set.
DBD::AnyData does something similar with some of its func() calls - for example loop through a table in format Foo and, for each record read it into memory, check if it matches a SELECT, and if so, convert it to format Bar and write it to a second file. This way large files can be converted to other formats without ever slurping the entire file. I have been talking with Wes Hardraker (author of the upcoming AnyData::Format::SNMP) and Tod Harter (author of the upcoming AnyData::Format::Syslog) about ways of handling pipes of data with callbacks something like you describe. I'd be interested to know how you solve your problem as it may suggest approaches for me. -- Jeff
