Skip to main content

%SYS.DBSRV

Class %SYS.DBSRV Extends %RegisteredObject

IRIS xDBC Server This code used to be in %SYS.DBSRV.mac prior to DPV6458

Properties

Auditing

Property Auditing As %Integer [ InitialExpression = 0 ];

Flag which determings if we are performing xDBC query auditing or not

AuditingDML

Property AuditingDML As %Integer [ InitialExpression = 0 ];

Flag which determings if we are performing xDBC DML auditing or not, relevant to fast insert auditing specifically

ClientMaxIdleTime

Property ClientMaxIdleTime As %Integer;

Maximum number of seconds this server should be allowed to remain idle for (no message from client)

ConnectionLimit

Property ConnectionLimit As %String;

Maximum number of xDBC connection we can allow for this server

Device

Property Device As %String;

TCP/Shared Memory device for the connection

DeviceStack

Property DeviceStack As %String [ InitialExpression = 0, MultiDimensional ];

Memory to hold the Devices pushed/popped on the stack for gateway re-entrancy

Dispatch

Property Dispatch As %Integer [ MultiDimensional ];

Array which holds the server functions permitted by this connection

EventClass

Property EventClass As %String;

Name of the class that has transaction callmack methods %OnTranCommit and %OnTranRollback

FunctionTimeout

Property FunctionTimeout As %Integer [ InitialExpression = 0 ];

Timeout from the client to be used to place a time limit (in seconds) on a function's execution

GatewayReentry

Property GatewayReentry As %Integer [ InitialExpression = 0 ];

Flag used to tell the server this was called from gatewat Re-Entrancy

HeaderReadInSQL

Property HeaderReadInSQL As %Integer;

This flag is true if the header was read within the generated SQL code

InBufSize

Property InBufSize As %Integer;

TCP input buffer size

LCBmode

Property LCBmode As %Integer [ InitialExpression = 0 ];

Flag used to tell the server it has been called from Light C Binding

Logging

Property Logging As %Integer [ InitialExpression = 0 ];

Flag for if we are performing server logging or not

ObjectCache

Property ObjectCache As %String [ MultiDimensional ];

ObjectCaache holds the orefs for cached cached query objects

ObjectCacheHead

Property ObjectCacheHead As %String;

ObjectCacheSize

Property ObjectCacheSize As %Integer [ InitialExpression = 0 ];

ObjectCacheTail

Property ObjectCacheTail As %String;

ObjectCacheMaxSize

Property ObjectCacheMaxSize As %Integer [ InitialExpression = 0 ];

OutBufSize

Property OutBufSize As %Integer;

TCP Output buffer size

RedirectionStack

Property RedirectionStack As %String [ InitialExpression = 0, MultiDimensional ];

Array used to keep track of Start/Stop output redirection for each device

RHash

Property RHash As %String;

Hash of the login roles for this user

RolesAdded

Property RolesAdded As %String;

Roles that might have been added by CheckBindingsAccess

ServerOptions

Property ServerOptions As %Integer [ MultiDimensional ];

Options supported for this connection after handshake with client

ServiceType

Property ServiceType As %String [ MultiDimensional ];

Used to determine which types of functions are privileged for this user Multidimentional because I need to set $e on the value.

SQLCompileContext

Property SQLCompileContext As %SYSTEM.Context.SQLCompile;

Holds the $SYSTEM.Context.SQLCompile settings at the time of connection

UHash

Property UHash As %String;

Hash for the username

WaterMark1

Property WaterMark1 As %Integer;

Watermark level to flush fetch results for first buffer

WaterMark2

Property WaterMark2 As %Integer;

Watermark level to flush fetch results for second through Nth buffer

Methods

BuildDispatch

Method BuildDispatch()

Build the local array for looking up client functions to the dispatch number The functions allows for this server process are based on the resources the process has We also define ..ServiceType here. This is a string with: position 1 ON: User has %Service_SQL position 2 ON: User has %Service_Object position 3 ON: User has %Service_DirectLoad (XEP)

SuperConnect

ClassMethod SuperConnect(protocol, msgid, acn, io, %qport)

SetupDevice

Method SetupDevice(io)

Setup TCP/IP device specific options, the device must be the current device

SetupShmDevice

ClassMethod SetupShmDevice(ByRef shmIO, shmConnect, returnStatus = 0, ByRef statusCode, currentDevice = "", setQdev = 0)

