Anything like Class::DBI from Perl

We’ve been doing some work using Class::DBI in Perl which makes access
to SQL database nice and straightforward if the database structure
isn’t too complex. Is there anything like this available for Ruby or
in the works? I’ve had a quick look through RAA and couldn’t see
anything along these lines.

thank,
peter w.

Hello!

We do have a Ruby-DBI. Search the RAA.

s

Pablo

···

Em Sáb 01 Mar 2003 11:07, Peter Wilkinson escreveu:

We’ve been doing some work using Class::DBI in Perl which makes access
to SQL database nice and straightforward if the database structure
isn’t too complex. Is there anything like this available for Ruby or
in the works? I’ve had a quick look through RAA and couldn’t see
anything along these lines.

thank,
peter w.


Pablo Lorenzzoni (Spectra) spectra@debian.org
GnuPG Key ID 268A084D at search.keyserver.net
Webpage: http://people.debian.org/~spectra/

The next release of my ‘spl’ package will include a Query class.
At that point it should have similar functionality to Class::DBI,
but not an identical interface.

···

On Sat, 01 Mar 2003 06:04:50 -0800, Peter Wilkinson wrote:

We’ve been doing some work using Class::DBI in Perl which makes access to
SQL database nice and straightforward if the database structure isn’t too
complex. Is there anything like this available for Ruby or in the works?
I’ve had a quick look through RAA and couldn’t see anything along these
lines.

thank,
peter w.

Pablo Lorenzzoni spectra@debian.org writes:

We do have a Ruby-DBI. Search the RAA.

That’s nothing like Class::DBI, however.

···


The course of true anything never does run smooth.
– Samuel Butler

“Gabriel Emerson” egabriel@io.com wrote in message news:pan.2003.03.02.00.20.38.899502@io.com

The next release of my ‘spl’ package will include a Query class.
At that point it should have similar functionality to Class::DBI,
but not an identical interface.

Excellent news, the particular interface doesn’t much bother me the
parts of what we are using currently are quite simple, construct new
rows as objects, search and retrieve using likes and ='s and a few
custom queries that are more complex with multiple parameters turn
into methods on the tables. Hope that makes sense, there is quite a
lot in Class::DBI that looks interesting that we’ve not used yet.

I’ll definitely be looking out for the next release and would be happy
to do testing if you need some done before releasing.

Class::DBI - Simple Database Abstraction - metacpan.org for
those who’ve not looked at the kind of thing it is yet.

thanks.
peter w.

I’m working on something something similar but it isn’t ready yet.

···

On Saturday 01 March 2003 09:07 am, Simon Cozens wrote:

Pablo Lorenzzoni spectra@debian.org writes:

We do have a Ruby-DBI. Search the RAA.

That’s nothing like Class::DBI, however.


Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth@cql.com

“Seth Kurtzberg” seth@cql.com wrote in message

I’m working on something something similar but it isn’t ready yet.

I will be interested in this work … if you are still in need of
beta-testers please sign me in.
Thanks,
– shanko

I have a simple binding library which lets you do something like the following:

···

class Foo
attr_reader :bar, baz
attr_writer :bar, :baz
end

Persist::bind(Foo, ‘foo_table’, :bar, :baz)

f = Foo.fetch(‘pkey_value’)
f.bar = 3
f.store

Foo.select(‘where bar > ?’, 2) {|foo_obj|
p foo_obj
}

It handles about 80% of the database queries I use in a moderately complex (~20kloc)
business application, with the remaining bits done in basic DBI calls.

I’ve also been experimenting with a thread-safe LRU cache for objects, so
that at least multiple concurrent reads of a database-bound data object don’t
have to make a full round trip to the database for each instance.

Right now, it’s not really package as a standalone library, but I’d be happy to go
back over the code, clean it up, and either post it here or on RAA for others to
try out.

Lennon Day-Reynolds
lennon@day-reynolds.com

On Sun, 2 Mar 2003 03:47:51 +0900 “Shashank Date” sdate@everestkc.net wrote:

“Seth Kurtzberg” seth@cql.com wrote in message

I’m working on something something similar but it isn’t ready yet.

I will be interested in this work … if you are still in need of
beta-testers please sign me in.
Thanks,
– shanko

