Example: GetSessionQuery

This example shows the values that must be fetched from the database. Bind variables marked with question marks are used with GetSessionQueryParam, and GetSessionColumnDef parameters map SQL result columns to session variables. Session variable names are fixed as shown below, and they must correspond to AddSessionQuery example.
GetSessionQuery SELECT id, start_time, imsi, \
      session_id, origin_host, origin_realm, \
      application_id, application_name, \
      service_selection, permanent_user_id \
      FROM sessions WHERE stop_time IS NULL AND session_id=?
GetSessionQueryParam %0
GetSessionColumnDef  0, id
GetSessionColumnDef  1, start_time
GetSessionColumnDef  2, imsi
GetSessionColumnDef  3, session_id
GetSessionColumnDef  4, origin_host
GetSessionColumnDef  5, origin_realm
GetSessionColumnDef  6, application_id
GetSessionColumnDef  7, application_name
GetSessionColumnDef  8, service_selection
GetSessionColumnDef  9, permanent_user_id
The following example shows two additional columns, emergency_services and user_name, required by emergency services and IMSI encryption.
GetSessionQuery SELECT id, start_time, imsi, \
      session_id, origin_host, origin_realm, \
      application_id, application_name, \
      service_selection, permanent_user_id, \
      emergency_services, user_name \
      FROM sessions WHERE stop_time IS NULL AND session_id=?
GetSessionQueryParam %0
GetSessionColumnDef  0, id
GetSessionColumnDef  1, start_time
GetSessionColumnDef  2, imsi
GetSessionColumnDef  3, session_id
GetSessionColumnDef  4, origin_host
GetSessionColumnDef  5, origin_realm
GetSessionColumnDef  6, application_id
GetSessionColumnDef  7, application_name
GetSessionColumnDef  8, service_selection
GetSessionColumnDef  9, permanent_user_id
GetSessionColumnDef 11, emergency_services 
GetSessionColumnDef 11, user_name