MySQL/Ruby: More documentation or examples?

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
[1] 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.

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.

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

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

HTH,

Brian.

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

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!