Thanks, all. This thread has made me realise that any comp.lang.ruby
thread can be expressed as a fugue in eight voices. For instance:

1: Hey, does Ruby have the equivalent of Perl library A?
2: I’ve never used Perl library A, but Ruby has B, which must be the same.
1: Thanks, but that’s nothing like A.
3: Well, I’ve never used A either, but I’m working on C, which is a bit like
B.
1: Thanks, but that’s nothing like A.
4: Are you sure that Ruby doesn’t have anything like Perl library A?
5: I’m sure there’s something on the RAA, but I can’t find it right now.
6: What we need is a more categorical way to organise the libraries that
Ruby has.
3: Why does everything end up being a Perl versus Ruby discussion?
4: It doesn’t, but I’d like to see something like A as well.
7: There’s something a bit like A called Alfalfa, but it has no
documentation at present.
6: That’s what I’m saying. Ruby needs stringent documentation standards.
8: Of course, documentation for library D is available in Japanese, and
this is a little like B.
1: Thanks, but that’s nothing like A.
4: So everyone has to learn Japanese to use Ruby?
6: No, what we need is a standard intermediate language for documentation.
3: Well, C is already available and is fully documented.
1: Thanks, but that’s nothing like A.
4: Is Perl faster than Ruby anyway?
5: Why are we trying to make equivalents of Perl libraries? Why aren’t we
leading the field?
1: Thanks, but all I wanted was a library like A.

···


Ever wake up feeling like a null pointer? -Allan Pratt

Thanks, all. This thread has made me realise that any comp.lang.ruby
thread can be expressed as a fugue in eight voices. For instance:

[snip]

Simon, that is the funniest thing I’ve seen
in a week. Did you ever see The Music Man
(the old Broadway show)? This reminds me of
the scene on the train at the beginning.

Cheers,
Hal

···

----- Original Message -----
From: “Simon Cozens” simon@simon-cozens.org
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Saturday, March 01, 2003 6:28 PM
Subject: Re: Anything like Class::DBI from Perl

Simon Cozens simon@simon-cozens.org wrote in message news:87bs0uocei.fsf@simoncozens-2.dsl.easynet.co.uk

Thanks, all. This thread has made me realise that any comp.lang.ruby
thread can be expressed as a fugue in eight voices. For instance:

Ah yes, very true. My motivation for finding something similar to
Class:DBI is so that we can make a quickish move away from Perl. Perl
is a wonderful language in that you can get things done and the sheer
weight of what is available makes life easy except for the slightly
dirty feeling I get every-time I write anything in it :-).

It looks like there are a few libraries in the works that could do the
same job so I’ll definitely be keeping an eye open for those. Thanks
for the pointers on them.

peter w.

Hal, why does this always have to turn into a Perl vs. Ruby argument? :slight_smile:

Chad

···

----- Original Message -----
From: “Hal E. Fulton” hal9000@hypermetrics.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, March 02, 2003 2:33 PM
Subject: OT: Fugue in eight voices - was Re: Anything like Class::DBI from
Perl

----- Original Message -----
From: “Simon Cozens” simon@simon-cozens.org
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Saturday, March 01, 2003 6:28 PM
Subject: Re: Anything like Class::DBI from Perl

Thanks, all. This thread has made me realise that any comp.lang.ruby
thread can be expressed as a fugue in eight voices. For instance:

[snip]

Simon, that is the funniest thing I’ve seen
in a week. Did you ever see The Music Man
(the old Broadway show)? This reminds me of
the scene on the train at the beginning.

Cheers,
Hal

1: How can I do xyz in Ruby?

2: Don’t mention Perl. I mentioned it once, but I think I got away with
it. It’s all forgotten now and let’s hear no more about it. You can solve
your problem using the CPAN, Class::DBI and my $local… no, wait a minute…
I got confused because everyone keeps mentioning Perl.

1: Will you stop mentioning perl?

2: You started it.

1: I did not start it.

2: Yes you did; how else would you run cpan.pl?

PS: Yes, the original was funnier :^|

···

On Sun, Mar 02, 2003 at 08:21:24PM +0900, Chad Fowler wrote:

Hal, why does this always have to turn into a Perl vs. Ruby argument? :slight_smile:


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Alan Cox wrote:
[…]

No I didnt. Someone else wrote that. Please keep attributions
straight.
– From linux-kernel