ExecuteSectionN

In some cases, you must create multiple [Execute] sections to execute several SQL statements. If this is set, it executes the SQLStatement in each of the sections for each row returned by the current query.

NOTE:

This parameter is not normally required. You can usually create a view that contains all the required data and which requires only a single statement that is configured in the [ODBC] section.

Type: String
Default:  
Required: No
Configuration Section: Database Repository or Execute
Example:
[ODBC]
GroupServerLibrary=ogs_odbc.dll
ConnectionString=DSN=Groups
ExecuteSection0=ODBC_GetUsers

[ODBC_GetUsers]
SQLStatement=SELECT DISTINCT Username FROM Groups
AddType=USER
UserColumn=Username
ExecuteSection0=ODBC_GetGroups

[ODBC_GetGroups]
SQLStatement=SELECT Groupname FROM Groups WHERE Username='@(Username)'
AddType=USERGROUP
UserColumn=@(Username)
GroupColumn=Groupname

In this example, no SQL statement is found in the [ODBC] section. The SQL statement in the [ODBC_GetUsers] section is executed and usernames are retrieved. For each username returned by the [ODBC_GetUsers] query, the SQL statement in the [ODBC_GetGroups] section is executed with the appropriate value of @(Username) and the group names are extracted.

In this case, multiple execute sections are not necessary and the configuration can be simplified:

[ODBC]
GroupServerLibrary=ogs_odbc.dll
ConnectionString=DSN=Groups
SQLStatement=SELECT Username, Groupname FROM Groups
AddType=USERGROUP
UserColumn=Username
GroupColumn=Groupname
NOTE:

AddType=USER is not required, because it is implied by the AddType=USERGROUP.

See Also: SQLStatement

_HP_HTML5_bannerTitle.htm