Persephone Using a function to obtain the database object
Document

Using a function to obtain the database object

by Group Public on Friday August 15 2008 @ 15:35:26 (1/1 Points)

Language ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It

Sometimes you don't have a global variable which contains the database object, rather you have a function which returns that reference.

In such cases you can use the func definition in the provider block.

provider Name {
  ...
  func getDBObject;
}

On generation wherever a connection is needed this function will be called. It may cache the result, or it may call it multiple times, therefore the function should return an reference.

© 2008-2010 edA-qa mort-ora-y
Using Persephone and TestPlan
Tag: