Insert preference row¶
This internal write operation creates a new USER_PREFERENCE row. It binds every column value explicitly, relies on an inline Oracle sequence expression for identity generation, and records audit data from the current portal context.
| Field | Value |
|---|---|
| Operation ID | OP-PREF-004 |
| Trigger | SavePreferences calls InsertPref(appName, pageName, userId, preferenceText) after DoesPrefExist returns false. |
| Inputs | appName, pageName, userId, preferenceText |
| Outputs | true after the insert request is issued |
| Primary components | PreferenceData.InsertPref, SqlHelper.ScalarQuery<int>, SqlHelper.NewParm |
| Entry point | SAIF.Framework.Preferences\PreferenceData.cs |
Steps¶
- Use the fixed INSERT statement that targets USER_PREFERENCE and embeds the sequence expression SQL-001 inside the row-creation command SQL-004.
- Create a
SqlHelper.ScalarQuery<int>bound to the injectedIDataPortalInfo, reset the parameter list, and bind the row values (BR-001, BR-003, BR-005, SQL-004, USER_PREFERENCE). - Bind
:useridasuserId.ToLower(). - Bind
:appnameand:pagenamefrom the caller inputs. - Bind
:prefsaspreferenceText.Trim(). - Bind
:updatedasSystem.DateTime.Now. - Bind
:updatebyasDPI.UserID. - Attach the parameters and execute the scalar request through the active data portal (SQL-001, SQL-004, USER_PREFERENCE).
- Create the portal request in the
SqlHelper.ScalarQuery<int>constructor. - Add the bind variables to
DataRequestthroughAddParms. - Set
DataRequest.RequestTypetoScalarandDataRequest.SQLStatementto the INSERT text. - Call
IDataPortalInfo.ProcessPortalRequest, then castDataRequest.Resulttointif a scalar result is returned.
Origin: Steps 3.1–3.4 are implemented by Execute a data portal request (
SAIF.Framework.Core) and executed on behalf of this operation. 4. Discard the scalar result and returntrueafter the request completes. - On failure: any portal or data-provider exception propagates because this method has no local retry or recovery logic.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([InsertPref called]) --> Build[Build insert parameters]
Build --> Execute[Execute INSERT with sequence nextval]
Execute --> EndOk([Return true])
Failure and edge-case behavior¶
pageNameis always bound on insert, even though the read/update/delete paths conditionally append page predicates instead of always binding one.- The method does not inspect the returned scalar or affected-row count before returning
true. - Portal or data-provider failures propagate to the caller unmodified.
Related documentation¶
Sources¶
- SAIF.Framework.Preferences\PreferenceData.cs
- SAIF.Framework.Core\V1\DataAccessLayer\SqlHelper.vb