1. Roland Smith
  2. PowerBuilder
  3. Friday, 19 April 2019 17:12 PM UTC

A blast from the past!

Say you have a component that is not part of a transaction, where would you put the code to connect to the connection cache? The activate event? Within each public function? A function called from each public function?

 

Accepted Answer
Kevin Ridley Accepted Answer Pending Moderation
  1. Friday, 19 April 2019 19:27 PM UTC
  2. PowerBuilder
  3. # Permalink

Since it's a cache, it would always be available, so you wouldn't really need to put it in the constructor/destructor.  In that case it would hold onto that connection for the whole life of the component, which kind of defeats the purpose of pooling.  We always used the activate/deactivate for connect and disconnect back to the cache.  The only exception was if we needed to use multiple dbs/caches in 1 component, and then I'd put it in the individual methods, often times with a try/catch/finally, having the disconnect in the finally.

 

KR

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 19 April 2019 18:20 PM UTC
  2. PowerBuilder
  3. # 1

Hi Roland;

   It really depends on the processing design. Certainly, the "Activate & "Deactivate" events were the most popular place to perform the Connect / Disconnect if the NVUO was used infrequently as not to hold on to "resources". However, if the NVUO was used extensively, then the Constructor / Destructor events would be better as that means that the DB connection would stay open & ready as long as the component was still in the "instance pool".

   Many NVUO's would just use the Is valid() method to check whether the NVUO had an SQLCA active pointer just before the start of a method that actually needed DB interaction.

Note1: the Activate & Deactivate events need to be mapped into an EAS component. They are not automatically added by the PB IDE upon creation in the UK Painter.

Note2: the Activate & Deactivate events can be added & used in a PB based IIS web service component.

HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.