From: "Jim Weirich" <jweirich / one.net> > On Thu, 2002-10-17 at 03:54, Gavin Sinclair wrote: > > Rubyists, > > > > Given a table in a database defined by the following: > > > > create table test ( test DATE ); > > > > how can I insert the current time using Ruby/DBI? Given a DBI::DatabaseHandler > > "dbh" I'd expect that you can do the following: > > > > dbh.do "insert into test values (#{Time.now})" > > This worked for me (using the PostgreSQL driver) .... > > db.do("insert into test values(?)", Time.now) > > IIRC, each individual driver handles conversions to its own native data > types, so your driver might not handle that directly, If so, then you > can try ... > > db.do("insert into test values(?)", DBI::Date.new(Time.now)) > > -- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich Thanks Jim. I didn't even *know* about DBI::Date, and I've spent ages reading the docu^H^H^H^Hcode. I'm hoping to contribute some documentation to that project, becuase it really is a great package. You've given me a whole new frontier to explore. Gavin