In a URL session state management system, the client application or web browser provides the session ID in a URL.
The following example illustrates unique session ID creation within an HTTP web server SQL function where session IDs can be provided by a URL only:
CREATE FUNCTION set_session_url() RETURNS LONG VARCHAR BEGIN DECLARE session_id LONG VARCHAR; DECLARE tm TIMESTAMP; SET tm = NOW(*); SET session_id = 'session_' || CONVERT( VARCHAR, SECONDS(tm) * 1000 + DATEPART( MILLISECOND, tm ) ); CALL sa_set_http_option( 'SessionID', session_id ); SELECT CONNECTION_PROPERTY( 'SessionID' ) INTO session_id; RETURN( session_id ); END;
The SessionID is represented as an empty string if the session_id is not defined for the connection, making a sessionless connection.
The sa_set_http_option system procedure returns an error if the session_id is owned by another HTTP request.