vansance has asked for the wisdom of the Perl Monks concerning the following question:
Here's how i define the table in the objects initialization...FS::Model::Items can't SELECT FROM items WHERE address = ? AND zip = ? : DBD::mysql::st execute failed: You have an error in your SQL syntax; + check the manual that corresponds to your MySQL server version for t +he right syntax to use near 'FROM items WHERE address = '170 W. 15th St.' AND zip = '10011'' at line 2 [for S +tatement "SELECT FROM items WHERE address = ? AND zip = ? " with ParamValues: 0='170 W. 15th St.', 1='10011'] at /Library/Perl/5 +.8.8/DBIx/ContextualFetch.pm line 52. at /Library/Perl/5.8.8/Class/DBI/Search/Basic.pm line 169
And then this is the line from the object method that generates the error...# within FS::Model::Items->new(); $self->table('items'); $self->columns( qw/item item_type name lng lat zip url phone fax address/ );
It all comes together with something like this...# within FS::Model::Items->get_info my $item = $self->search( address => $item_info->{address}, zip => $item_info->{zip}, );
The Items object is an InsideOut object which it inherits from my DBI Module which inherits from Class::DBI; So...my $item_obj = FS::Model::Items->new(); my $res_obj = $item_obj->get_info($item_info);
and then...package FS::Model::Items; use Object::InsideOut qw(FS::Model::DBI);
I'm running on OS X 10.5. From the error, it seems like Class::DBI isn't trying to select any columns...but I really can't understand why. Any ideas? Thanks.package FS::Model::DBI; use base ( Class::DBI ); use Object::InsideOut;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class::DBI weirdness sql error
by perrin (Chancellor) on Mar 03, 2009 at 21:53 UTC | |
|
Re: Class::DBI weirdness sql error
by JavaFan (Canon) on Mar 03, 2009 at 21:54 UTC | |
by perrin (Chancellor) on Mar 04, 2009 at 03:16 UTC | |
by Anonymous Monk on Mar 04, 2009 at 08:11 UTC | |
by perrin (Chancellor) on Mar 04, 2009 at 14:19 UTC | |
by trwww (Priest) on Mar 04, 2009 at 01:05 UTC | |
by JavaFan (Canon) on Mar 04, 2009 at 01:28 UTC | |
by trwww (Priest) on Mar 04, 2009 at 02:42 UTC | |
by JavaFan (Canon) on Mar 04, 2009 at 10:17 UTC | |
by vansance (Initiate) on Mar 04, 2009 at 02:53 UTC | |
by JavaFan (Canon) on Mar 04, 2009 at 10:24 UTC | |
by trwww (Priest) on Mar 04, 2009 at 05:34 UTC | |
by JavaFan (Canon) on Mar 04, 2009 at 10:27 UTC |