pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Application compile file using Embeded SQL in Postgres4.7.2
5+ messages / 4 participants
[nested] [flat]

* Application compile file using Embeded SQL in Postgres4.7.2
@ 2004-04-27 12:51  Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
  0 siblings, 2 replies; 5+ messages in thread

From: Kevin Cowley @ 2004-04-27 12:51 UTC (permalink / raw)
  To: pgsql-interfaces

 
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
 
Kevin Cowley
R&D
 
Tel: 0118 902 9099 (direct line)
Email: kevin.cowley@alchemetrics.co.uk
Web: http://www.alchemetrics.co.uk
 


**************************************************************************************
ALCHEMETRICS LIMITED (ALCHEMETRICS)
Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX
Tel:  +44 (0) 118 902 9000    Fax:  +44 (0) 118 902 9001
This e-mail is confidential and is intended for the use of the addressee only.
If you are not the intended recipient, you are hereby notified that you must 
not use, copy, disclose, otherwise disseminate or take any action based on 
this e-mail or any information herein.
If you receive this transmission in error, please notify the sender
immediately by reply e-mail or by using the contact details above and then
delete this e-mail.
Please note that e-mail may be susceptible to data corruption, interception 
and unauthorised amendment.  Alchemetrics does not accept any liability for 
any such corruption, interception, amendment or the consequences thereof.
**************************************************************************************

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Application compile file using Embeded SQL in
@ 2004-04-27 15:37  Paul Breen <pbreen@computerpark.co.uk>
  parent: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
  1 sibling, 0 replies; 5+ messages in thread

From: Paul Breen @ 2004-04-27 15:37 UTC (permalink / raw)
  To: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>; +Cc: pgsql-interfaces

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
>
> Kevin Cowley
> R&D
>
> Tel: 0118 902 9099 (direct line)
> Email: kevin.cowley@alchemetrics.co.uk
> Web: http://www.alchemetrics.co.uk
>
>
>
> **************************************************************************************
> ALCHEMETRICS LIMITED (ALCHEMETRICS)
> Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX
> Tel:  +44 (0) 118 902 9000    Fax:  +44 (0) 118 902 9001
> This e-mail is confidential and is intended for the use of the addressee
> only.
> If you are not the intended recipient, you are hereby notified that you
> must
> not use, copy, disclose, otherwise disseminate or take any action based on
> this e-mail or any information herein.
> If you receive this transmission in error, please notify the sender
> immediately by reply e-mail or by using the contact details above and then
> delete this e-mail.
> Please note that e-mail may be susceptible to data corruption,
> interception
> and unauthorised amendment.  Alchemetrics does not accept any liability
> for
> any such corruption, interception, amendment or the consequences thereof.
> **************************************************************************************
>
>


-- 
Paul M. Breen, Software Engineer - Computer Park Ltd.

Tel:   (01536) 417155
Email: pbreen@computerpark.co.uk
---------------------------------------------------------

This private and confidential e-mail has been sent to you 
by Computer Park Ltd. 

If you are not the intended recipient of this e-mail and 
have received it in error, please notify us via the email 
address or telephone number below, and then delete it from 
your mailbox.

Email: mailbox@computerpark.co.uk

Tel: +44 (0) 1536 417155
Fax: +44 (0) 1536 417566

Head Office:
Computer Park Ltd, Broughton Grange, Headlands, Kettering
Northamptonshire NN15 6XA

Registered in England: 3022961. 

Registered Office:
6 North Street, Oundle, Peterborough PE8 4AL 

=========================================================



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Application compile file using Embeded SQL in  P
@ 2004-04-27 15:48  Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
  0 siblings, 1 reply; 5+ messages in thread

From: Kevin Cowley @ 2004-04-27 15:48 UTC (permalink / raw)
  To: 'pbreen@computerpark.co.uk' <pbreen@computerpark.co.uk>; +Cc: pgsql-interfaces

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.

Kevin Cowley
R&D
 
Tel: 0118 902 9099 (direct line)
Email: kevin.cowley@alchemetrics.co.uk
Web: http://www.alchemetrics.co.uk

