Question

I've decided to use postgreSQL as database for a game project(C++).

At the moment I'm using Oracle and it's Pro*C precompiler at work and heard that postgreSQL also has something similar called ECPG.

It's also possible to access data from the the postgres database directly by using the SQL in a string.

So the difference between "normal" and using ECPG, is that you can write your SQL statements like code?, or are there any other differences I should be aware of?.

(PS: i know I'm using it at work, but I haven't noticed any other differences)

Looking forward to hearing from you guys.

Was it helpful?

Solution

Yes, ECPG is covered in the documentation.

So the difference between "normal" and using ECPG, is that you can write your SQL statements like code?

Well, SQL statements are code. A SQL statement just looks like a SQL statement. This is what a CREATE TABLE statement might look like in ECPG.

EXEC SQL CREATE TABLE foo (number integer, ascii char(16));

ECPG allows variable substitution. (Maybe that's what you meant by "write your SQL statements like code".)

EXEC SQL INSERT INTO sometable VALUES (:v1, 'foo', :v2);

All this stuff is in the documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top