From: larry Date: 2006-10-08T23:20:19+09:00 Subject: binding parameters in ruby/postres queries I'm using the postgres library and trying to improve the performance of a database query that gets repeated many (~1 million) times. The documentation suggests you can pass in bind parameters as so: Documentation -------------------------------------------- conn.query(sql, *bind_values) Sends SQL query request specified by sql to the PostgreSQL.... bind_values represents values for the PostgreSQL bind parameters found in the sql. PostgreSQL bind parameters are presented as $1, $1, $2, etc. ---------------------------------------------------------------------------------------------------------- I've tried to do it (as I interpret the docs) like this sql = "Select rating, date from rating where item_id = $1 and person_id = $2 ;" row = MyConnectionMgr.get_connection.query(sql, [movie, person])[0] but the line starting with 'row = ' throws an exception that i'm passing the wrong number of parameters: "in `query': wrong number of arguments (2 for 1)" I also tried using ? instead of $1, etc. Can someone tell me what I'm doing wrong? thanks.