< Previous | Next >

Getting a Session object

About this task

The common sequence for using Rational® ClearQuest® API functions begins with these steps:
  1. Start a Rational ClearQuest session.
  2. Log on to a Rational ClearQuest database.
  3. Work with Rational ClearQuest records.
  4. End the Rational ClearQuest session.
For external applications, you must create a Session object and use it to log in to a user database.
Syntax for creating a Session object:
require CQPerlExt; 
$CQsession = CQSession::Build(); 
Next, you can login to a database by calling the UserLogon method of the newly created Session object or first get a list of accessible databases.
When you are done with the session, you delete the Session object with the Unbuild method. Syntax for releasing a Session object:
CQSession::Unbuild($session); 

Hooks are attached to events that occur when a user interacts with Rational ClearQuest. Because hooks execute at predefined times during the middle of a session, your hook code does not end a session. The session ends automatically when the user logs off. However, when you write an external application, you must end the current session by deleting the Session object that you have created. Delete any objects that you explicitly created and do not need any more, including a Session object.

< Previous | Next >