voyager has asked for the wisdom of the Perl Monks concerning the following question:
The output is:sub _select { my ($self, $sql, $where, $values, $orderby) = @_; my @values = $values ? @$values : undef; $sql .= " where $where " if $where; $sql .= " order by $orderby " if $orderby; my $sql2 = "select * from content where name = 'practice' "; print $sql; print $sql2; print ($sql eq $sql2 ? 'equal' : 'NOT'); # print "DEBUG: $sql w/values: " . Dumper \@values; my $sth = $self->dbh->prepare($sql) or die "couldn't prepare: " . +$self->dbh->errstr(); # $sth->execute(@values) or die "couldn't execute: " . $self->dbh->e +rrstr(); $sth->execute() or die "could't execute: " . $self->dbh->errstr(); my @rows = (); while (my $row = $sth->fetchrow_hashref()) { push (@rows, $self->new($row) ); } return \@rows; }
It dies on the $sth prepare if it is passed $sql. But works if passed $sql2. Is there some way the two vars are different even though they appear to be equal?select * from content where name = 'practice' select * from content where name = 'practice' equal Software error: DBD::CSV::Statement=HASH(0x1c84c3c) is not a valid SQL::Statement obje +ct at E:/Perl/site/lib/DBD/File.pm line 171.
2001-03-19 Edit by Corion : Changed PRE tags to CODE tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Variable are equal but don't behave that way
by tye (Sage) on Mar 21, 2001 at 04:07 UTC | |
|
Re: Variable are equal but don't behave that way
by voyager (Friar) on Mar 21, 2001 at 04:29 UTC |