pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lee Kindness <lkindness@csl.co.uk>
To: pgsql-interfaces@postgresql.org
Cc: Lee Kindness <lkindness@csl.co.uk>
Cc: pgsql-hackers@postgresql.org, Michael Meskes <meskes@postgresql.org>
Subject: ECPG: 7.4 and a "to" Variable
Date: Fri, 1 Aug 2003 12:06:07 +0100
Message-ID: <16170.18847.811096.853470@kelvin.csl.co.uk> (raw)

Guys, looking at ecpg from CVS HEAD's 7.4. The following code
fragement:

 EXEC SQL INCLUDE sqlca;
 EXEC SQL WHENEVER SQLERROR call sqlprint;

 void lofsdb_GetMinMaxRxStations(int *from, int *to)
 {
  EXEC SQL BEGIN DECLARE SECTION;
  int l_from = 0;
  int l_to   = 0;
  EXEC SQL END DECLARE SECTION;

  *from = 0;
  *to   = 0;

  EXEC SQL BEGIN;
  EXEC SQL SELECT MIN(from_station), MAX(to_station)
    INTO :l_from, :l_to
    FROM attr_tables
    WHERE basetab LIKE 'attr_rx_%';
  if( sqlca.sqlcode == 0 )
    {
      *from = l_from;
      *to   = l_to;
    }
  EXEC SQL COMMIT;
 }

when processed using:

 /var/lib/pgsql/74b/bin/ecpg -t -I/var/lib/pgsql/74b/include -o x.c x.pc

results in the following error:

 x.pc:4: ERROR: syntax error at or near "to"

However this works ok on 7.3.x and when the "to" variable is renamed
(e.g. to "to_rx"). Obviously TO is an SQL keyword, but it's not being
used within an EXEC SQL definition, so shouldn't break things.

Regards, Lee.



view thread (2+ messages)  latest in thread

Message-ID: <16170.18847.811096.853470@kelvin.csl.co.uk>
Permalink:  ../16170.18847.811096.853470@kelvin.csl.co.uk/
Also on:    postgresql.org/message-id/16170.18847.811096.853470@kelvin.csl.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: lkindness@csl.co.uk, meskes@postgresql.org
  Subject: Re: ECPG: 7.4 and a "to" Variable
  In-Reply-To: <16170.18847.811096.853470@kelvin.csl.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox