On 02/12/2004 03:27 AM, Lodewijks, Jeroen wrote:

So the code would be something like

INIT_FUNCTION

my $lcsr = $db->prepare(<<EOS) || ataerr::dbprepare($db);
BEGIN
STORED_PROC.GET_SERVICE_BY_ID(:service_id, :last_modified,
:base_prod_id, :person_id, :operator_id); END;
EOS


END FUNCTION

EXEC FUNCTION
   $lcsr->bind_param(":service_id", $service_id, 2);
   $lcsr->bind_param_inout(":last_modified", \$last_modified, 12);
   $lcsr->bind_param_inout(":base_prod_id", \$base_product_instance_id, 2);
   $lcsr->bind_param_inout(":person_id", \$person_id, 2);
   $lcsr->bind_param_inout(":operator_id", \$operator_id, 2);
   $lcsr->execute() || ataerr::dbexecute($db);
END FUNCTION

TERM FUNCTION
   $lcsr->finish;
END FUNCTION

Finish() is only appropriate for SELECTs when all rows are not being fetch*()ed.

I call INIT and TERM only once

If there is a speed improvement, would it be significant?

It is virtually certain you will see some improvement from preparing only once, probably significant. The only way to know how much is to time it a few hundred times each way.

--
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to