Setup SharedMemory device specific options, the device must be the current device

InitSHM

ClassMethod InitSHM(ByRef shmIO, dollarJ, shmSize, shmName, shmWaitFlag, openTimeout, returnStatus = 0, ByRef statusCode, currentDevice = "", setQdev = 0)

Generic Init SharedMemory device

SuperError

ClassMethod SuperError(msgid, acn, rc)

; send Super Server error message (called from %SYS.SERVER)

LCBSuperConnect1

ClassMethod LCBSuperConnect1(protocol, msgid, acn, io)

Support connecting via ccallin-based SPC device, for Light C++ Binding. Called from LCB to process first message from SendLogonMessage()

LCBSuperConnect2

ClassMethod LCBSuperConnect2(io)

Support connecting via ccallin-based SPC device, for Light C++ Binding. Called from LCB to process second message from SendLogonMessage()

Logon

ClassMethod Logon(ns, brokerToken = "") [ Private ]

GetServerProcessCount

ClassMethod GetServerProcessCount()

Count the current number of xDBC server processes

AuthenticationError

ClassMethod AuthenticationError(text, status, ns = "")

GWExecuteSingle

ClassMethod GWExecuteSingle(%qmsgid, %qacn, %qfun) [ PublicList = (i, nparm, oref, x) ]

GWDisconnect

ClassMethod GWDisconnect(device)

This entry point is called from the gateway re-entrance code to cleanup RETURNs nothing

Server

ClassMethod Server(jumpToMain As %Integer = 0)

startSYSIOLoop

ClassMethod startSYSIOLoop()

XDCall

ClassMethod XDCall()

Prepare

ClassMethod Prepare()

Called by PP, DQ (Direct Query), DU (Direct Update), DX (Direct Static Cursor)

SPPrepare

ClassMethod SPPrepare(ByRef returnmeta)

Called from srvDS (Direct Stored procedure) and srvSP (Prepare Stored Procedure) if returnmeta=1, do not write the metadata to the zobjexport buffer here. This means it is a "DS" call and we need to wait and wrie the metadata after SP execution. This is needed in case the SP execution performs re-entrancy, the metadata written to the buffer will be lost

SPFunction

ClassMethod SPFunction(procmeta)

if procmeta is defined, this was a DS call and we need to write the metadata on the wire after the proc execution

SPQuery

ClassMethod SPQuery(ByRef procmeta, catalogQuery = 0) [ PublicList = rc ]

Called from srvDS (Direct Stored procedure), srvSQ (Stored Procedure Query Execute), srvUNK for catalog queries if procmeta is defined, this was a DS call and we need to write the metadata on the wire after the proc execution

SPFetch

ClassMethod SPFetch(directcall, %qHandle)

Called from srvSF (Stored Procedure Fetch Data) and SPQuery directcall=1 means this is an srvSF call

SPClose

ClassMethod SPClose(%qHandle)

Called from SPFetch

SPExecute

ClassMethod SPExecute()

Called from srvMS (Multiple Result Set)

SPMoreResults

ClassMethod SPMoreResults(directcall)

Called from SPExecute, srvMR (Get More Results), and DirectDialect directcall = 1 when called from srvMR, otherwise 0.

SPMoreData

ClassMethod SPMoreData()

Called from srvMD (Multiple Result Sets Fetch Data)

AuditSP

ClassMethod AuditSP(parameters)

StaticCursorExecute

ClassMethod StaticCursorExecute()

ExecuteBatch

ClassMethod ExecuteBatch()

ExecuteBatchError

ClassMethod ExecuteBatchError(i, cnt)

ReadQueryParameters

ClassMethod ReadQueryParameters()

SPReadParameters

ClassMethod SPReadParameters(parameters)

SPReadParametersDP

ClassMethod SPReadParametersDP(parameters)

SPWriteParameters

ClassMethod SPWriteParameters(parameters)

SPWriteParametersDP

ClassMethod SPWriteParametersDP(parameters)

SetCompileMode

ClassMethod SetCompileMode()

CacheResultSetFetch

ClassMethod CacheResultSetFetch()

called from srvFR

GatewayIn

ClassMethod GatewayIn()

Transact

ClassMethod Transact(ttype)

ResetConnection

ClassMethod ResetConnection()

resets/cleans up the connection so that it can be reused in a pooled env

FlushError

ClassMethod FlushError(tag, ns = "")

