Retrieve single preference blob¶
This is the library's simplest read path: it looks up at most one USER_PREFERENCE row for a given application name, normalized user ID, and optional page name, and returns the stored PREFERENCE_TEXT string when a matching row exists.
| Field | Value |
|---|---|
| Operation ID | OP-PREF-001 |
| Trigger | Caller invokes PreferenceData.GetPreferences(appName, pageName, userId). |
| Inputs | appName, pageName, userId |
| Outputs | PREFERENCE_TEXT as string, or string.Empty when no row matches |
| Primary components | PreferenceData.GetPreferences, SqlHelper.ResultSetQuery, clsResultSet.DataRow.GetString |
| Entry point | SAIF.Framework.Preferences\PreferenceData.cs |
Steps¶
- Start with the base SELECT text for
USER_ID,APP_NAME,PAGE_NAME, andPREFERENCE_TEXTfrom USER_PREFERENCE (SQL-002). - Reset the parameter list, create a
SqlHelper.ResultSetQuerybound to the injectedIDataPortalInfo, and add:useridasuserId.ToLower()plus:appnameas the requested application name (BR-001, SQL-002, USER_PREFERENCE). - Apply scope selection for the optional page name (BR-003, SQL-002, USER_PREFERENCE).
- If
pageNameis empty, appendand PAGE_NAME is NULL. - If
pageNameis present, appendand PAGE_NAME = :pagenameand add the matching bind parameter. - Attach the accumulated parameters and execute the result-set query against the active portal (SQL-002, USER_PREFERENCE).
- Create the portal request in the
SqlHelper.ResultSetQueryconstructor. - Add the bind variables to
DataRequestthroughAddParms. - Set
DataRequest.RequestTypetoResultSetandDataRequest.SQLStatementto the final SQL text. - Call
IDataPortalInfo.ProcessPortalRequest, then castDataRequest.Resultback toclsResultSet.
Origin: Steps 4.1–4.4 are implemented by Execute a data portal request (
SAIF.Framework.Core) and executed on behalf of this operation. 5. Inspect the returned result set. - Ifresult.Count > 0, returnresult[0].GetString("PREFERENCE_TEXT")from the first row. - If no row is returned, returnstring.Empty. 6. Complete without additional validation or duplicate-row handling. - On failure: any portal or data-conversion exception propagates to the caller because this method has no local recovery logic.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller invokes GetPreferences]) --> Build[Build scoped SELECT]
Build --> Execute[Execute result-set query]
Execute --> Found{Any rows returned?}
Found -->|Yes| ReturnText([Return first PREFERENCE_TEXT])
Found -->|No| ReturnEmpty([Return string.Empty])
Failure and edge-case behavior¶
- Empty
pageNameswitches the scope toPAGE_NAME is NULLinstead of binding:pagename. - Only the first matching row is returned; the method does not check for or report duplicates.
- Failures from portal execution or
GetStringconversion are not handled locally and surface to the caller as-is.
Related documentation¶
Sources¶
- SAIF.Framework.Preferences\PreferenceData.cs
- SAIF.Framework.Core\V1\DataAccessLayer\SqlHelper.vb
- SAIF.Framework.Core\V1\DataAccessLayer\clsResultSet.vb