All, I think I have a working evented Postgres client. I''ll be checking
it
in to the head revision shortly in lib/protocols/postgres.rb. There will be
sample code in there. If anyone is interested in beta testing or critiquing
the API, please send me a gchat IM (garbagecat10 or blackhedd, either one
works).
I was able to use the postgres-pr gem without a whole lot of monkeypatching.
The basic idea is this:
EM.run {
connection = EM.connect_unix_domain( the_postgres_socket, login_parms )
# this will probably get some additional convenience methods
connection.callback do *args
if args.first
connection.query( "select * from some_table" ).callback do
*args
if args.first
# args[1] is a PostgresPR::Connection::Result object
# args[2] is an array containing SQL error messages, if
any.
else
# some sql error happened
end
end
else
# connect or login error
end
end
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080728/94e57e62/attachment.html>