All pastes #133131 Raw Edit

Stuff

public text v1 · immutable
#133131 ·published 2006-08-15 17:44 UTC
rendered paste body
module Examples

class Db < Cerise::RequestHandler
  def handle(request, response)
    application.with_db_connection("db/Mysql") { |dbh|
      sth = dbh.prepare('select `id`, `created`, `xml` from `log` order by id desc limit 50')
      sth.execute

      data = []
      while row = sth.fetch do
        data.push({ :id => row["id"], :xml => row["xml"], :created => row["created"] })
      end

      { :log => data }
    }
  end
end

end