Using a function to obtain the database objectby 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.
Persephone Using a function to obtain the database object