-----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
>
> Kevin Cowley
> R&D
>
> Tel: 0118 902 9099 (direct line)
> Email: kevin.cowley@alchemetrics.co.uk
> Web: http://www.alchemetrics.co.uk
>
>
>
>
****************************************************************************
**********
> ALCHEMETRICS LIMITED (ALCHEMETRICS)
> Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX
> Tel:  +44 (0) 118 902 9000    Fax:  +44 (0) 118 902 9001
> This e-mail is confidential and is intended for the use of the addressee
> only.
> If you are not the intended recipient, you are hereby notified that you
> must
> not use, copy, disclose, otherwise disseminate or take any action based on
> this e-mail or any information herein.
> If you receive this transmission in error, please notify the sender
> immediately by reply e-mail or by using the contact details above and then
> delete this e-mail.
> Please note that e-mail may be susceptible to data corruption,
> interception
> and unauthorised amendment.  Alchemetrics does not accept any liability
> for
> any such corruption, interception, amendment or the consequences thereof.
>
****************************************************************************
**********
>
>


-- 
Paul M. Breen, Software Engineer - Computer Park Ltd.

Tel:   (01536) 417155
Email: pbreen@computerpark.co.uk
---------------------------------------------------------

This private and confidential e-mail has been sent to you 
by Computer Park Ltd. 

If you are not the intended recipient of this e-mail and 
have received it in error, please notify us via the email 
address or telephone number below, and then delete it from 
your mailbox.

Email: mailbox@computerpark.co.uk

Tel: +44 (0) 1536 417155
Fax: +44 (0) 1536 417566

Head Office:
Computer Park Ltd, Broughton Grange, Headlands, Kettering
Northamptonshire NN15 6XA

Registered in England: 3022961. 

Registered Office:
6 North Street, Oundle, Peterborough PE8 4AL 

=========================================================


**************************************************************************************
ALCHEMETRICS LIMITED (ALCHEMETRICS)
Mulberry Park, Fishponds Road, Wokingham, Berkshire, RG41 2GX
Tel:  +44 (0) 118 902 9000    Fax:  +44 (0) 118 902 9001
This e-mail is confidential and is intended for the use of the addressee only.
If you are not the intended recipient, you are hereby notified that you must 
not use, copy, disclose, otherwise disseminate or take any action based on 
this e-mail or any information herein.
If you receive this transmission in error, please notify the sender
immediately by reply e-mail or by using the contact details above and then
delete this e-mail.
Please note that e-mail may be susceptible to data corruption, interception 
and unauthorised amendment.  Alchemetrics does not accept any liability for 
any such corruption, interception, amendment or the consequences thereof.
**************************************************************************************




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Application compile file using Embeded SQL in  P
@ 2004-04-27 16:17  Lee Kindness <lkindness@csl.co.uk>
  parent: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
  0 siblings, 0 replies; 5+ messages in thread

From: Lee Kindness @ 2004-04-27 16:17 UTC (permalink / raw)
  To: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>; +Cc: 'pbreen@computerpark.co.uk' <pbreen@computerpark.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.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Application compile file using Embeded SQL in Postgres4.7.2
@ 2004-05-21 13:53  Michael Meskes <meskes@postgresql.org>
  parent: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
  1 sibling, 0 replies; 5+ messages in thread

From: Michael Meskes @ 2004-05-21 13:53 UTC (permalink / raw)
  To: Kevin Cowley <kevin.cowley@alchemetrics.co.uk>; +Cc: pgsql-interfaces

On Tue, Apr 27, 2004 at 01:51:56PM +0100, Kevin Cowley wrote:
>  
> 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.
> ...

Well it seems to me that there is also a problem in ecpg itself, namely
that it accepts a singleton char as database name where only a string
makes sense.

I've fixed that in CVS.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2004-05-21 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 12:51 Application compile file using Embeded SQL in Postgres4.7.2 Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
2004-04-27 15:37 ` Re: Application compile file using Embeded SQL in Paul Breen <pbreen@computerpark.co.uk>
2004-05-21 13:53 ` Michael Meskes <meskes@postgresql.org>
2004-04-27 15:48 Re: Application compile file using Embeded SQL in  P Kevin Cowley <kevin.cowley@alchemetrics.co.uk>
2004-04-27 16:17 ` Re: Application compile file using Embeded SQL in  P Lee Kindness <lkindness@csl.co.uk>

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