.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1998-2005 SAP AG$$Page %$ 
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$VPI90C$
.tt 2 $$$
.tt 3 $DanielD$Export session$$$1998-09-21$
***********************************************************
.nf

.nf

.nf

    ========== licence begin  GPL
    Copyright (c) 1998-2005 SAP AG

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end
.fo


.fo


.fo
Module  : Export session
=========
.sp
Purpose :

Exports several session specific variables to allow
the trigger compiler to run inside the same
database session.

.CM *-END-* purpose -------------------------------------
Define  :

void sqlTCompGetConnection (
			    void        *rawca,
			    int          sessionNumber,
			    int         *connectionHandleP,
			    void       **packetAddrP,
			    void       **xuserAddrP);

int sqlTCompGetSessionByName(
			     void        *rawca,
			     char        *szDataBaseName);

void pi90_GetConnection (
			 void        *rawca,
			 int          sessionNumber,
			 int         *connectionHandleP,
			 void       **packetAddrP,
			 void       **xuserAddrP);

int pi90_GetSessionByName(
			  void        *rawca,
			  char        *szDataBaseName);

.CM *-END-* define --------------------------------------
Use     :
.CM *-END-* use -----------------------------------------
Synonym :
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : DanielD
.sp
.cp 3
Created : 1986-01-01
.sp
.cp 3
Version : 1992-02-21
.sp
.cp 3
Release :      Date : 1998-09-21
Specification:
.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:
.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.sp
.CM -lll-
Code    :
/*PRETTY*/
void 
sqlTCompGetConnection (
		       void        *rawca,
		       int          sessionNumber,
		       int         *connectionHandleP,
		       void       **packetAddrP,
		       void       **xuserAddrP)
{
    sqlcatype   *ca = (sqlcatype*) rawca;
    sqlgaentry *gaentry;

    gaentry = ca->sqlgap->gaentry [sessionNumber - 1];
    *connectionHandleP = gaentry->gareference;
    *packetAddrP = gaentry->gareqptr;
    *xuserAddrP = &gaentry->gaxuserrec;
}

int 
sqlTCompGetSessionByName(
			 void        *rawca,
			 char        *szDataBaseName)
{
  tsp00_KnlIdentifier dbname;
  int len = strlen(szDataBaseName);
  len = len > sizeof(dbname) ? sizeof(dbname) : len;
  memcpy(dbname, szDataBaseName, len);
  if (len < sizeof(dbname)) {
    memset(dbname+len, ' ', sizeof(dbname)-len);
  }
  return(pr08bGetSessionFromName(rawca, dbname));
}

void
pi90_GetConnection (
   void        *rawca,
   int          sessionNumber,
   int         *connectionHandleP,
   void       **packetAddrP,
   void       **xuserAddrP)
{
  sqlTCompGetConnection (rawca, sessionNumber, connectionHandleP, packetAddrP, xuserAddrP);
}

int 
pi90_GetSessionByName(
   void        *rawca,
   char        *szDataBaseName)
{
  return(sqlTCompGetSessionByName(rawca, szDataBaseName));
}

.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
