logo       

Re: Using stored procedures: msg#00052

lang.perl.modules.dbi.rose-db-object

Subject: Re: Using stored procedures

Thank you for your prompt answer :)

> I'm surprised that ever worked since it's not strictly supported. The
> suggested alternative is to make a VIEW on your stored_proc() and then
> point RDBO at that view.

The parameters for my stored procedure are indicating the level of agregation
and the filters (basically, the values in where clause) applied to data.
Because I don't know how to process the where clause using db server side
rule system, I'm using stored procedures.

I tried a hack and it appear to working: in my subclass of Rose::DB I
overwrite the quote_table_name sub:

sub quote_table_name
{
my $name = $_[1];
$name =~ s/"/""/g;
$name =~ /^([^(]+)(\(.+\))?$/;
return qq("$1") . ( $2 || '');
}

Related, I guess that also the schema name (and maybe the catalog name ?) must
be quoted.

> > Also, are other corelated effects if I'm changing the table name
> > after initialization ?
>
> Probably. Don't do that :)

Until I will find another idea and implement it, or something will break, I
will do that ;:)

> Methods like this are intended to go in Manager classes. But the built-in
> Manager methods deal only with tables that have primary keys, and queries
> that return unique row from those tables in the form of RDBO objects. It's
> possible to roll your own Manager methods that run custom SQL and return
> arbitrary data rather than row objects, and the QueryBuilder might be able
> to help you automate the process somewhat, but there's currently no
> get_results() equivalent to get_objects(). It's on the list...

If I will manage to build something like that, I'll let you know :)


Thank you,
Lucian Dragus


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise