From: Daniel de Angelis Cordeiro Date: 2011-03-03T00:23:36+09:00 Subject: Re: RubyODBC error codes when using prepared statements Hi, After some debugging, I found that I was trying to reuse a prepared statement that already had returned an error in a previous execution. So, at the first execution I get the native error: 23505 (7) [unixODBC]ERROR: duplicate key value violates unique constraint "" And when I try to reuse the statement (with parameters that should result in a successful execution) I get the internal error: INTERN (0) [RubyODBC]Stale ODBC::Statement Is it possible to reuse prepared statements after an error in RubyODBC? If so, how? Thanks, Daniel On Wed, Mar 2, 2011 at 11:22, Daniel de Angelis Cordeiro wrote: > Hi, > > I'm using Ruby ODBC (with unixodbc and Postgresql). > RubyODBC is loosing my error codes when running prepared statements. > > When I execute a faulty SQL command using ODBC::Database.run() or > ODBC::Database.do() I get the following native error: > 23505 (7) [unixODBC]ERROR: duplicate key value violates unique > constraint "" > > However, when I execute the same SQL command using a prepared > statement, I get the following internal error: > INTERN (0) [RubyODBC]Stale ODBC::Statement > > Is there a way to recover the type of the native error when executing > a prepared statement? > > > Thanks in advance, > Daniel > >