From: Lee Kindness <lkindness@csl.co.uk>
To: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
Cc: 'pbreen@computerpark.co.uk' <pbreen@computerpark.co.uk>
Cc: 'pgsql-interfaces@postgresql.org' <pgsql-interfaces@postgresql.org>
Subject: Re: Application compile file using Embeded SQL in P
Date: Tue, 27 Apr 2004 17:17:18 +0100
Message-ID: <16526.34702.956516.581431@kelvin.csl.co.uk> (raw)
In-Reply-To: <A170CC6BD457D3118EF800508B2C304805C366D9@mailhost.alchemetrics.co.uk>
References: <A170CC6BD457D3118EF800508B2C304805C366D9@mailhost.alchemetrics.co.uk>
I don't think that's what Paul was asking... It might help if you post
a small example program. I think you're talking about something like:
int main(int argc, char **argv)
{
EXEC SQL BEGIN DECLARE SECTION;
const char *target = "db";
const char *user = "username";
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT TO :target USER :user;
printf("sqlca.sqlcode: %ld\n", sqlca.sqlcode);
return( 0 );
}
which gives the following:
lkind@kelvin:~% ecpg test.pgc
lkind@kelvin:~% gcc -Wall -lecpg test.c
lkind@kelvin:~% ./a.out
sqlca.sqlcode: -402
So, if that's not what you have...
L.
Kevin Cowley writes:
> Paul
>
> I've just checked and they're const char*.
>
> I also commented out my original EXEC SQL line and re wrote it as an
> explicit connect and it compiled, so I started adding the variables back in
> and it still compiles.
>
> I don't understand :-[ And I haven't changed the Makefile either.
>
> -----Original Message-----
> From: Paul Breen [mailto:pbreen@computerpark.co.uk]
> Sent: 27 April 2004 16:37
> To: Kevin Cowley
> Cc: 'pgsql-interfaces@postgresql.org'
> Subject: Re: [INTERFACES] Application compile file using Embeded SQL in
> Postgres4.7.2
>
> Hello Kevin,
>
> Are you sure that target & user are declared as string pointers (char *)?
>
> The only way I could get similar errors to those you describe was by
> declaring target & user as simple char variables in ECPG's declare
> section.
>
> I'm using gcc 3.3, Postgres 7.3.2 on SuSE 8.2.
>
> Regards - Paul
>
> >
> > I'm trying to build an embedded SQL app in Postgres 4.7.2 and failing at
> > the
> > first hurdle - Postgres itself compiles, starts, executes with no
> > problems.
> >
> > We're using gcc 3.2.2 on SLES 8
> >
> > The problem I'm getting is that ecpg doesn't appear to able to generate
> > compilable code for something as simple as
> >
> > EXEC SQL CONNECT TO :target USER :user;
> >
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc: In function
> > `Connect':
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc:378: warning:
> > passing
> > arg 2 of `ECPGconnect' makes integer from pointer without a cast
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc:378: too few
> > arguments
> > to function `ECPGconnect'
> >
> > This is not the only place this type of error occurs. Elsewhere I have
> >
> > EXCE SQL IMMEDIATE :stmt;
> >
> > Which gives
> >
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc: In function
> > `ExecuteQuery':
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc:447: warning:
> > passing
> > arg 2 of `ECPGdo' makes integer from pointer without a cast
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc:447: warning:
> > passing
> > arg 3 of `ECPGdo' makes integer from pointer without a cast
> > /sandbox/cowleyke/src/SQL_Benchmarks/tst_postgres.pgc:447: warning:
> > passing
> > arg 4 of `ECPGdo' makes pointer from integer without a cast
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, kevin.cowley@alchemetrics.co.uk, pbreen@computerpark.co.uk
Subject: Re: Application compile file using Embeded SQL in P
In-Reply-To: <16526.34702.956516.581431@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