Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbCreateSession

Create a new session table.

Declaration

CTDBRET ctdbCreateSession(CTHANDLE Handle, pTEXT dbengine,

pTEXT userid, pTEXT password)

Description

ctdbCreateSession() creates a new session and session dictionary. The session dictionary file will be created by default in the Server directory (client/server) or in the execution directory (standalone). To change the directory to locate the session dictionary, use ctdbSetSessionPath() before calling ctdbCreateSession(). To create a database, use ctdbCreateDatabase(). To create a table, use ctdbCreateTable().

A session dictionary is required to perform any task with a database, or to logon to a c-tree Server or FairCom DB instance with ctdbLogon(). There must not be more than one session dictionary in a c-tree Server or FairCom DB environment.

  • Handle [in] the session handle.
  • dbengine [in] the string with the c-tree Server name or FairCom DB instance name. If dbengine is NULL, ctdbCreateSession() uses the string "FAIRCOMS" as the default server name or FairCom DB instance.
  • userid [in] the string with the user name. If userid is NULL, ctdbCreateSession() uses the string "ADMIN" as the default user name.
  • password [in] the string with the user password. If password is NULL, ctdbCreateSession() uses the string "ADMIN" as the default user password.

Returns

ctdbCreateSession() returns CTDBRET_OK on success, or c-treeDB API error code on failure. If the error code is 19, the session dictionary already exists.

Example


err = ctdbLogon(handle);

if (err == FNOP_ERR) /* Session dictionary doesn't exist*/

err = ctdbCreateSession(handle, "FAIRCOMS", "ADMIN", "ADMIN");


See also

ctdbAllocSession(), ctdbCreateDatabase(), ctdbCreateTable(), ctdbLogon()

TOCIndex