- # postgres adds string delimiters when quoting, so strip them off
- session_id = PGconn::quote(session_id)[1..-2]
- result = connection.query("SELECT id, data FROM sessions WHERE session_id='#{session_id}' LIMIT 1")
- my_session = nil
- # each is used below, as other methods barf on my 64bit linux machine
- # I suspect this to be a bug in mysql-ruby
- result.each do |row|
- my_session = new(session_id, row[1])
- my_session.id = row[0]
- end
+ result = connection.query("SELECT id, data FROM sessions WHERE session_id = $1 LIMIT 1", [session_id])
+ my_session = new(session_id, result.getvalue(0, 1))
+ my_session.id = result.getvalue(0, 0)