From: | Lee Kindness <lkindness(at)csl(dot)co(dot)uk> |
---|---|
To: | Kevin Cowley <kevin(dot)cowley(at)alchemetrics(dot)co(dot)uk> |
Cc: | "'pbreen(at)computerpark(dot)co(dot)uk'" <pbreen(at)computerpark(dot)co(dot)uk>, "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: Application compile file using Embeded SQL in P |
Date: | 2004-04-27 16:17:18 |
Message-ID: | 16526.34702.956516.581431@kelvin.csl.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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(at)kelvin:~% ecpg test.pgc
lkind(at)kelvin:~% gcc -Wall -lecpg test.c
lkind(at)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(at)computerpark(dot)co(dot)uk]
> Sent: 27 April 2004 16:37
> To: Kevin Cowley
> Cc: 'pgsql-interfaces(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-04-28 05:09:14 | Re: Tantalizing reference to passing data from NEW variable |
Previous Message | Kevin Cowley | 2004-04-27 15:48:52 | Re: Application compile file using Embeded SQL in P |