# Rails db adapter problem - "-- statement #0"

**URL:** <https://www.ruby-forum.com/t/rails-db-adapter-problem-statement-0/58531>\
**Category:** Rails\
**Created:** [April 22, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/rails-db-adapter-problem-statement-0/58531 "2006-04-22T19:49:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jared](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/848f3c/32.png) [@jared](https://www.ruby-forum.com/u/jared)\
**Post date:** [April 22, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/rails-db-adapter-problem-statement-0/58531/1 "2006-04-22T19:49:47Z")

</div>

Hi all,

I’m working on a database adapter for the Ingres database and I’m having  
a problem with the Rails tests.

The first SQL statement from each of the four SQL files (ingres.sql,  
etc), is sent to the database with this line first: – statement #0 and  
extra blank lines.

So the database is getting “sql” that looks like this:  
"

– statement #0  
DROP TABLE courses

"  
instead of  
DROP TABLE courses

I’m sure it’s something i’ve done 🙂 but I can’t find the code that  
loads those files. Can someone point me in the right direction? Google  
and Yahoo have failed me on this problem.

Thanks!

btw, I’m on the stable version of Rails, probably two or three weeks  
ago.

Jared  
[http://jaredrichardson.net](http://jaredrichardson.net)

---

<div class="post-metadata">

**Author:** ![jared](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/848f3c/32.png) [@jared](https://www.ruby-forum.com/u/jared)\
**Post date:** [April 22, 2006, 8:13pm UTC](https://www.ruby-forum.com/t/rails-db-adapter-problem-statement-0/58531/2 "2006-04-22T20:13:46Z")

</div>

> The first SQL statement from each of the four SQL files (ingres.sql,  
> etc), is sent to the database with this line first: – statement #0 and  
> extra blank lines.
> 
> So the database is getting “sql” that looks like this:  
> "
> 
> – statement #0  
> DROP TABLE courses
> 
> "

Found it… I’m not sure how this code is the stable branch. I don’t see  
how it could work properly… am I missing something basic? Should my  
adpapter be ignoring the extra text?

In stable/activerecord/test/aaa\_create\_tables\_test.rb this line occurs:

connection.execute(“\n\n– statement ##{i}\n#{sql}\n”) unless sql.blank?

I changed it to be connection.execute(sql) unless sql.blank?

and my ingres code can now run the sql.

Am I missing something here? I don’t see how this could work unless the  
database extention was written to look for the extra text and strip it  
out again.

Jared  
[http://jaredrichardson.net](http://jaredrichardson.net)
