Re: [sqlite3-ruby] Bug in execute_batch ?

51 views
Skip to first unread message

Aaron Patterson

unread,
Dec 24, 2012, 11:27:31 PM12/24/12
to sqlite...@googlegroups.com
On Sat, Dec 22, 2012 at 5:00 PM, x17y19 <amber...@gmail.com> wrote:
Hi,

I'm getting an exception with this Ruby code:
--------------------
require 'sqlite3'

db = SQLite3::Database.open "/tmp/foo.db"

# execute contents of file
sql = IO.read 'bug.sql'
db.execute_batch sql
db.close
-------------------------

The file bug.sql has this in it:
----------------------------
-- demonstrate bug in sqlite3 ruby gem

CREATE TABLE IF NOT EXISTS foo ( id int );
-- comment at the end causes problems
---------------------------

Is the above literally what the file contains?  Can you post a gist that reproduces the problem?

I suspect an exception is being raised, the statement is closed, and the ensure block is executed before the exception can be raised to you:


If you can post a gist of the bug.sql file, I think I can fix this.

--
Aaron Patterson
http://tenderlovemaking.com/

x17y19

unread,
Dec 25, 2012, 4:49:48 PM12/25/12
to sqlite...@googlegroups.com

Aaron Patterson

unread,
Dec 25, 2012, 7:05:27 PM12/25/12
to sqlite...@googlegroups.com
On Tue, Dec 25, 2012 at 1:49 PM, x17y19 <amber...@gmail.com> wrote:
Thanks.  I've fixed the problem here:


I need to figure out how to test on windows, and then we should do a release.
Reply all
Reply to author
Forward
0 new messages