Search Postgresql Archives

Pro*C versus {ecpg and PostgreSQL}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear list,

I am migrating an Oracle database to PostgreSQL and the last step I must perform is to convert several Pro*C programs into PostgreSQL embedded SQL. I work on AIX 5.3 TL9 64-bits, on which I have built PostgreSQL 8.3.8 in 64-bits too.
I am a newbie in Embedded SQL and I am facing several problems / questions.
I hope you could help me.


1. Initially, the Pro*C program include an external file, having #ifdef lines at the beginning, using : EXEC SQL INCLUDE "file1.h";
If I let this command in the ".pgc" file, the preprocess with ecpg failed :
$ ecpg prog1.pgc
./file1.h:17: ERROR: syntax error at or near "EXTERN"

The first lines of the "file1.h" file are :
#if defined(var1)
EXTERN int a; ... ...

I see in the 8.2.15 documentation (even if this release is a bit old now) a comment indicating : /Unfortunately "exec sql include" can NOT be thought of as simply inserting the included file at the appropriate place. For instance, having #ifdef lines in the included file does not work, you must use "exec sql ifdef", even though having #ifdef's in the original source file is fine./

So, I have replaced the line
EXEC SQL INCLUDE "file1.h";
by (at the beginning of the embedded SQL program) :
#include "file1.h";
and now the preprocess succeeded :
$ ecpg prog1.pgc
$

=> Any explanation please ?


2. In examples of PostgreSQL embedded SQL, I saw these includes :
#include <stdio.h>
#include <stdlib.h>
#include <sqltypes.h>
without any comments.

=> Do I need to specify them anyway ?


3. Do "best practices" to convert Pro*C program in PostgreSQL exist ? What are the main differences between Pro*C and embedded SQL program in PostgreSQL ?


Thank you very much for your help !
Regards,
Alexandra

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux