From: "Brad Cox, Ph.D." Date: 2002-05-27T10:46:25+09:00 Subject: Re: DBI access to mysql auto_increment record numbers? Sean, sorry if I'm being obtuse, but this isn't working out. My dbh Mysql::Database:0x402bd2e0 @mutex=#, @attr={}, @handle=#>> The problem: Exception `NameError' at /usr/local/ile/lib/Person.rb:75 - undefined method `insert_id' for # undefined method `insert_id' for # I've gone thru the sources and don't find insert_id anywhere in ruby-dbi-all-0.0.15.tar.gz Am I using the right software? Suggestions? On Mon, 20 May 2002, Sean Chittenden wrote: > > How do you get the auto_increment record number for mysql in > > ruby/dbi/mysql? > > sql = 'INSERT INTO foo (foo_name) VALUES (?)' > dbh.do(sql, my_foo_name) > insert_id = dbh.insert_id > > if insert_id.nil? > raise "bad things happened" > end > > It's untested... but DBD::Mysql#insert_id() should be available via a > DBH instance. -sc -- Brad J Cox, Ph.D. bcox@virtualschool.edu, 703 361 4751 For industrial age goods there were checks and credit cards For everything else, there is http://virtualschool.edu/mybank Java Web Application Environment: http://virtualschool.edu/jwaa Interactive Learning Environment: http://virtualschool.edu:8083