.CM  SCRIPT , Version - 1.1 , last edited by barbara
.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1996-2005 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.TT 1 $SQL$Project Distributed Database System$VIN70$
.tt 2 $$$
.TT 3 $BarbaraJ$Schnittstelle I01_G/Precompiler$1996-07-11$
***********************************************************
.nf

.nf

.nf

    ========== licence begin  GPL
    Copyright (c) 1996-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
.nf
.sp
MODULE  : Interface I01_G/Precompiler
=========
.sp
Purpose : Initializing of the global variable I01_G
          in order to use DIALOG/FORM or REPORT out of
          the precompiler
.CM *-END-* purpose -------------------------------------
.sp
Define  :
 
        PROCEDURE
              i70init (
                    VAR term_ref : tsp00_Int4 );
 
        PROCEDURE
              i70off (
                    VAR msg : tin_screenline );
 
        PROCEDURE
              i70cleardbinfo;
 
        PROCEDURE
              i70putdbconnectinfo (
                    desired_component : tsp4_component;
                    p_dbno            : integer;
                    VAR p_packet_list : tsp1_packet_list;
                    VAR p_connect_id  : tsp00_KnlIdentifier;
                    VAR p_password    : tsp00_CryptPw;
                    VAR p_serverdb    : tsp00_DbName;
                    VAR p_nodeid      : tsp00_NodeId;
                    VAR p_sendid      : tsp00_C8;
                    p_reference       : tsp00_Int4;
                    p_lockset         : tsp00_Int2;
                    p_timeout         : tsp00_Int2;
                    p_cachelimit      : tsp00_Int2;
                    p_code_type       : tsp00_CodeType );
 
        PROCEDURE
              i70getdbconnectinfo (
                    p_dbno            : integer;
                    VAR p_packet_list : tsp1_packet_list;
                    VAR p_connect_id  : tsp00_KnlIdentifier;
                    VAR p_password    : tsp00_CryptPw;
                    VAR p_serverdb    : tsp00_DbName;
                    VAR p_nodeid      : tsp00_NodeId;
                    VAR p_sendid      : tsp00_C8;
                    VAR p_reference   : tsp00_Int4;
                    VAR p_lockset     : tsp00_Int2;
                    VAR p_timeout     : tsp00_Int2;
                    VAR p_cachelimit  : tsp00_Int2 );
 
        PROCEDURE
              i70dbcurrent (
                    p_dbno       : integer );
 
        FUNCTION
              in7030 : tsp00_Int4;
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              global_variable : VIN01;
 
        VAR
              i01g   : tin_global_in_vars;
 
      ------------------------------ 
 
        FROM
              global_init: VIN02;
 
        PROCEDURE
              i02init (
                    VAR g_area : tin_global_in_vars );
 
      ------------------------------ 
 
        FROM
              messages : VIN03;
 
        PROCEDURE
              i03mfinit (
                    VAR msgnos : tin_msgnos );
 
        PROCEDURE
              i03mfetch (
                    VAR msgnos : tin_msgnos );
 
      ------------------------------ 
 
        FROM
              connect_release: VIN27;
 
        PROCEDURE
              i27userparms (
                    desired_component : tsp4_component;
                    VAR status        : tin_connect_status);
 
      ------------------------------ 
 
        FROM
              Init-Translation : VIN31;
 
        PROCEDURE
              i31inittranslattables;
 
      ------------------------------ 
 
        FROM
              logical_screen : VIN50;
 
        PROCEDURE
              i50on (
                    VAR ok : boolean);
 
        PROCEDURE
              i50off (
                    VAR msg : tin_screenline);
 
      ------------------------------ 
 
        FROM
              logical_screen_layout : VIN51;
 
        PROCEDURE
              i51layout (
                    functionmenu_length : tin_natural;
                    inputarea_length    : tin_natural;
                    msg_lines           : tin_natural);
 
      ------------------------------ 
 
        FROM
              vp_output : VIN61;
 
        PROCEDURE
              i61close (
                    print       : boolean;
                    VAR errtext : tsp00_ErrText;
                    VAR ok      : boolean);
 
      ------------------------------ 
 
        FROM
              SQLDB-command-interface: VIN21;
 
        PROCEDURE
              i21switchsession (
                    g_area     : tin_global_in_vars;
                    session_no : integer);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : BarbaraJ
