dave lilley wrote:
> Many thanks John so if i take that example and push it out so i can have 1
> method that can return a SQL select statement on any table, field and search
> criteria i would only need to do this?
>
> In ruby it would be ....
>
> make_SQL (table, field, criteria)
>    stmt = "select * from #{table} where #{field} = #{criteria}"
>    row = db.execute(stmt)
> end
>
> and SQLite3 way would be ...
>
> make_SQL(table,field,criteria)
>   stmt = "select * from ? where ? = ?"
>   row = db.execute(stmt)
> end
>
> would this presumtion be correct?
>
>   

No.  You would have to use the table and field names directly:

def make_SQL(table, field, criteria)
   stmt = "select * from #{table} where #{field} = ?"
   row = db.execute(stmt, criteria)
end



John
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to