# Sqlite3-ruby failing on 1.9.2?

**URL:** <https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822>\
**Category:** Ruby\
**Created:** [September 11, 2010, 3:43pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822 "2010-09-11T15:43:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sentinel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Post date:** [September 11, 2010, 3:43pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822/1 "2010-09-11T15:43:16Z")

</div>

I have apps working on 1.9.1 but simple inserts are failing on 1.9.2.  
Is there some change in versions required, I’ve got latest versions.

OS X 10.6  
sqlite3 3.6.22  
sqlite3-ruby 1.3.1

If I issue as simple statement such as:

db.execute(" insert into basic ( id, desc ) values (?,?)",10, desc )

The first column gets a nil, which obviously fails if that col has a  
constraint.

However, if i do this it seems to work:

db.execute(" insert into basic ( id, desc ) values (10,?)",desc )

thanks,  
rahul

(my 1.9.1 version is an earlier on 1.2.5)

---

<div class="post-metadata">

**Author:** ![sentinel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Post date:** [September 11, 2010, 5:53pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822/2 "2010-09-11T17:53:02Z")

</div>

Hi,

On Sat, Sep 11, 2010 at 10:43 PM, Rahul K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> If I issue as simple statement such as:
> 
> db.execute(" insert into basic ( id, desc ) values (?,?)",10, desc )
> 
> The first column gets a nil, which obviously fails if that col has a  
> constraint.

Try the statement below instead

db.execute(" insert into basic ( id, desc ) values (?,?)", [10, desc  
])

> (my 1.9.1 version is an earlier on 1.2.5)

Some APIs have been changed since version 1.3.0.  
According to API\_CHANGES.rdoc,

SQLite3::Database#execute only accepts an array for bind parameters.

---

<div class="post-metadata">

**Author:** ![sentinel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Post date:** [September 11, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822/3 "2010-09-11T18:40:10Z")

</div>

Eito Katagiri wrote:

> Hi,
> 
> On Sat, Sep 11, 2010 at 10:43 PM, Rahul K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > If I issue as simple statement such as:
> > 
> > ï¿½ db.execute(" insert into basic ( ï¿½id, desc ) values (?,?)",10, desc )
> > 
> > The first column gets a nil, which obviously fails if that col has a  
> > constraint.
> 
> Try the statement below instead
> 
> db.execute(" insert into basic ( ï¿½id, desc ) values (?,?)", [10, desc  
> ])
> 
> > (my 1.9.1 version is an earlier on 1.2.5)
> 
> Some APIs have been changed since version 1.3.0.  
> According to API\_CHANGES.rdoc,
> 
> SQLite3::Database#execute only accepts an array for bind parameters.

1. The samples for execute used to give “\*bind\_params”, but now they are  
working after i removed the “splat”.  
(Is this compatible with earlier ruby versions ?)

2. bind\_params() now has problems with Time and Date classes.  
I did a “to\_s” to the values i am putting in the array, and they are  
working. I will only know later if the queries  
selecting data on time and date are working correctly.

3. I checked API\_CHANGES.rdoc and Changelog.rdoc but i can’t see the  
execute  
change, and any other changes that affect date and time.

I would be grateful if someone could point out where these changes are.  
Has compatibility with earlier versions broken with these changes.

thanks alot for the quick reply.

---

<div class="post-metadata">

**Author:** ![sentinel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Post date:** [September 12, 2010, 9:39am UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822/4 "2010-09-12T09:39:36Z")

</div>

Okay, one more issue in sqlite3-ruby 1.3.x  
It seems to have stopped respecting “arrayfields”.

My retrieved rows are coming back as Arrays, causing my app to fail.

Any else facing this ?

thx.

---

<div class="post-metadata">

**Author:** ![sentinel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Post date:** [September 12, 2010, 9:53pm UTC](https://www.ruby-forum.com/t/sqlite3-ruby-failing-on-1-9-2/194822/5 "2010-09-12T21:53:27Z")

</div>

On Sep 12, 4:45 am, Rahul K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Okay, one more issue in sqlite3-ruby 1.3.x  
> It seems to have stopped respecting “arrayfields”.
> 
> My retrieved rows are coming back as Arrays, causing my app to fail.
> 
> Any else facing this ?

sqlite3-ruby has introduced API changes in 1.3.x line compared to  
1.2.x line.

That is due internal code changes and interface with the C library.

Please check code in the repository:

> **[GitHub - sparklemotion/sqlite3-ruby: Ruby bindings for the SQLite3 embedded...](https://github.com/sparklemotion/sqlite3-ruby)**
>
> Ruby bindings for the SQLite3 embedded database. Contribute to sparklemotion/sqlite3-ruby development by creating an account on GitHub.

For the complete list of changes.

Also, further questions you have about it, please raise them at  
sqlite3-ruby group for better responses form active users.
