[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Errors in mysql + ruby connection

Andrew Wallace

1/20/2007 1:32:00 AM

Hi folks -
After getting my installation worked out, I'm having an error in my test
code that I just don't understand. I am running on OS X (PowerPC).

Ruby 1.8.4
mySQL 5.0.27

I'm using DBI to access the database, borrowing code from the Ruby
Cookbook. The connection routine:

####################################################################
dbconnect.rb:
####################################################################
#!/usr/bin/ruby -w

require 'rubygems'
require 'dbi'

def with_db
DBI.connect("DBI:Mysql:iskme_import:localhost", "ISKME",
"oerportal") do |c|
yield c
end
end


And my test code:

####################################################################
#!/usr/bin/ruby -w

require 'pp'
require 'dbconnect'

# sql = "SELECT * FROM AddItems"

sql = "INSERT INTO AddItems(type, iskme_id, native_id, title, url,
institution, collection, submitter) " +
"VALUES ('C','C000000299634946873', '11', 'Too High for the
Supermarket', +
" 'http://www.diamondw.net/index..., " +
" 'The Uninvited', '13 Ways to Feel the Love',
'andyw')"

with_db do |c|
c.execute(sql).each do |row|
pp ["GOT:", row]
end
print "found #{rows} rows\n"
end


If I run the INSERT statement, I get this error:
/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:601:in `fetch':
undefined method `fetch_row' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:659:in `fetch'
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:684:in `each'
from dbtest.rb:14
from ./dbconnect.rb:9:in `with_db'
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:429:in `connect'
from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:214:in `connect'
from ./dbconnect.rb:8:in `with_db'
from dbtest.rb:11

BUT, the record gets inserted (I use phpMyAdmin to administer the DB,
and I see the record). I just can't figure out what's happening here.
All help will be greatly appreciated.

Thanks,
Andy

--
Posted via http://www.ruby-....

3 Answers

arromdee

4/23/2012 10:33:00 PM

0

In article <826808c4-4a7b-4160-8838-f89c697a055e@l3g2000vbv.googlegroups.com>,
Remysun <remysun2000@yahoo.com> wrote:
>Seriously, Pokemon may be a blatant commercial, but subtly, there's
>649 of them, individually named with allusions and puns, and there's
>kids who've memorized all of them, which proves that they could learn
>if education wasn't such a crock.

This argument always bothered me. How do you know that the kids memorized
all the Pokemon? Maybe they memorized 2/3 of them, forgot some more,
and got 10% of them wrong. Maybe they just know the names but got the
descriptions wrong. After all, how would you ever notice?
--
Ken Arromdee / arromdee_AT_rahul.net / http://www.rahul.ne...

Obi-wan Kenobi: "Only a Sith deals in absolutes."
Yoda: "Do or do not. There is no 'try'."

Remysun

4/24/2012 2:34:00 AM

0

On Apr 23, 6:33 pm, arrom...@rahul.net (Ken Arromdee) wrote:

> This argument always bothered me.  How do you know that the kids memorized
> all the Pokemon?  Maybe they memorized 2/3 of them, forgot some more,
> and got 10% of them wrong.  Maybe they just know the names but got the
> descriptions wrong.  After all, how would you ever notice?

For the original 150, there was a Pokerap. The video and card games
depend on taking advantage of Pokemon strengths and weaknesses. Plus,
both versions depend on reading. The card game is their first dabble
in fine print. I'm actually surprised that the Christian Right hasn't
yet denounced Pokemon over their version of evolution.

But really, even if they err as much as you claim, that would still be
a sad improvement if it could somehow be applied to standardized
tests. Like when I had to memorize the periodic table.

johnhancock280

1/19/2014 3:34:00 PM

0

On Thursday, April 5, 2012 2:04:58 PM UTC-4, Matt Casey wrote:
> On Apr 4, 1:13 am, TMC <tmc1...@gmail.com> wrote:
>
> > http://www.facebook.com/pages/Repeal-the-Childrens-Televisi......
>
> >
>
> > About:http://www.facebook.com/pages/Repeal-the-Childrens-Televisi......
>
> >
>
> > Descriptionhttp://boards.radio-info.com/smf/index.php?topic...
>
> >
>
> > Re: NBC To Debut Saturday Preschool Block
>
> > « Reply #13 on: April 01, 2012, 12:03:38 AM »
>
> > Quote from: Mario-500 on March 29, 2012, 07:02:12 AM
>
> > The description "preschool block" reminds me of my wish for the repeal
>
> > of the Children's Television Act passed by the Congress of the United
>
> > States in 1990. If more folks were aware of the law and they were to
>
> > contact their legislators, there would be a great chance of this law
>
> > being repealed, thus leaving broadcasters without obligations to
>
> > broadcasting educational and informative programming programming. It
>
> > may not lead to the return of the traditional Saturday morning
>
> > programming of the past immediately, but it would mean less government
>
> > regulation of content broadcast.
>
> >
>
> > There's not really much chance of it being repealed, since I can't
>
> > imagine there being much of a groundswell of people writing to their
>
> > legislators on this particular issue. Most folks simply don't care one
>
> > way or the other.
>
> >
>
> > In any event, even if it were repealed, the chances of it resulting in
>
> > the "return of the traditional Saturday morning programming" is
>
> > somewhere in the general vicinity of zero. Saturday morning cartoons
>
> > did not disappear because of the Children's Television Act -- they
>
> > disappeared because children's advertising mostly moved to cable
>
> > channels. The revenue just wasn't there to motivate stations to
>
> > continue running kid's shows. So the strong stations ran news (which
>
> > was more profitable) and the weak stations started running
>
> > infomercials. The only way that changes is if stations think that they
>
> > can sell advertising during children's programming.
>
> >
>
> > « Reply #14 on: April 01, 2012, 12:18:29 AM »
>
> > Quote from: TexasTom on April 01, 2012, 12:03:38 AM
>
> > There's not really much chance of it being repealed, since I can't
>
> > imagine there being much of a groundswell of people writing to their
>
> > legislators on this particular issue. Most folks simply don't care one
>
> > way or the other.
>
> >
>
> > Apparently, broadcasters seem to be apathetic about the issue as well
>
> > -- even though they're finding the cheapest ways to satisfy E/I,
>
> > they're in no hurry to get their lobbying group in Washington to
>
> > pressure the congresspeople to abolish E/I.
>
> >
>
> > Quote from: TexasTom on April 01, 2012, 12:03:38 AM
>
> > The revenue just wasn't there to motivate stations to continue running
>
> > kid's shows. So the strong stations ran news (which was more
>
> > profitable) and the weak stations started running infomercials. The
>
> > only way that changes is if stations think that they can sell
>
> > advertising during children's programming.
>
> >
>
> > Technically, stations still can run ads during kids' shows, but with
>
> > so much strings attached as to what ads can and can't be broadcast,
>
> > it's hardly worth it. For that reason, "Litton's Weekend Adventure"
>
> > has pharmaceutical ads and PI commercials, all focused on adults in
>
> > general, during the breaks.
>
> >
>
> > « Reply #17 on: April 02, 2012, 09:13:10 PM »
>
> > Quote from: azumanga on April 01, 2012, 12:18:29 AM
>
> > Quote from: TexasTom on April 01, 2012, 12:03:38 AM
>
> > The revenue just wasn't there to motivate stations to continue running
>
> > kid's shows. So the strong stations ran news (which was more
>
> > profitable) and the weak stations started running infomercials. The
>
> > only way that changes is if stations think that they can sell
>
> > advertising during children's programming.
>
> >
>
> > Technically, stations still can run ads during kids' shows, but with
>
> > so much strings attached as to what ads can and can't be broadcast,
>
> > it's hardly worth it. For that reason, "Litton's Weekend Adventure"
>
> > has pharmaceutical ads and PI commercials, all focused on adults in
>
> > general, during the breaks.
>
> >
>
> > The problem isn't with the advertising that they're legally allowed to
>
> > run -- the problem is that the advertisers simply aren't interested in
>
> > buying advertising during children's programming on local stations.
>
> > That's why the PI commercials run...the stations can't sell the time
>
> > to anyone else. And it has nothing to do with the Children's TV Act,
>
> > which was in effect long before children's TV on broadcast stations
>
> > dried up. In fact, the strongest years for kids shows on both Fox and
>
> > the WB occurred during years in which the act was already in effect.
>
> >
>
> > « Reply #18 on: April 02, 2012, 09:29:58 PM »
>
> > Quote from: TexasTom on April 02, 2012, 09:13:10 PM
>
> > Quote from: azumanga on April 01, 2012, 12:18:29 AM
>
> > Quote from: TexasTom on April 01, 2012, 12:03:38 AM
>
> > The revenue just wasn't there to motivate stations to continue running
>
> > kid's shows. So the strong stations ran news (which was more
>
> > profitable) and the weak stations started running infomercials. The
>
> > only way that changes is if stations think that they can sell
>
> > advertising during children's programming.
>
> >
>
> > Technically, stations still can run ads during kids' shows, but with
>
> > so much strings attached as to what ads can and can't be broadcast,
>
> > it's hardly worth it. For that reason, "Litton's Weekend Adventure"
>
> > has pharmaceutical ads and PI commercials, all focused on adults in
>
> > general, during the breaks.
>
> >
>
> > The problem isn't with the advertising that they're legally allowed to
>
> > run -- the problem is that the advertisers simply aren't interested in
>
> > buying advertising during children's programming on local stations.
>
> > That's why the PI commercials run...the stations can't sell the time
>
> > to anyone else. And it has nothing to do with the Children's TV Act,
>
> > which was in effect long before children's TV on broadcast stations
>
> > dried up. In fact, the strongest years for kids shows on both Fox and
>
> > the WB occurred during years in which the act was already in effect.
>
> >
>
> > Nickelodeon and CN don't show blatantly educational programming other
>
> > than possibly Nick News (wasn't that sydicated to local station as an
>
> > E/I show), school age kids won't watch them. Kids that actually want
>
> > to watch educational shows watch PBS
>
> >
>
> > « Reply #19 on: Yesterday at 12:49:37 AM »
>
> > If Saved by the Bell qualifies as E/I then whay can't Looney Tunes,
>
> > Tom & Jerry, or even the Three Stooges?
>
> >
>
> > But I agree that even if E/I is repealed, the networks will never go
>
> > back to Saturday morning kid's shows like they used to be, and will
>
> > probably be more likely to drop them completely.
>
> >
>
> > The best thing that I can see coming out of E/I being repealed is that
>
> > perhaps college football and basketball will start earlier in the
>
> > day.
>
> >
>
> > http://en.wikipedia.or...
>
>
>
> The Children's Television Act should not be repealed as it helps
>
> maintain the appropriate use of the public airwaves, prevents the
>
> networks from producing programming that's inappropriate, helps
>
> parents guide their children in what TV programs they should watch,
>
> promotes family-friendly programming, takes the burden off PBS, and
>
> prevents the exclusion of children from TV programming. E/I isn't
>
> censorship. Do we want our children to watch filth or be excluded from
>
> TV programming because everything is for adults.
>
>
>
> There is plenty of programming for adults and that's on the
>
> majority of the time. Why can't some time, even if its only for one
>
> hour a week, be reserved for our kids? And when they watch, why can't
>
> they learn something? There's needs to be more available for kids to
>
> watch on television than just cartoons. And I wouldn't want my kids to
>
> watch today's cartoons anyway. They're low quality garbage. It would
>
> actually be censorship to repeal E/I because it would be allowing the
>
> corrupt elements of the entertainment industry to control the
>
> airwaves. Repealing E/I could actually lead to the imposition of
>
> unconstitutional regulations. Do you all want that?
>
>
>
> I agree that not everything should be family-friendly and for
>
> children. Adults should have entertainment, but the networks giving
>
> children three hours of their programming time every week isn't making
>
> that much of a sacrifice and guarantees continued freedom of the
>
> airwaves. If you hurt our kids by denying them that three hours that's
>
> currently devoted to them you'll hurt us all. I'll say it again. The
>
> networks devote the majority of their time to adults, but they can
>
> give children three hours a week so children can learn.

Beat it liberal. I'm sick and tired of you people wanting government to regulate EVERYTHING. That shit needs to end!