public class CTSession extends CTBase
CTBase
,
CTDatabase
,
CTTable
Constructor and Description |
---|
CTSession()
Default constructor for CTSession class
|
CTSession(int SessionType)
Constructor for CTSession class
|
Modifier and Type | Method and Description |
---|---|
void |
AddDatabase(java.lang.String Name,
java.lang.String Path)
Adds an existing database to session.
|
void |
Attach(boolean isTransactionActive)
Attachs an already initialized c-tree ISAM or low-level session to a c-treeDB
CTSession object.
|
void |
Attach(CTSession Session)
Attachs an already initialized c-tree ISAM or low-level session to a c-treeDB
CTSession object.
|
void |
ClearPathPrefix()
Clears any previously set path prefix.
|
void |
Create()
Creates a new session with the defaut values
|
void |
Create(java.lang.String dbEngine,
java.lang.String user,
java.lang.String password)
Creates a new session
|
void |
CreateDatabase(java.lang.String Name,
java.lang.String Path)
Creates a new database
|
void |
DeleteDatabase(java.lang.String Name)
Drops a database from the session and delete the data and index files.
|
void |
Detach()
Detaches a c-treeDB CTSession object.
|
void |
DisconnectAll()
Disconnects all databases from the current session
|
void |
DropDatabase(java.lang.String Name)
Drops a database from a session.
|
protected void |
finalize()
Destroys an allocated CTSession class.
|
boolean |
FindDatabase(java.lang.String Name,
java.lang.StringBuffer Path)
Locates a database in a session.
|
boolean |
FirstDatabase(java.lang.StringBuffer Name,
java.lang.StringBuffer Path)
Gets the first database for the session
|
int |
GetAttachMode()
Retrieves the current session
ATTACH_MODE value. |
int |
GetDatabaseCount()
Retrieves the number of databases in session dictionary
|
int |
GetDatabaseUID(java.lang.String Name)
Retrieves a database unique identification by its name
|
boolean |
GetFailOverState()
Check if the failover state have been set.
|
int |
GetLibType()
Retrieves the current session
LIB_TYPE . |
boolean |
GetLogonOnly()
Retrieves the session "logon only" flag.
|
int |
GetMaxConnections()
Retrieves the maximum connection count from the server side
|
int |
GetParam(int ParamType)
Returns the session parameter based on the parameter type.
|
java.lang.String |
GetPassword()
Returns the user password associated with the session.
|
java.lang.String |
GetPath()
Gets the path (drive:\directory) of the session dictionary.
|
java.lang.String |
GetPathPrefix()
Retrieves the current session wide path prefix.
|
java.lang.String |
GetProductName()
Retrieves the product name from the server side
|
java.lang.String |
GetProductVersion()
Retrieves the product version from the server side
|
java.util.Calendar |
GetServerDateTime()
Retrieve the current server date and time
|
java.lang.String |
GetServerName()
Returns the server name associated with the session.
|
int |
GetSessionId()
Gets the task ID associated with this session.
|
int |
GetSessionType()
Retrieves the current
SESSION_TYPE . |
java.lang.String |
GetUserLogonName()
Returns the user name associated with the session.
|
boolean |
IsActive()
Checks if the session is active.
|
boolean |
IsExclusive()
Retrieves the session exclusive flag.
|
boolean |
IsPrimaryServer()
Check if the current server is primary in a pacemaker cluster.
|
boolean |
IsSQLServer()
Checks if a session is connected to a SQL server
|
void |
LoadCallbackLib(java.lang.String Libname,
java.lang.String Inifile,
boolean Registercallbacks)
Loads the CallBack library.
|
void |
Logoff()
Logs off from a c-tree Server, or a c-tree instance, session.
|
void |
Logon(java.lang.String dbEngine,
java.lang.String user,
java.lang.String password)
Logs on to a c-tree Server, or a c-tree instance, session.
|
boolean |
NextDatabase(java.lang.StringBuffer Name,
java.lang.StringBuffer Path)
Gets the Next database for the session
|
void |
ResetFailOverState()
Resets the value of the failover state to 0.
|
int |
SetCallbackOnRebuild(java.lang.Object Class,
java.lang.String FunctionName,
int Step)
Sets the rebuild callback
|
static void |
SetClientLibraryOption(int Option,
java.lang.String Value)
Sets client side library option.
|
static void |
SetCommProtocolOption(int Option,
java.lang.String Value)
Sets communication protocol option.
|
static int |
SetConfigurationFile(java.lang.String ConfigFile)
Sets the database engine configuration file name.
|
void |
SetCurrentNodeName(java.lang.String NodeName)
Sets a client side node name.
|
void |
SetExclusive()
Activates the session exclusive flag.
|
void |
SetExclusive(boolean flag)
Sets or clears the session exclusive flag.
|
static int |
SetLicenseFile(java.lang.String LicenseFile)
Sets the database engine license file name.
|
static int |
SetLocalDirectory(java.lang.String LocalDirectory)
Sets the database engine local (data) directory.
|
void |
SetLogonOnly()
Sets the session logon only flag.
|
void |
SetLogonOnly(boolean flag)
Sets the session logon only flag.
|
void |
SetLogPath(java.lang.String Path)
Set transaction processing control file path for single-user
applications
|
void |
SetParam(int ParamType,
int value)
Sets session parameters values.
|
void |
SetPath(java.lang.String Path)
Sets the session dictionary path
|
void |
SetPathPrefix(java.lang.String path)
The CTDB path prefix feature is similar to c-tree Server's
LOCAL_DIRECTORY configuration keyword.
|
void |
SetSessionId(int sessid)
Sets the task ID associated with this session.
|
void |
SetSessionType(int SessionType)
Changes the current
SESSION_TYPE . |
int |
SetSqlCallback(java.lang.Object Class,
java.lang.String FunctionName)
Sets the sqlimport callback
|
void |
SetStatusLogPath(java.lang.String Path)
Set status log file path for single-user applications
|
void |
SetTempPath(java.lang.String Path)
Set status temporary file path for single-user applications
|
static int |
StartDatabaseEngine()
Initializes c-tree's basic features.
|
static void |
StopDatabaseEngine()
Shutdown the database Engine.
|
void |
UnLoadCallbackLib(boolean Unregonly)
Unloads the CallBack library.
|
Abort, Begin, ClearSavePoint, Commit, GetAutoCommit, GetHandle, GetKeepLock, GetLockMode, GetOperation, GetTransactionMode, IsLockActive, IsTransActive, IsUnicodeLib, Lock, PrepareCommit, RestoreSavePoint, SetAutoCommit, SetHandle, SetKeepLock, SetOperation, SetSavePoint, SetTransactionMode, Unlock
public CTSession() throws CTException
CTException
- in case of errorCTSession(int)
,
finalize()
public CTSession(int SessionType) throws CTException
SessionType
- CTField
to be used for the new objectCTException
- in case of errorCTSession()
,
finalize()
protected void finalize()
finalize
in class java.lang.Object
CTSession(int)
,
CTSession()
public void Logon(java.lang.String dbEngine, java.lang.String user, java.lang.String password) throws CTException
CTDatabase
. After a
session is logged on, its status is active.dbEngine
- Faircom server name or c-tree instance name.user
- User name.password
- User password.CTException
- in case of errorLogoff()
,
IsActive()
public void Logoff() throws CTException
CTException
- in case of errorLogon(java.lang.String, java.lang.String, java.lang.String)
public java.lang.String GetServerName()
GetUserLogonName()
,
GetPassword()
,
GetParam(int)
public java.lang.String GetUserLogonName()
GetServerName()
,
GetPassword()
,
GetParam(int)
public java.lang.String GetPassword()
GetServerName()
,
GetUserLogonName()
,
GetParam(int)
public int GetParam(int ParamType)
ParamType
- SESSION_PARAM
to be checkedSetParam(int, int)
,
GetServerName()
,
GetUserLogonName()
,
GetPassword()
public void SetParam(int ParamType, int value) throws CTException
ParamType
- SESSION_PARAM
to be set *value
- New parameter value.CTException
- in case of errorGetParam(int)
public boolean IsActive()
Logon(java.lang.String, java.lang.String, java.lang.String)
,
Logoff()
public java.lang.String GetPath() throws CTException
CTException
- in case of errorSetPath(java.lang.String)
public void SetPath(java.lang.String Path) throws CTException
Path
- New session dictionary pathCTException
- in case of errorGetPath()
public boolean FirstDatabase(java.lang.StringBuffer Name, java.lang.StringBuffer Path) throws CTException
Name
- Database name (Output)Path
- Database path (Output)CTException
- in case of errorNextDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
FindDatabase(java.lang.String, java.lang.StringBuffer)
,
GetDatabaseCount()
public boolean NextDatabase(java.lang.StringBuffer Name, java.lang.StringBuffer Path) throws CTException
Name
- Database name (Output)Path
- Database path (Output)CTException
- in case of errorFirstDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
FindDatabase(java.lang.String, java.lang.StringBuffer)
,
GetDatabaseCount()
public boolean FindDatabase(java.lang.String Name, java.lang.StringBuffer Path) throws CTException
Name
- Database name to look for.Path
- If the database name is located, receives the path (Output).CTException
- in case of errorFirstDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
NextDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
GetDatabaseCount()
public void Create() throws CTException
CTException
- in case of errorCreate(java.lang.String, java.lang.String, java.lang.String)
,
CreateDatabase(java.lang.String, java.lang.String)
public void Create(java.lang.String dbEngine, java.lang.String user, java.lang.String password) throws CTException
dbEngine
- C-Tree instance or server name.user
- User namepassword
- user password.CTException
- in case of errorCreate()
,
CreateDatabase(java.lang.String, java.lang.String)
public void DisconnectAll() throws CTException
CTException
- in case of errorFirstDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
NextDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
GetDatabaseCount()
public void CreateDatabase(java.lang.String Name, java.lang.String Path) throws CTException
Name
- New database namePath
- New database pathCTException
- in case of errorAddDatabase(java.lang.String, java.lang.String)
,
DeleteDatabase(java.lang.String)
,
DropDatabase(java.lang.String)
,
GetDatabaseUID(java.lang.String)
public void AddDatabase(java.lang.String Name, java.lang.String Path) throws CTException
Name
- Existing database namePath
- Existing database pathCTException
- in case of errorCreateDatabase(java.lang.String, java.lang.String)
,
DeleteDatabase(java.lang.String)
,
DropDatabase(java.lang.String)
,
GetDatabaseUID(java.lang.String)
public void DeleteDatabase(java.lang.String Name) throws CTException
Name
- Database name to be deletedCTException
- in case of errorCreateDatabase(java.lang.String, java.lang.String)
,
AddDatabase(java.lang.String, java.lang.String)
,
DropDatabase(java.lang.String)
,
GetDatabaseUID(java.lang.String)
public void DropDatabase(java.lang.String Name) throws CTException
Name
- Database name to be dropedCTException
- in case of errorCreateDatabase(java.lang.String, java.lang.String)
,
AddDatabase(java.lang.String, java.lang.String)
,
DeleteDatabase(java.lang.String)
,
GetDatabaseUID(java.lang.String)
public int GetDatabaseUID(java.lang.String Name) throws CTException
Name
- Database name to be retrievedCTException
- in case of errorCreateDatabase(java.lang.String, java.lang.String)
,
AddDatabase(java.lang.String, java.lang.String)
,
DeleteDatabase(java.lang.String)
,
DropDatabase(java.lang.String)
public void SetExclusive(boolean flag) throws CTException
flag
- true will set the exclusive flag, while false will clear the
exclusive flag.CTException
- in case of errorSetExclusive()
,
IsExclusive()
,
SetLogonOnly()
public void SetExclusive() throws CTException
CTException
- in case of errorSetExclusive(boolean)
,
IsExclusive()
,
SetLogonOnly()
public boolean IsExclusive()
SetExclusive(boolean)
,
SetExclusive()
,
SetLogonOnly()
public boolean IsSQLServer()
SetSessionType(int)
,
GetSessionType()
public void SetLogonOnly() throws CTException
CTException
- in case of errorSetLogonOnly(boolean)
,
GetLogonOnly()
public void SetLogonOnly(boolean flag) throws CTException
flag
- true will activate the logon only flag while false will clear itCTException
- in case of errorSetLogonOnly()
,
GetLogonOnly()
public boolean GetLogonOnly()
SetLogonOnly()
,
SetLogonOnly(boolean)
public int GetAttachMode()
ATTACH_MODE
value.ATTACH_MODE
value.Attach(FairCom.CtreeDb.CTSession)
,
Attach(boolean)
,
Detach()
public int GetDatabaseCount()
FirstDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
NextDatabase(java.lang.StringBuffer, java.lang.StringBuffer)
,
FindDatabase(java.lang.String, java.lang.StringBuffer)
public void SetSessionType(int SessionType) throws CTException
SESSION_TYPE
. The session
type is initialy set when ctdb.AllocSession() function is called to alocate
a new session handle. SetSessionType allow users to change the session type
after it has been allocated.SessionType
- New SESSION_TYPE
to set
to the current sessionCTException
- in case of errorGetSessionType()
,
IsSQLServer()
public void SetSessionId(int sessid)
sessid
- New session ID to be assigned to the current sessionGetSessionId()
public int GetSessionId()
SetSessionId(int)
public int GetSessionType()
SESSION_TYPE
.SESSION_TYPE
value.SetSessionType(int)
,
IsSQLServer()
public int GetLibType()
LIB_TYPE
.LIB_TYPE
valueGetSessionType()
public static int SetConfigurationFile(java.lang.String ConfigFile)
ConfigFile
- Database engine configuration file name.CTDBRET
error codeSetCurrentNodeName(java.lang.String)
,
SetPathPrefix(java.lang.String)
,
SetLicenseFile(java.lang.String)
public static int SetLicenseFile(java.lang.String LicenseFile)
LicenseFile
- Database engine license file name.CTDBRET
error codeSetCurrentNodeName(java.lang.String)
,
SetPathPrefix(java.lang.String)
,
SetConfigurationFile(java.lang.String)
,
SetLocalDirectory(java.lang.String)
public static int SetLocalDirectory(java.lang.String LocalDirectory)
LocalDirectory
- The absolute path of the directory to be used
as local directoryCTDBRET
error codeSetCurrentNodeName(java.lang.String)
,
SetPathPrefix(java.lang.String)
,
SetConfigurationFile(java.lang.String)
,
SetLicenseFile(java.lang.String)
public void SetCurrentNodeName(java.lang.String NodeName) throws CTException
NodeName
- Client side node nameCTException
- in case of errorSetConfigurationFile(java.lang.String)
,
SetPathPrefix(java.lang.String)
public void SetPathPrefix(java.lang.String path) throws CTException
path
- Path prefix or empty string if you wish to remove the current
path prefix.CTException
- in case of errorGetPathPrefix()
,
ClearPathPrefix()
public void ClearPathPrefix() throws CTException
CTException
- in case of errorGetPathPrefix()
,
SetPathPrefix(java.lang.String)
public java.lang.String GetPathPrefix()
ClearPathPrefix()
,
SetPathPrefix(java.lang.String)
public void Attach(boolean isTransactionActive) throws CTException
isTransactionActive
- Indicate if a transaction is active or not.CTException
- in case of errorAttach(FairCom.CtreeDb.CTSession)
,
Detach()
,
GetAttachMode()
public void Attach(CTSession Session) throws CTException
Session
- Session object to attach to.CTException
- in case of errorAttach(boolean)
,
Detach()
,
GetAttachMode()
public void Detach() throws CTException
CTException
- in case of errorAttach(boolean)
,
Attach(FairCom.CtreeDb.CTSession)
,
GetAttachMode()
public static int StartDatabaseEngine() throws CTException
StopDatabaseEngine()
will shutdown the database engine. Please note that this is a static method
and it can be invoked without the presence of a CTSession object.CTDBRET
error codeCTException
- in case of errorStopDatabaseEngine()
public static void StopDatabaseEngine()
StartDatabaseEngine()
must be called
before any other c-treeDB or c-tree calls are performed. Please note that
this is a static method and it can be invoked without the presence of a
CTSession object.StartDatabaseEngine()
public java.lang.String GetProductName() throws CTException
CTException
- in case of errorGetProductVersion()
,
GetMaxConnections()
public java.lang.String GetProductVersion() throws CTException
CTException
- in case of errorGetProductName()
,
GetMaxConnections()
public int GetMaxConnections() throws CTException
CTException
- in case of errorGetProductName()
,
GetProductVersion()
public void LoadCallbackLib(java.lang.String Libname, java.lang.String Inifile, boolean Registercallbacks) throws CTException
Libname
- Name of the callback library to be loaded.Inifile
- Name of a INI file (or in general a string) to be passed to
the callback register function (ctsqlSetCallback) in the DLLRegistercallbacks
- Set to true in order to have the ctdbLoadCallbackLib
function automatically call ctsqlSetCallback in the DLL (if present).CTException
- in case of errorUnLoadCallbackLib(boolean)
,
SetCallbackOnRebuild(java.lang.Object, java.lang.String, int)
,
SetSqlCallback(java.lang.Object, java.lang.String)
public void UnLoadCallbackLib(boolean Unregonly) throws CTException
Unregonly
- true if callback should be cleaned but the library not
unloaded, otherwise false if it should be cleaned and the library unloadedCTException
- in case of errorLoadCallbackLib(java.lang.String, java.lang.String, boolean)
,
SetCallbackOnRebuild(java.lang.Object, java.lang.String, int)
,
SetSqlCallback(java.lang.Object, java.lang.String)
public int SetCallbackOnRebuild(java.lang.Object Class, java.lang.String FunctionName, int Step)
Class
- Class containing the callback functionFunctionName
- Function name that will be called. The function signature
MUST be (otherwise the function will not be called) :
public static void function_name(int counter, char event, String message)
If FunctioName is NULL the calback will be removed, a call with NULL is suggested after the rebuild.
Step
- The callback function is called each time the internal counter
reaches a value that is a multiple of Step. If Step is set to 1, the callback
function is called once per record/key.LoadCallbackLib(java.lang.String, java.lang.String, boolean)
,
UnLoadCallbackLib(boolean)
,
SetSqlCallback(java.lang.Object, java.lang.String)
public int SetSqlCallback(java.lang.Object Class, java.lang.String FunctionName)
Class
- Class containing the functionFunctionName
- Function name that will be called. The function signature
MUST be (otherwise the function will not be called) :
public static bool function_name(SQLCB_MODE mode, String msg, boolean def, pVOID extra)
If FunctioName is NULL the calback will be removed, a call with NULL is suggested after the import.
LoadCallbackLib(java.lang.String, java.lang.String, boolean)
,
UnLoadCallbackLib(boolean)
,
SetCallbackOnRebuild(java.lang.Object, java.lang.String, int)
public java.util.Calendar GetServerDateTime() throws CTException
CTException
- in case of errorpublic void SetLogPath(java.lang.String Path) throws CTException
Path
- transaction processing control file pathCTException
- in case of errorpublic void SetStatusLogPath(java.lang.String Path) throws CTException
Path
- status log file pathCTException
- in case of errorpublic void SetTempPath(java.lang.String Path) throws CTException
Path
- temp file pathCTException
- in case of errorpublic static void SetCommProtocolOption(int Option, java.lang.String Value) throws CTException
Option
- Option to set use the static members
of COMM_PROTOCOL_OPTIONS
to pass the proper optionValue
- The value for the option to be set passed as stringCTException
- in case of errorpublic static void SetClientLibraryOption(int Option, java.lang.String Value) throws CTException
Option
- Option to set use the static member of
FairCom.CtreeDB.Types.CLIENT_OPTIONS to pass the proper optionValue
- Option value, refer to the Javadoc of the static members
of FairCom.CtreeDB.Types.CLIENT_OPTIONS to know the exact formatCTException
- in case of errorpublic boolean GetFailOverState()
public void ResetFailOverState()
public boolean IsPrimaryServer() throws CTException
CTException
- in case of error