Re: SQL END SQL postgresql

Iwan AB <[email protected]> Wed, 7 Jul 2021 21:39:42 +0700
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAHJCSm+JygS1vfssMhR9ijB8jGkg=ASM_MoZTvMkBvzS0A1-Vg@mail.gmail.com>
Hi Mike,

I've commented out the COLON part from the sqlblock.rule, recompile the
source, but still have the same error.
I also try removing the COLON part, recompile back, still the error exists
when compiling the program.

sql_block_entry:
        INTO expanded_obind_var_list {
                        $<ptr>$=A4GL_new_expr_simple
(ET_EXPR_SQLBLOCK_INTO);
                        $<ptr>$->expr_str_u.expr_list=$<ptr_list>2;
        }
        | DOLLAR SQL_TEXT {
      char  numbered_value[300];
      sprintf(numbered_value,"$%s",$<str>2);
                  $<ptr>$=A4GL_new_expr_simple_string(numbered_value,
ET_EXPR_SQLBLOCK_TEXT);
        }
        | DOLLAR ensured_variable_usage_expression {
                        $<ptr>$=$<ptr>2;
        }
        | sql_block_text {
                $<ptr>$=A4GL_new_expr_simple_string($<sql_string>1,
ET_EXPR_SQLBLOCK_TEXT);
                free($<sql_string>1);
        }
;

Regards,

Iwan

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Jul 7, 2021 at 2:58 PM Mike Aubury <[email protected]> wrote:

> ":" is used to denote the use of a 4gl variable (along with $) in the
> embedded SQL :(
>
> If you're compiling from source - you can comment that out and just use
> "$" :
>
> sql_block_entry:
>         INTO expanded_obind_var_list {
>                         $<ptr>$=A4GL_new_expr_simple
> (ET_EXPR_SQLBLOCK_INTO);
>                         $<ptr>$->expr_str_u.expr_list=$<ptr_list>2;
>         }
>         | DOLLAR SQL_TEXT {
>       char  numbered_value[300];
>       sprintf(numbered_value,"$%s",$<str>2);
>                   $<ptr>$=A4GL_new_expr_simple_string(numbered_value,
> ET_EXPR_SQLBLOCK_TEXT);
>         }
>         | DOLLAR ensured_variable_usage_expression {
>                         $<ptr>$=$<ptr>2;
>         }
>         | COLON ensured_variable_usage_expression {
>                         $<ptr>$=$<ptr>2;
>         }
>         | sql_block_text {
>                 $<ptr>$=A4GL_new_expr_simple_string($<sql_string>1,
> ET_EXPR_SQLBLOCK_TEXT);
>                 free($<sql_string>1);
>         }
> ;
>
> (aubit4glsrc/compilers/4glc/rules/sqlblock.rule)
>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
> www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-7960415586225659124_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, 7 Jul 2021 at 03:56, Iwan AB <[email protected]> wrote:
>
>> Hi,
>>
>> I try SQL END SQL block to check whether a table is defined with or
>> without oid in postgresql as follow
>>
>>     SQL WITHOUT CONVERSIONS
>>
>>         SELECT attname FROM pg_attribute
>>             WHERE attrelid = 't_test'::regclass
>>               AND attname = 'oid'
>>
>>     END SQL
>>
>> when compiled, it came up with the following error
>>
>>     SQL WITHOUT CONVERSIONS
>>
>>         SELECT attname FROM pg_attribute
>>             WHERE attrelid = 't_test'::regclass
>> |___________________________________________^
>> | Error at line 24, character 45
>> | ':' does not represent a defined variable (:)
>>               AND attname = 'oid'
>>
>>     END SQL
>>
>> why is that?
>>
>> Regards,
>>
>> Iwan
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_-7960415586225659124_m_4709480780349622479_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>> _______________________________________________
>> Aubit4gl-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
>>
>

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss