Question

I am trying to make a simple Rose DB call: $id = xyz; $name = "company";

DataB::testTable::Manager->get_testTable( query =>[ id => $id, name => $name ] );

in it possible to not have the whole query written every time, and declare it like a string variable such that i can just call

DataB::testTable::Manager->get_testTable( query =>[ $query ] );

where $query = qq { id => $id , name => $name };

Please Help

Was it helpful?

Solution 2

Well actually i figured out how to do that . Its not that complicated. Only thing is RoseDB objects expect an array reference for a query. So something like this works :

my @query = ( id => $id, name => $name );

testDB::testTable::Manager->get_testTable( query => \@query );

Just thought would answer it myself, incase someonelse is looking for a solution to this

OTHER TIPS

By what I understood from your question, I am giving this answer. Try this one.

my $myquery = {query =>{ id=>$id, name=>$name }} ;

TGI::testTable::Manager->get_testTable($myquery);

Hope, this gives some idea to you.

Edit for "Hash with Array reference":

my $myquery = [ id=>$id, name=>$name ] ;

TGI::testTable::Manager->get_testTable(query => $myquery);

check out this : How to pass a a string variable as "query" for get Manager call?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top