Questions tagged [ecpg]

ECPG - Embedded SQL in C for PostgreSQL

ECPG is an embedded SQL package in C for PostgreSQL.

Read more about ECPG on this page: http://www.postgresql.org/docs/9.4/static/ecpg.html

Read more general information about embedded SQL on this page: http://en.wikipedia.org/wiki/Embedded_SQL

28 questions
0
votes
1 answer

Postgres ECPG: adding a function outside main() breaks the program

I have successfully connected and obtained data from Postgresql with my C application. My connector.pgc file looks like this: #include #include //#include "connect.h" // PROBLEM int connect(); //NO PROBLEM EXEC SQL BEGIN…
nmtcn
  • 1
  • 3
0
votes
1 answer

good order for deallocating in ecpg

In a pgc code, I do a kind of: exec sql begin work; exec sql prepare my_rqt from :rqt_insert ; exec sql execute my_rqt using :foo, :bar ; if ( sqlca.sqlcode == 0 ){ exec sql deallocate prepare my_rqt ; exec sql commit ; } else { exec…
Overnuts
  • 783
  • 5
  • 17
0
votes
0 answers

How to use LISTEN/NOTIFY with ECPG

I'm trying out ECPG for work as we plan to switch from Ingres to Postgres. We have multiple C applications that uses DBEVENTs from the database to trigger different actions. Now I want to use the Postgres function LISTEN to subscribe to events from…
0
votes
0 answers

What is postgres equivalent header for informix sqlhdr.h

I am migrating my application from informix to postgres. As my application is cpp based I was using esqlc to compile it. Now I am getting error sqlhdr.h not found...
0
votes
1 answer

Using ecpg with postgresql, unable to parse boolean field

I am trying to retrieve records from a PostgreSQL I use the following script to create the database, table and fill it up with some records: psql << "EOF" CREATE DATABASE todo; \c todo CREATE TABLE items ( id serial PRIMARY KEY, task …
yoonghm
  • 4,198
  • 1
  • 32
  • 48
0
votes
1 answer

ecpg insert null with host variable (psotgreSQL)

I want to insert a null value into psql table with ecpg host variable, but I have no idea how to do this, it is a simple example below: EXEC SQL BEGIN DECLARE SECTION; char var1; int var2; EXEC SQL END DECLARE SECTION; int main(){ EXEC SQL…
ohohyeah
  • 13
  • 2
0
votes
1 answer

Multiply two host variables in embedded SQL for PostgreSQL

I have problem multiplying two host variables in embedded SQL for PostgreSQL. The SQL-query is big but I have cut out the part that doesn't work. Declaration: EXEC SQL BEGIN DECLARE SECTION; int var1; int var2; EXEC SQL END DECLARE…
user1766169
  • 1,932
  • 3
  • 22
  • 44
0
votes
0 answers

Embedded SQL in C connection issue

The Postgresql role is the owner of the db 'university' and it's been configured like, alter user canoe password 'mypassword'; The piece of embedded SQL code in C just makes a connection to DB. printf("SQLSTATE=[%s]\n", SQLSTATE); EXEC SQL…
canoe
  • 1,273
  • 13
  • 29
0
votes
1 answer

How to make cmake script for ecpg and qt project?

How to make cmake build script for project that use ecpg code generation and qt moc compiler? Also how to add code generation in cmake (which is easy in make)?
Yaroslav Kishchenko
  • 475
  • 1
  • 4
  • 15
0
votes
1 answer

PostgreSQL why/when should I use ECPG

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…
jeromintus
  • 367
  • 1
  • 5
  • 14
0
votes
1 answer

PostgreSQL - ECPG / C - host variable UTF-8 decoding

I have a UTF8 encoding database. I am using ECPG - PROGRAM C. When I get data recordset with EXEC SQL EXEC SQL DECLARE cur_myTable CURSOR FOR SELECT code, label INTO :hv_cod, :hv_label FROM myTable but I…
toch
  • 67
  • 6
0
votes
1 answer

ecpg error: break statement not within loop or switch

i have written a ecpg code. i'm trying to insert a tuple into the table based on if the tuple already exists in the table. i'm getting "error: break statement not within loop or switch " on compiling please help i have commented in the code the…
krrish0690
  • 51
  • 2
  • 11
0
votes
0 answers

ECPG: sizeof() in EXEC SQL DECLARE SECTION

I have Sybase ASE CPRE Embedded SQL С code: void MyFunc( MyClass*unit_address ) { EXEC SQL BEGIN DECLARE SECTION; CS_BINARY var1[sizeof(MyClass)]; EXEC SQL END DECLARE SECTION; } Try to migrate to PostgreSQL ECPG Embedded SQL…
ggJa
  • 19
  • 3
1
2