[CDBI] Use Of Placeholders In set_sql() Example of Beginners Guide

Sam Tregar sam at tregar.com
Sun Mar 19 18:37:15 GMT 2006


On Thu, 16 Mar 2006 hkclark at gmail.com wrote:

> However, I can only get any form of substitution to work if use "%s"
> in the set_sql() and then do something like this to call it:
>    my $sth = Music::Artist->sql_persons("F");
>    $sth->execute;
>    my @persons = Music::Artist->sth_to_objects($sth);

If you use placeholders then you must pass the param to execute()
instead:

     my $sth = Music::Artist->sql_persons();
     $sth->execute("F");
     my @persons = Music::Artist->sth_to_objects($sth);

-sam




More information about the ClassDBI mailing list