Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTSession::GetPathPrefix

Get the client-side path prefix.

Declaration

CTBOOL CTSession::GetPathPrefix(CTString& pathPrefix);

Description

A path prefix can be set anytime after the session handle is allocated. If a path prefix is set before a session logon, the new path prefix will affect the location of the session dictionary file. If a path prefix is set after a session logon, but before a database connect, then the path prefix affects only the database dictionary and any tables that are manipulated during that session.

If a path prefix is set, GetPathPrefix() returns YES and the path is set to pathPrefix. If no path prefix is set, GetPathPrefix() returns NO and pathPrefix is cleared.

A CTException is thrown when an error occurs. Use CTException::GetErrorCode() and CTException::GetErrorMsg() to retrieve the error code and descriptive message.

Return

Value

Symbolic Constant

Explanation

0

NO

CTSession::GetPathPrefix returns NO when no path prefix has been set.

1

YES

CTSession::GetPathPrefix returns YES when a path prefix has been returned.

See "c-treeDB Errors and Return Values" for a complete listing of valid c-treeDB error codes and return values.

Example


/* get the current path prefix */

try {

if (MySession.GetPathPrefix(MyCTStringPath))

printf ("Current path prefix is : %s\n", MyCTStringPath);

else

printf ("No current path prefix is set.\n");

}

catch(CTException &E) {

printf("ERROR: (%d) - %s\n", E.GetErrorCode(), E.GetErrorMsg());

}

See also

CTSession::SetPathPrefix()

TOCIndex