schema { | table |
puts "NEW TABLE"
for field in table.Fields
puts "%-15s %10s" % [field.name, field.value]
end
puts
}
OK, it could do with some refactoring, but I was just trying to get something working. I think that impresses me about this block stuff is that it's a really neat way to hide messy implementation details. ADODB has a slightly strange way of iterating over records (the !rs.eof bit); but that doesn't matter because it's all hidden away. I just iterate over the recordset like it was a normal list.
I'm tempted to stick around to see what other goodies Ruby has in store.
What I'm actually trying to do is read a database, bump the date values of some of the fields, create some new records, and put the result into a new database. Before I completely re-invent the wheel, is there a ruby library that is likely to be of assistance?
"Mark Carter" <cartermark46@ukmail.com> schrieb im Newsbeitrag
news:37e9ktF57ldcjU1@individual.net...
I jobby out VBA code for a living, although I use python wherever I can.
I thought I'd try out Ruby to see what all the fuss was about.
Welcome aboard!
So far, I'm impressed. Here's a little proggy that I knocked out to dump
the table structure of a database:
<snip/>
OK, it could do with some refactoring, but I was just trying to get
something working. I think that impresses me about this block stuff is
that it's a really neat way to hide messy implementation details. ADODB
has a slightly strange way of iterating over records (the !rs.eof bit);
but that doesn't matter because it's all hidden away. I just iterate
over the recordset like it was a normal list.
I'm tempted to stick around to see what other goodies Ruby has in store.
I'm nearly sure you'll stay longer...
What I'm actually trying to do is read a database, bump the date values
of some of the fields, create some new records, and put the result into
a new database. Before I completely re-invent the wheel, is there a ruby
library that is likely to be of assistance?
Look at the Ruby DBI/DBD implementations. It typically comes preinstalled
but if you need more, you can look in the RAA http://raa.ruby-lang.org/
On Tue, 15 Feb 2005 21:54:53 +0900, Mark Carter <cartermark46@ukmail.com> wrote:
What I'm actually trying to do is read a database, bump the date values
of some of the fields, create some new records, and put the result into
a new database. Before I completely re-invent the wheel, is there a ruby
library that is likely to be of assistance?