.sp
.cp 3
Created : 1985-09-02
.sp
.cp 3
Version : 1996-12-04
.CM %end
.cp 3
Release :  6.1.2     Date : 1995-11-01
.sp
.pb \
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
.sp 2
Before a dialog component is called via the precompiler, the
information on all databases to which the user is connected
must be passed.
.sp;.nf
i70cleardbinfo
-----------------
Input:   none
--------
Output:  none
--------
Function: all database information is deleted in order to then
--------- set the relevant database information
.sp 2;
i70putdbconnectinfo
-------------------
Input:   All information for each database to which the
-------- program is connected.
         desired_component:
           in order to initialize the attributes of the screen
           according to the component specific SET parameter
         p_dbno :
           Serial number of the database to which the
           program is connected (see also component xuser)
         p_connect_id :
           user_id with which the connect referring to this
           database was executed
         p_password :
           password with which the connect was executed
         p_serverdb :
           name of the database
         p_nodeid :
           id of the where database is located. The net of
           nodes might be one distributed database but normally
           it will be a net of stand alone databases connected
           by the application
         p_sendid :
           terminal identification, see runtime environment 3.0
         p_reference :
           reference number for identifying the session in the
           subsequent SQLREQUEST, SQLRECEIVE, SQLCANCEL
           and SQLRELEASE calls
         p_lockset :
           isolation level for connect
         p_timeout :
           timeout for connect
         p_cachelimit:
           cachelimit restriction for connect
         p_code_type :
           a code to identify the special character set of the
           application environment
.sp;
Output:  none
--------
Function: the information is stored in the
--------- global structure of the dialog components for each database.
.sp 2;
Important!!!!
-------------
         i70_db_connect_info must be called 1 time
         for each database connected to the program.
 
         In addition, the dialog component DIALOG expects the database
         that contains the code of the DIALOG application
         to be passed with the dbno=1.
.sp 2
i70getdbconnectinfo
-----------------------
Input:   p_dbno
--------
Output:  all information on the database connection
--------
Function: Some of the DB infos can be changed via an implicit
--------- connect of the dialog component to the databases.
          Generally, this will only be a change of the server_pid.
          In the future, however, a change of the timeout value
          will also be possible.  It could also be possible that the
          userid/password combination for the same database be
          changed via the dialog component; for this reason,
          everything is passed here.
 
          Nevertheless, it should be noted that currently, although
          several databases are possible, there can be only one
          userid/password combination for the dialog components.
          However, this will change.
.fo;
.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
.oc _/1
.CM -lll-
Code    :
 
 
(*------------------------------*) 
 
FUNCTION
      in7030 : tsp00_Int4;
 
BEGIN
(* linkcheck function *)
in7030 := 100020527;
END;
 
(*------------------------------*) 
 
PROCEDURE
      i70init (
            VAR term_ref : tsp00_Int4 );
 
CONST
      nam1_col            = 2;
      functionmenu_length = 0;
      inputarea_length    = 0;
      message_lines       = 1;
 
VAR
      ok       : boolean;
      msg_nos  : tin_msgnos;
 
BEGIN
term_ref := 0;
i02init (i01g);
i01g^.is_batch := false;
i50on (ok);
IF  NOT i01g^.is_batch AND ok
THEN
    BEGIN
    i51layout (functionmenu_length,
          inputarea_length, message_lines);
    i01g^.ls.description [1] [ cin_ls_sysline] .first_col
          := nam1_col;
    term_ref := i01g^.vt.vt_ref;
    END
ELSE
    i01g^.is_batch := true;
(*ENDIF*) 
&ifdef TEST
i01g^.vt.ok := true;
m90xtinit (i01g^.vt.vt_ref, i01g^.vt.desc);
m90switch;
m90maxbuflength;
&endif
i03mfinit (msg_nos);
i03mfetch (msg_nos);
(* ok=FALSE nur im Batchbetrieb *)
END; (* i70init *)
 
(*------------------------------*) 
 
PROCEDURE
      i70off (
            VAR msg : tin_screenline );
 
VAR
      vpok : boolean;
      errtext : tsp00_ErrText;
 
BEGIN
i50off ( msg );
i61close ( true, errtext, vpok );
END; (* i70off *)
 
(*------------------------------*) 
 
PROCEDURE
      i70cleardbinfo;
 
VAR
      i : integer;
 
BEGIN
FOR  i := 1 TO mxin_databases DO
    WITH  i01g^.session[i] DO
        BEGIN
        serverdb  := bsp_dbname;
        service   := sql_user;
        reference := 0;
        END;
    (*ENDWITH*) 
(*ENDFOR*) 
END; (* i70cleardbinfo *)
 
(*------------------------------*) 
 
PROCEDURE
      i70putdbconnectinfo (
            desired_component : tsp4_component;
            p_dbno            : integer;
            VAR p_packet_list : tsp1_packet_list;
            VAR p_connect_id  : tsp00_KnlIdentifier;
            VAR p_password    : tsp00_CryptPw;
            VAR p_serverdb    : tsp00_DbName;
            VAR p_nodeid      : tsp00_NodeId;
            VAR p_sendid      : tsp00_C8;
            p_reference       : tsp00_Int4;
            p_lockset         : tsp00_Int2;
            p_timeout         : tsp00_Int2;
            p_cachelimit      : tsp00_Int2;
            p_code_type       : tsp00_CodeType );
 
