SqlContext

To be able to resolve bind variables at runtime, all code that uses Sql functions that need bind variables resolution is wrapped in a context tracking construct like the following:

using (new SqlContext(this, locals))
{
 ...
}

This is the same technique used to track visual context switching using the SalContext class.

When entering the using block, a new instance of SqlContext is created and pushed onto an internal stack. The instance of SqlContext saves a reference to the local object instance (this) and a reference to the local variables extracted into SqlLocals (locals).

When the PPJ Framework needs to resolve bind variables, it looks into the SqlContext at the top of the stack, and then into the SalContext at the top of the stack.

Last updated