[Dbix-class] [newbie]How to call stored procedure?(doc already
read)
Tony Winslow
tonywinslow1986 at gmail.com
Sun Dec 30 02:34:02 GMT 2007
Peter Flanigan wrote:
> Tony Winslow wrote:
>
>> Danny Warren wrote:
>>
>>> It would be helpful if you could post a code sample. I am sure
>>> someone could spot it quickly that way (more eyes, etc etc).
>>>
>>> Check to make sure the first argument to your search call is truly
>>> undef, and make sure you are passing your array of bind values as a
>>> reference.
>>>
>>> This is the error I get when I fat-finger in a search call, and
>>> checking for undefs and refs at the offending point is the first
>>> thing I try.
>>>
>>>
>> Here is my codes:
>>
>> # Document.pm -- Controller
>> ......
>> sub test : Local {
>> my ($self, $c) = @_;
>> my @cnt;
>> # my $cnt;
>> $c->model('MyDB::RevComp')->search(
>> undef,
>> bind => \@cnt
>> # bind => \$cnt
>> );
>> .......
>> }
>>
>
> And as Danny pointed out, you are missing the {} around bind => \@cnt
>
> Regards
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>
>
I finally got a way out
see http://www.mysql.gr.jp/mysqlml/mysql/msg/11282
although written in Japanese, codes are readable
here comes my code:
my $dbh = $c->model('MyDB')->schema->storage->dbh;
$dbh->do('CALL countRevs(@rtnVal)');
my $cnt = $dbh->selectrow_array('SELECT @rtnVal');
Thank you all!
More information about the DBIx-Class
mailing list