On Aug 18, 1:17 am, dave <[email protected]> wrote: > the code below is what i used with DBI and it stops user injection to > corrupt the DB etc. > > stmt = 'select * from test.run where cust_code = ? and date = ?' > row = @db[stmt,nos,date].to_a > > What would be the equivalent to what I have above for sequel?
A direct equivalent would be: stmt = 'select * from test.run where cust_code = ? and date = ?' row = DB[stmt,nos,date].first A more Sequel-ish approach would be: DB[:test__run].first(:cust_code=>nos, :date=>date) > and where I'm asking for only 1(one) variable the code below works so > what's happening? > > 'stmt = select * from test.run where cust_code = ?' > row = @db[stmt,nos].to_a > > _OR_ is the preferred way is via filters and how would I redo the > samples above work? I think using filters leads to cleaner code compared to using raw SQL, but it's really up to you. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