VAR
      status                : tin_connect_status;
      first_connect_info    : boolean;
      changed_connect_info  : boolean;
      i                     : integer;
 
BEGIN
i21switchsession (i01g, p_dbno);
WITH i01g^.session[1] DO
    BEGIN
    first_connect_info := ( serverdb = bsp_dbname );
    changed_connect_info :=
          ( nodeid      <> p_nodeid ) OR
          ( connect_id  <> p_connect_id ) OR
          ( serverdb    <> p_serverdb );
    (* =============================================================== *)
    (* Wenn die connect_id gleich geblieben ist, wird angenommen, dass *)
    (* auch das password gleich ist, denn man kann das Passwort        *)
    (* nur dann aendern, wenn der Benutzer nicht eingeloggt ist.       *)
    (* =============================================================== *)
    END;
(*ENDWITH*) 
WITH i01g^.session[p_dbno] DO
    BEGIN
    IF  (p_packet_list [1] <> NIL) AND (p_packet_list [2] <> NIL)
    THEN
        BEGIN
        packet_control [1].snd_packet_ptr := p_packet_list [1];
        packet_control [2].snd_packet_ptr := p_packet_list [2];
        FOR i := 1 TO cin_maxpackets DO
            BEGIN
            WITH packet_control [i], snd_packet_ptr^ DO
                BEGIN
                rcv_packet_ptr := snd_packet_ptr;
                curr_segm_ptr  := @snd_packet_ptr^.sp1_segm;
                curr_part_ptr  := @curr_segm_ptr^.sp1p_part;
                END;
            (*ENDWITH*) 
            END;
        (*ENDFOR*) 
        nodeid           := p_nodeid;
        is_connected     := true;
        user_ident       := p_connect_id;
        group_id         := p_connect_id;
        connect_id       := p_connect_id;
        password         := p_password;
        serverdb         := p_serverdb;
        symbolic_dbname  := p_serverdb;
        isolationlevel   := p_lockset;
        timeout          := p_timeout;
        cachelimit       := p_cachelimit;
        reference        := p_reference;
        END;
    (*ENDIF*) 
    WITH i01g^.i20 DO
        BEGIN
        FOR i := 1 TO mxsp_c5 DO
            appl_version [i] := p_sendid [i];
        (*ENDFOR*) 
        FOR i := 1 TO mxsp_c3 DO
            application [i] := p_sendid [mxsp_c5 + i];
        (*ENDFOR*) 
        code_type := p_code_type;
        END;
    (*ENDWITH*) 
    status := rc_ok;
    IF  first_connect_info
    THEN
        i31inittranslattables
    ELSE
        IF  changed_connect_info
        THEN
            i27userparms ( desired_component, status );
        (*ENDIF*) 
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END; (* i70putdbconnectinfo *)
 
(*------------------------------*) 
 
PROCEDURE
      i70getdbconnectinfo (
            p_dbno            : integer;
            VAR p_packet_list : tsp1_packet_list;
            VAR p_connect_id  : tsp00_KnlIdentifier;
            VAR p_password    : tsp00_CryptPw;
            VAR p_serverdb    : tsp00_DbName;
            VAR p_nodeid      : tsp00_NodeId;
            VAR p_sendid      : tsp00_C8;
            VAR p_reference   : tsp00_Int4;
            VAR p_lockset     : tsp00_Int2;
            VAR p_timeout     : tsp00_Int2;
            VAR p_cachelimit  : tsp00_Int2 );
 
VAR
      i : integer;
 
BEGIN
(* only the current session is relevant *)
WITH i01g^.i20 DO
    BEGIN
    FOR i := 1 TO mxsp_c5 DO
        p_sendid [i] := appl_version [i];
    (*ENDFOR*) 
    FOR i := 1 TO mxsp_c3 DO
        p_sendid [mxsp_c5 + i]  := application [i];
    (*ENDFOR*) 
    END;
(*ENDWITH*) 
WITH i01g^.session[p_dbno] DO
    BEGIN
    p_packet_list [1] := packet_control [1].snd_packet_ptr;
    p_packet_list [2] := packet_control [2].snd_packet_ptr;
    p_nodeid     := nodeid;
    p_connect_id := connect_id;
    p_password   := password;
    p_serverdb   := serverdb;
    p_lockset    := isolationlevel;
    p_timeout    := timeout;
    p_cachelimit := cachelimit;
    p_reference  := reference;
    END;
(*ENDWITH*) 
END; (* i70getdbconnectinfo *)
 
(*------------------------------*) 
 
PROCEDURE
      i70dbcurrent (
            p_dbno       : integer );
 
BEGIN
i21switchsession (i01g, p_dbno);
END; (* i70dbcurrent *)
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
*-PRETTY-*  statements    :         78
*-PRETTY-*  lines of code :        246        PRETTY  3.09 
*-PRETTY-*  lines in file :        588         1992-11-23 
.PA 
