Re: Application compile file using Embeded SQL in P
От | Lee Kindness |
---|---|
Тема | Re: Application compile file using Embeded SQL in P |
Дата | |
Msg-id | 16526.34702.956516.581431@kelvin.csl.co.uk обсуждение исходный текст |
Ответ на | Re: Application compile file using Embeded SQL in P (Kevin Cowley <kevin.cowley@alchemetrics.co.uk>) |
Список | 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@kelvin:~% ecpg test.pgclkind@kelvin:~% gcc -Wall -lecpg test.clkind@kelvin:~% ./a.outsqlca.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 lineand 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 wayI 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 embeddedSQL app in Postgres 4.7.2 and failing at> > the> > first hurdle - Postgres itself compiles, starts, executes withno> > problems.> >> > We're using gcc 3.2.2 on SLES 8> >> > The problem I'm getting is that ecpg doesn't appear to ableto 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 frompointer 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' makesinteger 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 integerwithout a cast
В списке pgsql-interfaces по дате отправления: