From: Charles Mills Date: 2004-12-18T03:22:11+09:00 Subject: Re: String expand problem Austin Ziegler wrote: (snip) > If you've ever done Oracle programming using Pro*C, this is equivalent to doing: > > SELECT foo, bar > FROM baz > WHERE oingo = :boingo; > > It results in far more efficient SQL most of the time, because the > optimizers in quality databases (e.g., most emphatically *not* MySQL) > will detect that all queries referring the ? or :boingo can be > optimized and compiled a particular way so that only the parameters > vary and the SQL doesn't have to be recompiled every time you provide > a new value for :boingo :) > SQLite allows this as well (using ':name' as a place holder). Since the place holder looks like a symbol it seems natural to allow the following (in Ruby DBI and other Ruby database drivers): db.execute("select * from table where field = :yada", :yada => my_string) Anyway, using symbols and the hash in the parameters list thing you end up with some nice syntactic sugar. Clearer than using positional place holders (IMO). -Charlie