Get_server_info

c/c++pascalsql

BOOL WINAPI [cd_]Get_server_info(cdp_t cdp, int info_type, void * buffer, unsigned buffer_size);
function [cd_]Get_server_info(cdp : cdp_t; info_type : integer; var buffer; buffer_size : integer) : Boolean;
function Get_server_info(IN info_type INT) returns INT;

Parameters

info_type type of requested information
buffer return variable
buffer_size size of the buffer variable in bytes
cdp client context variable

Since version

7.0, modified in 8.0, 8.1, 9.5, 10, 11

Function value

The function returns FALSE if successful, TRUE otherwise, if called from a client. The function returns the requested data if called from a server.

Description

This function retrieves the information specified by the info_type parameter or its number from the SQL server. If called by a client, the result will be stored in the buffer variable. If the buffer_size is too small for the requested information, an error will occur. You may only retrieve the numeric values if you're calling this function in the SQL language (i.e. you won't get the server name etc.).

info_type number information type
OP_GI_SERVER_PLATFORM 0 SQL server platform (0=Windows, 2=Linux)
OP_GI_LICS_CLIENT 2 number of client licences
OP_GI_INST_KEY 6 server installation key (returns a string, cannot be used in SQL)
OP_GI_SERVER_LIC 7 server licence ID (returns a string, cannot be used in SQL)
OP_GI_TRIAL_ADD_ON 8 temporary added TRIAL licences (0=no; 1=yes)
OP_GI_VERSION_1 10 first part of the server version number
OP_GI_VERSION_2 11 second part of the server version number
OP_GI_VERSION_3 12 third part of the server version number (year)
OP_GI_VERSION_4 13 fourth part of the server version number (month and day)
OP_GI_PID 14 process number of the SQL server in the operating system
OP_GI_SERVER_NAME 15 name of the server (returns a string, cannot be used in SQL)
OP_GI_DISK_SPACE 16 free space on the disk with database file
OP_GI_CLUSTER_SIZE 17 size of a cluster in the database file
OP_GI_LICS_USING 18 number of licences used by connected clients
OP_GI_OWNED_CURSORS 19 number of cursors opened by a client
OP_GI_FIXED_PAGES 20 number of fixed disk pages
OP_GI_FIXES_ON_PAGES 21 fixation number on disk pages
OP_GI_FRAMES 22 number of frames for disk pages
OP_GI_FREE_CLUSTERS 23 number of unused clusters in the database files
OP_GI_USED_MEMORY 24 memory used by the server
OP_GI_TRIAL_REM_DAYS 25 days remaining in the TRIAL licence
OP_GI_INSTALLED_TABLES 30 number of installed tables
OP_GI_LOCKED_TABLES 31 number of locked tables
OP_GI_TABLE_LOCKS 32 number of table locks
OP_GI_TEMP_TABLES 33 number of temporary tables
OP_GI_OPEN_CURSORS 34 number of all opened cursors
OP_GI_PAGE_LOCKS 35 number of locks on integral disk pages
OP_GI_LOGIN_LOCKS 36 number of locks that lock the server (0=not locked, >0 locked)
OP_GI_CLIENT_NUMBER 37 number of client calling this function, see the client_number function
OP_GI_BACKGROUD_OPER 38 a flag denoting whether background processes are enabled; 1=enabled, 0=disabled
OP_GI_SYS_CHARSET 39 system language (charset) of the server; table describing the codes can be found here
OP_GI_MINIMAL_CLIENT_VERSION 40 minimum client version, which is required by a server, po prevent the KSE_CLIENT_SERVER_INCOMP error KSE_CLIENT_SERVER_INCOMP
OP_GI_SERVER_UPTIME 40 the time (in seconds) of SQL server uptime
OP_GI_PROFILING_ALL 41 a flag denoting whether the profiling of all threads is enabled; 1=enabled, 0=disabled
OP_GI_PROFILING_LINES 43 a flag specifying whether the profiling of routine lines are enabled; 1=on, 0=off.
OP_GI_SERVER_HOSTNAME 44 IP hostname of the SQL server
OP_GI_HTTP_RUNNING 45 a flag specifying whether the HTTP tunneling of the network communication is enabled; 1=on, 0=off.
OP_GI_WEB_RUNNING 46 a flag specifying whether the webserver emulation is enabled; 1=on, 0=off.
OP_GI_NET_RUNNING 47 TCP/IP protocol for client-server communication: 1=on, 0=off
OP_GI_IPC_RUNNING 48 IPC protocol (Inter Processor Communication) for client-server communication: 1=on, 0=off; Windows only;
OP_GI_BACKING_UP 49 a flag if backing up is just running: 0=no backup, 1=notblocking (hot) backup, 2=blocking backup
OP_GI_CLIENT_COUNT 50 number of connected clients
OP_GI_RECENT_LOG 51 actual content of a basig log (returns a string, cannot be used in SQL); max. size is set by the sever property TraceLogCacheSize
OP_GI_LICS_XML 52 is XML extension activated? 1=yes, 0=no
OP_GI_DAEMON 53 602SQL server running as a daemon/service (=1) or as a task (=0)
OP_GI_LEAKED_MEMORY 54 memory leaks (in bytes); increases are important, not a current value

Example (SQL procedure):

PROCEDURE `PLATFORM`(  );
BEGIN
  IF Get_server_info(0) = 0 THEN
    CALL Log_write("Windows");
    // call procedure for Windows
  ELSE
    CALL Log_write("Linux");
    // call procedure for Linux
  END IF;
END