.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 2000-2005 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.TT 1 $SQL$Project Distributed Database System$VAK02$
.tt 2 $$$
.TT 3 $ElkeZ$AK_syntax_tools$2000-11-20$
***********************************************************
.nf
 
 .nf

    ========== licence begin  GPL
    Copyright (c) 2000-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
.nf
.sp
MODULE  : AK_syntax_tools
=========
.sp
Purpose :
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              a02_aauthid (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02comment_spec (VAR acv : tak_all_command_glob;
                    put_node        : tsp00_Int2;
                    VAR last_node   : tsp00_Int2);
 
        PROCEDURE
              a02_atablename (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_s_atable_spec (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02atableid (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_acolumnspec (VAR acv : tak_all_command_glob;
                    table_required : boolean;
                    VAR put_node   : tsp00_Int2;
                    VAR last_node  : tsp00_Int2);
 
        PROCEDURE
              a02_ls_acolumnspec_list (VAR acv : tak_all_command_glob;
                    table_required : boolean;
                    VAR put_node   : tsp00_Int2;
                    VAR last_node  : tsp00_Int2);
 
        PROCEDURE
              a02_n_acolumnname  (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_l_acolumn_list (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_l_atablename_list (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_l_aparameter_list (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_s_aparameterspec (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_aparameter_name (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_asynonymname (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_aindexname (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_aresulttablename (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_adomain_name (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_ahostfile_name  (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_asystem_devspace  (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02_put_identifier (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a02procedure (VAR acv : tak_all_command_glob;
                    VAR put_node   : tsp00_Int2;
                    VAR last_node  : tsp00_Int2);
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              AK_syntax_values_tools : VAK03;
 
        PROCEDURE
              a03_astring_literal (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
        PROCEDURE
              a03_aunsigned_integer (VAR acv : tak_all_command_glob;
                    VAR put_node  : tsp00_Int2;
                    VAR last_node : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              Scanner : VAK01;
 
        VAR
              a01kw : tak_keywordtab;
 
        PROCEDURE
              a01_next_symbol (VAR acv : tak_all_command_glob);
 
        PROCEDURE
              a01_get_keyword (VAR acv : tak_all_command_glob;
                    VAR index : integer;
                    VAR reserved : boolean);
 
        PROCEDURE
              a01_put_node (VAR acv : tak_all_command_glob;
                    VAR curr_n : tsp00_Int2);
 
        PROCEDURE
              a01_call_put (VAR acv : tak_all_command_glob;
                    proc     : tak_procs;
                    subproc  : tsp00_Int2;
                    VAR curr_n : tsp00_Int2);
 
        FUNCTION
              a01_eqkey (VAR a : tak_keyword;
                    sqlmode    : tsp00_SqlMode;
                    VAR b      : tsp00_MoveObj;
                    VAR scv    : tak_scanner_glob) : boolean;
 
        FUNCTION
              a01mandatory_keyword (VAR acv : tak_all_command_glob;
                    required_keyword : integer) : boolean;
 
        PROCEDURE
              a01_force_symbol (VAR acv : tak_all_command_glob;
                    expected_symbol : tak_sc_symbol;
                    VAR node1       : tsp00_Int2;
                    VAR node2       : tsp00_Int2);
 
      ------------------------------ 
 
        FROM
              AK_semantic_scanner_tools : VAK05;
 
        PROCEDURE
              a05identifier_get (VAR acv : tak_all_command_glob;
                    tree_index  : integer;
                    obj_len     : integer;
                    VAR moveobj : tsp00_KnlIdentifier);
 
      ------------------------------ 
 
        FROM
              AK_error_handling : VAK07;
 
        PROCEDURE
              a07_error (VAR acv : tak_all_command_glob;
                    err  : tgg00_BasisError;
                    VAR nod1 : tsp00_Int2;
                    VAR nod2 : tsp00_Int2);
 
        PROCEDURE
              a07_b_put_error (VAR acv : tak_all_command_glob;
                    b_err    : tgg00_BasisError;
                    err_code : tsp00_Int4);
 
        PROCEDURE
              a07_kw_put_error (VAR acv : tak_all_command_glob;
                    b_err    : tgg00_BasisError;
                    err_code : tsp00_Int4;
                    kw       : integer);
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
        PROCEDURE
              a05identifier_get;
 
              tsp00_MoveObj tsp00_KnlIdentifier
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : ElkeZ
.sp
.cp 3
Created : 1985-01-21
.sp
.cp 3
.sp
.cp 3
Release :      Date : 2000-11-20
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
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
.oc _/1
.CM -lll-
Code    :
 
 
(*------------------------------*) 
 
PROCEDURE
      a02_aauthid (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      ikw    : integer;
      res_kw : boolean;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        IF  sc_symb <> s_identifier
        THEN
            a07_error (acv, e_invalid_username, put_node, last_node)
        ELSE
            BEGIN
            a01_get_keyword (acv, ikw, res_kw);
            sc_symb := s_authid;
            a01_put_node (acv, put_node);
            last_node := put_node;
            a01_next_symbol (acv);
            (* PTS 1111797 E.Z. *)
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_atablename (VAR acv   : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      res_kw  : boolean;
      curr_tn : tsp00_Int2;
      curr_an : tsp00_Int2;
      ikw     : integer;
      aux_scv : tak_scanner_glob;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        IF  sc_symb <> s_identifier
        THEN
            a07_error (acv, e_invalid_tablename, put_node, last_node)
        ELSE
            BEGIN
            a01_get_keyword (acv, ikw, res_kw);
            sc_symb := s_tablename;
            a01_put_node (acv, curr_an);
            aux_scv := a_scv;
            a01_next_symbol (acv);
            (* PTS 1111797 E.Z. *)
            IF  sc_symb = s_point
            THEN
                BEGIN
                a01_next_symbol (acv);
                aux_scv := a_scv;
                IF  (sc_symb <> s_identifier)           OR
                    (acv.a_is_ddl = ddl_rename_synonym) OR
                    (acv.a_is_ddl = ddl_rename_table)   OR
                    (acv.a_is_ddl = ddl_rename_view)
                THEN
                    a07_error (acv, e_invalid_tablename,
                          put_node, last_node)
                ELSE
                    BEGIN
                    IF  scs_reserved_check in sc_states
                    THEN
                        a01_get_keyword (acv, ikw, res_kw);
                    (*ENDIF*) 
                    sc_symb := s_tablename;
                    a01_put_node (acv, curr_tn);
                    WITH  a_ap_tree^[ curr_an ]  DO
                        BEGIN
                        n_symb     := s_authid;
                        n_sa_level := curr_tn;
                        END;
                    (*ENDWITH*) 
                    put_node  := curr_an;
                    last_node := curr_tn;
                    a01_next_symbol (acv)
                    END
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                put_node  := curr_an;
                last_node := curr_an;
                END;
            (*ENDIF*) 
            IF  ( scs_reserved_check in sc_states ) AND res_kw
            THEN
                BEGIN
                a_scv         := aux_scv;
                a07_kw_put_error (acv, e_reserved_identifier,
                      sc_sypos, ikw);
                put_node  := 0;
                last_node := 0
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02comment_spec (VAR acv : tak_all_command_glob;
            put_node        : tsp00_Int2;
            VAR last_node   : tsp00_Int2);
 
CONST
      c_table_required = true;
 
VAR
      column_list : boolean;
      res_kw      : boolean;
      ikw         : integer;
      comment_n   : tsp00_Int2;
      curr_n      : tsp00_Int2;
      aux_scv     : tak_scanner_glob;
 
BEGIN
column_list := false;
a01_get_keyword (acv, ikw, res_kw);
a01_call_put (acv, a20, ikw, curr_n);
acv.a_ap_tree^[put_node].n_length   := 0;
acv.a_ap_tree^[put_node].n_lo_level := curr_n;
IF  (acv.a_scv.sc_symb = s_parameter_name)             AND
    (acv.a_ex_kind in [only_syntax, only_parsing])     AND
    (acv.a_sqlmode     = sqlm_internal)
THEN
    a02_s_aparameterspec (acv,
          acv.a_ap_tree^[curr_n].n_lo_level, last_node)
ELSE
    BEGIN
    aux_scv := acv.a_scv; (* PTS 1112832 *)
    IF  ikw <> cak_i_no_keyword
    THEN
        a01_next_symbol (acv);
    (*ENDIF*) 
    IF  (acv.a_sqlmode <> sqlm_internal) AND
        (ikw <> cak_i_no_keyword)      AND
        (ikw <> cak_i_column)          AND
        (ikw <> cak_i_table)
    THEN
        a07_error (acv, e_missing_keyword,
              put_node, last_node)
    ELSE
        CASE ikw OF
            cak_i_function :
                a02_put_identifier (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_column, cak_i_trigger :
                a02_acolumnspec (acv, c_table_required,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_dbproc, cak_i_dbprocedure :
                a02procedure (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_domain :
                a02_adomain_name (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_foreign :
                IF  a01mandatory_keyword (acv, cak_i_key)
                THEN
                    a02_acolumnspec (acv, c_table_required,
                          acv.a_ap_tree^[curr_n].n_lo_level, last_node);
                (*ENDIF*) 
            cak_i_index :
                BEGIN
                a02_aindexname (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
                IF  a01mandatory_keyword (acv, cak_i_on)
                THEN
                    a02_atablename (acv,
                          acv.a_ap_tree^[last_node].n_lo_level,
                          last_node)
                (*ENDIF*) 
                END;
            cak_i_public :
                BEGIN
                a01_get_keyword (acv, ikw, res_kw);
                CASE ikw OF
                    cak_i_synonym :
                        BEGIN
                        a01_next_symbol (acv);
                        a02_asynonymname (acv,
                              acv.a_ap_tree^[curr_n].n_lo_level,
                              last_node);
                        END;
                    OTHERWISE
                        a07_error (acv,
                              e_wanted_keyword, put_node, last_node)
                    END;
                (*ENDCASE*) 
                IF  acv.a_returncode = 0
                THEN
                    BEGIN
                    acv.a_ap_tree^[curr_n].n_subproc := ikw;
                    acv.a_ap_tree^[curr_n].n_length  := cak_i_public
                    END;
                (*ENDIF*) 
                END;
            cak_i_sequence, cak_i_table :
                a02_atablename (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_synonym :
                a02_asynonymname (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            cak_i_user, cak_i_usergroup :
                a02_aauthid (acv,
                      acv.a_ap_tree^[curr_n].n_lo_level, last_node);
            OTHERWISE
                IF  acv.a_sqlmode = sqlm_db2
                THEN
                    BEGIN
                    a02_atablename (acv,
                          acv.a_ap_tree^[curr_n].n_lo_level, last_node);
                    a01_force_symbol (acv, s_leftpar, put_node, last_node);
                    IF  acv.a_returncode = 0
                    THEN
                        BEGIN
                        column_list                        := true;
                        acv.a_ap_tree^[put_node].n_subproc := cak_i_list;
                        END
                    (*ENDIF*) 
                    END
                ELSE
                    BEGIN
                    acv.a_scv := aux_scv; (* PTS 1112832 *)
                    a07_error (acv,
                          e_wanted_keyword, put_node, last_node)
                    END;
                (*ENDIF*) 
            END;
        (*ENDCASE*) 
    (*ENDIF*) 
    END;
(*ENDIF*) 
IF  acv.a_returncode = 0
THEN
    BEGIN
    IF  (acv.a_scv.sc_symb <> s_eof) OR
        (acv.a_init_ex_kind <> only_executing)
    THEN
        BEGIN
        a01_call_put (acv, a20, cak_i_startpos, comment_n);
        acv.a_ap_tree^[put_node].n_sa_level := comment_n;
        REPEAT
            IF  column_list
            THEN
                a02_n_acolumnname (acv,
                      acv.a_ap_tree^[ comment_n ].n_sa_level, comment_n);
            (*ENDIF*) 
            IF  a01mandatory_keyword (acv, cak_i_is)
            THEN
                BEGIN
                IF  (acv.a_scv.sc_symb = s_parameter_name) AND
                    (acv.a_ex_kind in [only_syntax, only_parsing])
                THEN
                    a02_s_aparameterspec (acv,
                          acv.a_ap_tree^[comment_n].n_sa_level,
                          comment_n)
                ELSE
                    a03_astring_literal (acv,
                          acv.a_ap_tree^[comment_n].n_sa_level,
                          comment_n);
                (*ENDIF*) 
                IF  (acv.a_scv.sc_symb = s_comma) AND column_list
                THEN
                    a01_next_symbol (acv);
                (*ENDIF*) 
                END
            (*ENDIF*) 
        UNTIL
            NOT column_list    OR
            (acv.a_returncode <> 0) OR
            (acv.a_scv.sc_symb = s_rightpar);
        (*ENDREPEAT*) 
        IF  column_list
        THEN
            a01_force_symbol (acv, s_rightpar, put_node, last_node);
        (*ENDIF*) 
        END;
    (*ENDIF*) 
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02procedure (VAR acv : tak_all_command_glob;
            VAR put_node   : tsp00_Int2;
            VAR last_node  : tsp00_Int2);
 
VAR
      node1 : tsp00_Int2;
      ikw     : integer;
      res_kw  : boolean;
      aux_scv : tak_scanner_glob;
 
BEGIN
WITH acv DO
    BEGIN
    aux_scv := a_scv;
    IF  scs_reserved_check in acv.a_scv.sc_states
    THEN
        a01_get_keyword (acv, ikw, res_kw);
    (*ENDIF*) 
    a02_put_identifier (acv, put_node, node1);
    IF  a_scv.sc_symb = s_point
    THEN
        BEGIN
        a01_next_symbol (acv);
        IF  scs_reserved_check in acv.a_scv.sc_states
        THEN
            BEGIN
            aux_scv := a_scv;
            a01_get_keyword (acv, ikw, res_kw);
            END;
        (*ENDIF*) 
        a02_put_identifier (acv, a_ap_tree^[node1].n_sa_level,
              last_node);
        a_ap_tree^[node1].n_symb := s_authid
        END
    ELSE
        last_node := node1;
    (*ENDIF*) 
    IF  ( scs_reserved_check in acv.a_scv.sc_states ) AND res_kw
    THEN
        BEGIN
        a_scv := aux_scv;
        a07_kw_put_error (acv, e_reserved_identifier,
              acv.a_scv.sc_sypos, ikw);
        END;
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02atableid (VAR acv   : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      curr_n  : tsp00_Int2;
      ikw     : integer;
      res_kw  : boolean;
 
BEGIN
WITH acv, a_scv DO
    BEGIN
    IF  sc_symb = s_asterisk
    THEN
        BEGIN
        a01_put_node (acv, last_node);
        a01_next_symbol (acv);
        put_node := last_node
        END
    ELSE
        IF  sc_symb <> s_identifier
        THEN
            a07_error (acv, e_invalid_tablename, put_node, last_node)
        ELSE
            BEGIN
            a01_get_keyword (acv,ikw, res_kw);
            sc_symb := s_tablename;
            a01_put_node (acv, last_node);
            put_node := last_node;
            curr_n   := last_node;
            a01_next_symbol (acv);
            (* PTS 1111797 E.Z. *)
            IF  sc_symb = s_point
            THEN
                BEGIN
                a01_next_symbol (acv);
                IF  (sc_symb <> s_identifier) AND (sc_symb <> s_asterisk)
                THEN
                    a07_error (acv,
                          e_invalid_tablename, put_node, last_node)
                ELSE
                    BEGIN
                    IF  sc_symb = s_identifier
                    THEN
                        BEGIN
                        sc_symb := s_tablename;
                        END;
                    (*ENDIF*) 
                    a01_put_node (acv, last_node);
                    WITH  a_ap_tree^[ curr_n ]  DO
                        BEGIN
                        n_symb     := s_authid;
                        n_sa_level := last_node
                        END;
                    (*ENDWITH*) 
                    a01_next_symbol (acv)
                    END;
                (*ENDIF*) 
                END;
            (*ENDIF*) 
            IF  (sc_symb = s_asterisk) AND
                (a_ap_tree^[ last_node ].n_symb = s_tablename)
            THEN
                BEGIN
                a_ap_tree^[ last_node ].n_symb := s_like;
                a01_next_symbol (acv)
                END;
            (*ENDIF*) 
            END;
        (*ENDIF*) 
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_ls_acolumnspec_list (VAR acv : tak_all_command_glob;
            table_required : boolean;
            VAR put_node   : tsp00_Int2;
            VAR last_node  : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a02_acolumnspec (acv, table_required, put_node, last_node);
        WHILE sc_symb = s_comma DO
            BEGIN
            a01_next_symbol (acv);
            a02_acolumnspec (acv, table_required,
                  a_ap_tree^[ last_node ].n_sa_level, last_node);
            END
        (*ENDWHILE*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_acolumnspec (VAR acv : tak_all_command_glob;
            table_required : boolean;
            VAR put_node   : tsp00_Int2;
            VAR last_node  : tsp00_Int2);
 
VAR
      author_node  : tsp00_Int2;
      table_node   : tsp00_Int2;
      column_node  : tsp00_Int2;
      ikw          : integer;
      res_kw       : boolean;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        IF  sc_symb <> s_identifier
        THEN
            a07_error (acv, e_invalid_columnname, put_node, last_node)
        ELSE
            BEGIN
            a01_get_keyword (acv, ikw, res_kw);
            (* PTS 1112324 E.Z. *)
            IF  (ikw = cak_i_select)
            THEN
                a07_error (acv, e_invalid_columnname, put_node, last_node)
            ELSE
                BEGIN
                sc_symb := s_columnname;
                a01_put_node (acv, author_node);
                put_node := author_node;
                a01_next_symbol (acv);
                (* PTS 1111797 E.Z. *)
                last_node   := author_node;
                IF  sc_symb = s_point
                THEN
                    BEGIN
                    (* 1. dot *)
                    a01_next_symbol (acv);
                    IF  (sc_symb <> s_identifier)      OR
                        (a_is_ddl = ddl_create_table ) OR
                        (a_is_ddl = ddl_create_domain) OR
                        (a_is_ddl = ddl_alter_tab_add)
                    THEN
                        a07_error (acv,
                              e_invalid_columnname, put_node, last_node)
                    ELSE
                        BEGIN
                        sc_symb := s_tablename;
                        a01_put_node (acv, table_node);
                        a_ap_tree^[last_node].n_sa_level := table_node;
                        a01_next_symbol (acv);
                        last_node := table_node;
                        IF  sc_symb = s_point
                        THEN
                            BEGIN
                            (* 2. dot *)
                            a01_next_symbol (acv);
                            IF  sc_symb <> s_identifier
                            THEN
                                a07_error (acv, e_invalid_columnname,
                                      put_node, last_node)
                            ELSE
                                BEGIN
                                sc_symb := s_columnname;
                                a01_put_node (acv, column_node);
                                a_ap_tree^[last_node].n_sa_level :=
                                      column_node;
                                a_ap_tree^[author_node].n_symb := s_authid;
                                last_node := column_node;
                                a01_next_symbol (acv)
                                END
                            (*ENDIF*) 
                            END
                        ELSE
                            BEGIN
                            a_ap_tree^[author_node].n_symb :=
                                  s_tablename;
                            a_ap_tree^[table_node].n_symb  :=
                                  s_columnname;
                            END;
                        (*ENDIF*) 
                        END;
                    (*ENDIF*) 
                    END
                ELSE
                    IF  table_required
                    THEN
                        a07_error (acv, e_invalid_tablename,
                              put_node, last_node)
                    (*ENDIF*) 
                (*ENDIF*) 
                END
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_n_acolumnname (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
a02_put_identifier (acv, put_node, last_node);
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_l_acolumn_list (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a02_n_acolumnname (acv, put_node, last_node);
        WHILE sc_symb = s_comma DO
            BEGIN
            a01_next_symbol (acv);
            a02_n_acolumnname (acv,
                  a_ap_tree^[ last_node ].n_sa_level, last_node);
            END
        (*ENDWHILE*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_l_atablename_list (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a02_atablename (acv, put_node, last_node);
        WHILE sc_symb = s_comma DO
            BEGIN
            a01_next_symbol (acv);
            a02_atablename (acv,
                  a_ap_tree^[ last_node ].n_sa_level, last_node);
            END
        (*ENDWHILE*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_s_atable_spec (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      indkey : integer;
      last_n : tsp00_Int2;
      curr_n : tsp00_Int2;
      res_kw : boolean;
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a01_call_put (acv, a66, cak_x_table_spec, curr_n);
        put_node  := curr_n;
        last_node := curr_n;
        a02_atablename  (acv,
              a_ap_tree^[ curr_n ].n_lo_level, last_n);
        IF  a_sqlmode <> sqlm_ansi
        THEN
            IF  sc_symb = s_identifier
            THEN
                BEGIN
                a01_get_keyword (acv, indkey, res_kw);
                IF  NOT res_kw AND
                    ((a_sqlmode <> sqlm_db2) OR (indkey = 0))
                THEN
                    a02_put_identifier (acv,
                          a_ap_tree^[ last_n ].n_sa_level, last_n);
                (*ENDIF*) 
                END;
            (*ENDIF*) 
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_l_aparameter_list (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        a02_s_aparameterspec (acv, put_node, last_node);
        WHILE  sc_symb = s_comma DO
            BEGIN
            a01_next_symbol ( acv);
            a02_s_aparameterspec  (acv,
                  a_ap_tree^[ last_node ].n_sa_level, last_node);
            END;
        (*ENDWHILE*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_s_aparameterspec (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        (* in ORACLE: (checked with Oracle V7)                 *)
        (* in a parameter_list the parameter does not need ':' *)
        (* the indicator does need the ':'!                    *)
        (* in all other cases the parameter needs ':'          *)
        (* and we call this procedure only if ak01 has found   *)
        (* the ':' in the beginning (s_parameter_name)         *)
        IF  (sc_symb <> s_parameter_name)
            AND
            ((a_sqlmode <> sqlm_oracle) OR
            (sc_symb <> s_identifier))
        THEN
            a07_error (acv, e_missing_identifier, put_node, last_node)
        ELSE
            BEGIN
            sc_symb := s_parameter_name;
            a01_put_node (acv, put_node);
            last_node := put_node;
            a01_next_symbol (acv);
            IF  ((a_sqlmode = sqlm_ansi) OR
                ( a_sqlmode = sqlm_oracle) OR
                ( a_sqlmode = sqlm_db2))
            THEN
                IF  sc_symb = s_identifier
                THEN
                    IF  a01_eqkey ( a01kw[ cak_i_indicator ], a_sqlmode,
                        a_cmd_part^.sp1p_buf, a_scv )
                    THEN
                        a01_next_symbol (acv);
                    (*ENDIF*) 
                (*ENDIF*) 
            (*ENDIF*) 
            IF  sc_symb = s_parameter_name
            THEN
                a01_next_symbol (acv)
            (*ENDIF*) 
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_aparameter_name (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        IF  sc_symb <> s_parameter_name
        THEN
            a07_error (acv, e_missing_identifier, put_node, last_node)
        ELSE
            BEGIN
            a01_put_node (acv, put_node);
            last_node := put_node;
            a01_next_symbol (acv);
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_asynonymname (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
IF  (acv.a_sqlmode = sqlm_oracle) OR
    (acv.a_sqlmode = sqlm_internal)
THEN
    ak02oracle_identifier (acv, put_node, last_node)
ELSE
    a02_put_identifier (acv, put_node, last_node);
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_aindexname (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
IF  acv.a_sqlmode = sqlm_oracle
THEN
    ak02oracle_identifier (acv, put_node, last_node)
ELSE
    a02_put_identifier (acv, put_node, last_node);
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_aresulttablename (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
a02_put_identifier (acv, put_node, last_node);
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_adomain_name (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
a02_put_identifier (acv, put_node, last_node);
IF  acv.a_scv.sc_symb = s_point
THEN
    BEGIN
    acv.a_ap_tree^[put_node].n_symb := s_authid;
    a01_next_symbol (acv);
    a02_put_identifier (acv,
          acv.a_ap_tree^[put_node].n_sa_level, last_node)
    END;
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_put_identifier (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
WITH acv, a_scv DO
    IF  a_returncode = 0
    THEN
        BEGIN
        IF  (sc_symb <> s_identifier) OR
            (sc_sypos = sc_missing_kw_pos)
        THEN
            a07_error (acv, e_missing_identifier, put_node, last_node)
        ELSE
            BEGIN
            a01_put_node (acv, put_node);
            last_node := put_node;
            a01_next_symbol (acv);
            END;
        (*ENDIF*) 
        END;
    (*ENDIF*) 
(*ENDWITH*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_asystem_devspace  (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
a03_astring_literal (acv, put_node, last_node);
END;
 
(*------------------------------*) 
 
PROCEDURE
      a02_ahostfile_name  (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
BEGIN
a01_next_symbol (acv);
a03_astring_literal (acv, put_node, last_node);
IF  acv.a_returncode = 0
THEN
    acv.a_ap_tree^[last_node].n_symb := s_hostfilename
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      ak02oracle_identifier (VAR acv : tak_all_command_glob;
            VAR put_node  : tsp00_Int2;
            VAR last_node : tsp00_Int2);
 
VAR
      username : tsp00_KnlIdentifier;
 
BEGIN
WITH acv DO
    BEGIN
    a02_put_identifier (acv, put_node, last_node);
    IF  acv.a_returncode = 0
    THEN
        IF  a_scv.sc_symb = s_point
        THEN
            BEGIN
            a05identifier_get (acv, put_node,
                  sizeof (username), username);
            IF  username <> a_curr_user_name
            THEN
                a07_b_put_error (acv, e_missing_privilege,
                      a_ap_tree^[put_node].n_pos)
            ELSE
                BEGIN
                a01_next_symbol (acv);
                a02_put_identifier (acv, put_node, last_node);
                END;
            (*ENDIF*) 
            END
        (*ENDIF*) 
    (*ENDIF*) 
    END;
(*ENDWITH*) 
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
.PA 
