# MySQL/Ruby: More documentation or examples?

**URL:** <https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737>\
**Category:** Ruby\
**Created:** [March 22, 2007, 1:12pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737 "2007-03-22T13:12:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Post date:** [March 22, 2007, 1:12pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737/1 "2007-03-22T13:12:45Z")

</div>

Hello, list.

I’m digging my way through the MySQL/Ruby documentation[0], which is,  
sadly, a bit lacking, at least for my still weak understanding of Ruby  
and MySQL. I can’t check the Japanese version, as I don’t speak Japanese  
myself.

Although I have found Paul DuBois’ short introduction to Mysql/Ruby[1],  
which got me started a bit, at least, my google-fu is weak, and only  
turns up (more or less) RoR related cruft.

Right now, I’m poking the different methods with the help of irb, but  
that’s not really helping (Although now I know that  
Mysql::Result#fetch\_row() goes to the next row of a result set,  
apparently, pending further investigation).

That being said, is there more detailed coverage of the MySQL/Ruby  
module available? If so, where can I find it? The project’s website  
provides the same information as the README within the gem,  
unfortunately.

Bibliography:  
[0] [MySQL/Ruby](http://www.tmtm.org/en/mysql/ruby/)  
[1] [http://www.kitebird.com/articles/ruby-mysql.html](http://www.kitebird.com/articles/ruby-mysql.html)

–  
Phillip “CynicalRyan” Gawlowski

Rule of Open-Source Programming #4:

If you don’t work on your project, chances are that no one will.

---

<div class="post-metadata">

**Author:** ![Phillip\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Post date:** [March 22, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737/2 "2007-03-22T15:22:39Z")

</div>

I know this is not a straight answer, but you may want to check  
ActiveRecord in RoR. It works standalone nicely outside of the  
framework.

---

<div class="post-metadata">

**Author:** ![Phillip\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Post date:** [March 22, 2007, 4:11pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737/3 "2007-03-22T16:11:47Z")

</div>

Makoto Inada wrote:

> I know this is not a straight answer, but you may want to check  
> ActiveRecord in RoR. It works standalone nicely outside of the framework.

Probably a good idea, but unfortunately I cannot abstract the Database  
too much.  
1.) I didn’t develop the database myself, and working with it from a  
pure SQL POV is a pain in the neck. I can’t imagine the problems I’m  
going to have to wrestle  
2.) Those who did have no real clue what the benefits of an SQL Database  
are (a VARCHAR field is set as an INDEX, for example, I have yet to see  
a FOREIGN KEY, and the column itemid in one table could be named item\_id  
in the next, while containing the same data, and so on…).

And thirdly, but more importantly, I want to bring my SQL skills up to  
speed, too. I don’t want to handle just the usual suspects of SQL  
statements, but broaden my skillset a little more towards DBA.

And I really, really cannot add another thing to my “things to learn to  
do a good job of it” list. Before I tackle _anything_ related to Rails,  
I want to write fluent and _good_ Ruby first.

–  
Phillip “CynicalRyan” Gawlowski

Rule of Open-Source Programming #34:

Every successful project will eventually spawn a sub-project

---

<div class="post-metadata">

**Author:** ![Phillip\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Post date:** [March 22, 2007, 9:20pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737/4 "2007-03-22T21:20:24Z")

</div>

On Fri, Mar 23, 2007 at 12:10:55AM +0900, Phillip G. wrote:

> Makoto Inada wrote:
> 
> > I know this is not a straight answer, but you may want to check  
> > ActiveRecord in RoR. It works standalone nicely outside of the framework.
> 
> Probably a good idea, but unfortunately I cannot abstract the Database  
> too much.

You might also want to look at ruby-dbi. This gives a small abstraction  
layer on top of the native database adapter; this means you can learn  
just  
one API and use it to send SQL to Mysql, Oracle, Sqlite etc (of course,  
the  
SQL statements that you send may be different for each of those  
databases)

You also might find better documentation or examples. A quick google for  
“ruby-dbi” turns up a number of introductory documents and examples. The  
first hit is  
[http://www.kitebird.com/articles/ruby-dbi.html](http://www.kitebird.com/articles/ruby-dbi.html)

HTH,

Brian.

---

<div class="post-metadata">

**Author:** ![Phillip\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@Phillip\_G](https://www.ruby-forum.com/u/Phillip_G)\
**Post date:** [March 22, 2007, 9:46pm UTC](https://www.ruby-forum.com/t/mysql-ruby-more-documentation-or-examples/89737/5 "2007-03-22T21:46:28Z")

</div>

Brian C. wrote:

> You might also want to look at ruby-dbi. This gives a small abstraction  
> layer on top of the native database adapter; this means you can learn just  
> one API and use it to send SQL to Mysql, Oracle, Sqlite etc (of course, the  
> SQL statements that you send may be different for each of those databases)
> 
> You also might find better documentation or examples. A quick google for  
> “ruby-dbi” turns up a number of introductory documents and examples. The  
> first hit is  
> [http://www.kitebird.com/articles/ruby-dbi.html](http://www.kitebird.com/articles/ruby-dbi.html)

Thanks, I’ll take a look at it tomorrow.

A first glance reveals that it isn’t too different from MySQL/Ruby, but  
much more accessible. It’s, at least, intriguing (especially interfacing  
to several different databases).

–  
Phillip “CynicalRyan” Gawlowski

Rule of Open-Source Programming #9:

Give me refactoring or give me death!
