Skip to content

SQL-004: Insert preference row

This INSERT creates a new USER_PREFERENCE row, generating its primary key inline via USER_PREFERENCE_SEQ.nextval (see SQL-001). It backs PreferenceData.InsertPref, invoked from SavePreferences when DoesPrefExist returns false.

Classification

Field Value
SQL ID SQL-004
Operation type Create
Execution method Inline SQL (SqlHelper.ScalarQuery<int>.Execute)
Database Oracle
Schema [unqualified]**
Command type Text
Business object PreferenceData
Criteria property n/a (no IBusinessCriteria)
Lifecycle method InsertPref

Parameters

Parameter Direction Type Max length Description
:userid Input string (SqlHelper.NewParm) 40 Lower-cased user ID for the new row.
:appname Input string (SqlHelper.NewParm) 40 Application name for the new row.
:pagename Input string (SqlHelper.NewParm) 40 Page name for the new row (always bound in INSERT, unlike the conditional binding in SELECT/UPDATE/DELETE/exists checks).
:prefs Input string (SqlHelper.NewParm) 4000 Trimmed (preferenceText.Trim()) JSON preference payload to store in PREFERENCE_TEXT.
:updated Input DateTime (SqlHelper.NewParm) N/A System.DateTime.Now — audit timestamp stored in UPDATE_DATE.
:updateby Input string (SqlHelper.NewParm) 40 DPI.UserID — the data-portal's authenticated user, stored in UPDATE_USER as the audit updater.

Tables

Table Access Columns used
USER_PREFERENCE INSERT USER_PREFERENCE_SEQ_NUM, USER_ID, APP_NAME, PAGE_NAME, PREFERENCE_TEXT, UPDATE_DATE, UPDATE_USER

Sample SQL

INSERT INTO USER_PREFERENCE (
    USER_PREFERENCE_SEQ_NUM,
    USER_ID,
    APP_NAME,
    PAGE_NAME,
    PREFERENCE_TEXT,
    UPDATE_DATE,
    UPDATE_USER
)
VALUES (
    USER_PREFERENCE_SEQ.nextval,
    :userid,
    :appname,
    :pagename,
    :prefs,
    :updated,
    :updateby
)

Operations and processes

Business rules

Sources

  • SAIF.Framework.Preferences\PreferenceData.cs