ProcessExternalInterrupt

ClassMethod ProcessExternalInterrupt(pCloseCurrentStatement = 1)

The process received an error, deal with it...

RecordError

ClassMethod RecordError(tag)

Record the error on the server. Like FlushError, but send nothing to the client

IsolationLevel

ClassMethod IsolationLevel()

Get/set server process's isolation level Called from srvIL We support READ_COMMITED (0), READ_COMMITTED (1), and READ_VERIFIED (3) The client mapping for these values is: 0 on server, 1 on client // uncommitted 1 on server, 2 on client // committed 3 on server, 32 on client // verified if level=0, the client is simply asking what the current isolation level is.

CloseUp

ClassMethod CloseUp(atend = 0, nocache = 0)

CloseAllStatements

ClassMethod CloseAllStatements()

CreateOref

ClassMethod CreateOref(discard = 0)

Structure of linked list FIFO $$$srv.ObjectCache: $$$srv.ObjectCache(%qacn)=oref $$$srv.ObjectCache(%qacn,0)=forward pointer towards the head of the queue $$$srv.ObjectCache(%qacn,1)=back pointer towards the tail of the queue $$$srv.ObjectCacheHead=head of the queue (%qacn value) $$$srv.ObjectCacheTail=tail of the queue (%qacn value) $$$srv.ObjectCacheSize=size of the queue See if we have this oref in the cache, if so return it and if not then %new the class we want and return this

CloseStatement

ClassMethod CloseStatement(%qacn)

called from srvCU, Prepare, SPPrepare

Catalog

ClassMethod Catalog(query)

process Catalog Queries

JPAQuery

ClassMethod JPAQuery()

JPAQuery() implements the QQ message processor

ISCProcAll

ClassMethod ISCProcAll(SCHEMA, PROC)

ISCProcAll takes a procedure and schema and checks to see if this is a class from CACHELIB with no owner. if it is, privileges do not need to be checked on this procedure and everyone can run it. This preserves behavior we had prior to DPV4707 where privileges were not checked on hidden procedures Returns: 1 - if this procedure is from CACHELIB and there is no owner - no privilege checking needed 0 - otherwise

DirectDialect

ClassMethod DirectDialect()

DirectParameter

ClassMethod DirectParameter()

DIRECT_EXECUTE_DIALECT_PARAM (DP) Field Name Description ----------------------- ------------------------------------------------------ SQL Dialect SQL Dialect (DEFAULT = 0, MSSQL = 1, SYBASE = 2) SQL Text SQL statement isStatic isStatic - unused Statement Timeout Statement Timeout (protocol>=42) Parameter Sets Number of Parameter Sets (Ignored) Parameter Count Number of Parameters ...Type Parameter Type ...Precision Parameter Precision ...Scale Parameter Scale ...Nullable Parameter Nullable ...Name Parameter Name ...Mode Parameter Mode Parameter List $LB(par1,...,parCount)

CacheInfo

ClassMethod CacheInfo(io, uplen)

Called from %SYS.SERVER to get available namespaces.

GetVersion

ClassMethod GetVersion()

Called from SQLVer^SystemCheck

setupLogging

ClassMethod setupLogging(ns)

log

ClassMethod log(text = "", sameid = 0, ByRef sql, ByRef vartypes, ns = "")

log something log file format is: 1 2 3 4 5 6 7 8 9 10 ^%sqlcq(namespace,"log",pid,id) = $lb(timestamp,text, message id, cursor number, function, isolation level, transaction level, error code, message,rowcount,%lasterr) ^%sqlcq(namespace,"log",pid,id,"sql") = array of sql text ^%sqlcq(namespace,"log",pid,id,"vartype") = array of metadata for %sqlHVarTypes ^%sqlcq(namespace,"log",pid,id,"info") = # of info lines ^%sqlcq(namespace,"log",pid,id,"info",1..n) = Additional information for this entry

logappend

ClassMethod logappend(info = "", ns = "")

Add info to the current log entry

dumplog

ClassMethod dumplog(pid = "")

dumponelog

ClassMethod dumponelog(pid)

timings

ClassMethod timings(outlierPerc = 500, pqpulimit = 1)

delta

Method delta(t1, t2)

median

Method median(ByRefstatements, sid, fun)

purgelog

ClassMethod purgelog(pid = "*")

sqlcode

ClassMethod sqlcode(code)