Re: SQL END SQL postgresql

Iwan AB <[email protected]> Wed, 7 Jul 2021 23:34:15 +0700
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAHJCSmLXcAMk_g2VfjweFG0r6iqzMEeSQYRWERbXpm03V9wiqQ@mail.gmail.com>
Dear Mike,

I got it, I have no bison installed. After installing bison, it works now.
Thanks.

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 9:45 PM Mike Aubury <[email protected]> wrote:

> Do you have "bison" installed ?
>
> (If not it will be using a pregenerated y.tab.c)
>
> If you look in incl/Makefile-common - you should see something like this
>
> #BISON will contatin full path to bison executable. It will already include
> #-y flag set from autoconf, or "no" if not found or disabled:
> BISON               =LANG=C LC_ALL=C /usr/local/bin/bison -y -Wno-yacc
> BISON_EXE                       =/usr/local/bin/bison
> #YACC is variable name we use all over the make files, for Bison command
> YACC                =$(strip ${BISON} )
>
>
>
> (around line 393)
>
> If it helps - I'm using
> $ bison --version
> bison (GNU Bison) 3.3
> Written by Robert Corbett and Richard Stallman.
>
> Copyright (C) 2019 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
>
> <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_-2897201770753434041_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, 7 Jul 2021 at 15:40, Iwan AB <[email protected]> wrote:
>
>> 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>
>> <#m_-2897201770753434041_m_186899806486080012_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_-2897201770753434041_m_186899806486080012_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_-2897201770753434041_m_186899806486080012_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
>>
>

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