All pastes #133133 Raw Edit

Unnamed

public text v1 · immutable
#133133 ·published 2006-08-15 17:45 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"], :created => row["created"], :xml => row["xml"] })
      end

      { :log => data }
    }
  end
end

end