Skip to main content

Posts

Showing posts from February, 2013

Sample ECPG Script

Hi

Below is the sample ECPG test case what i have prepared.

Sample ECPG Scripts
================

-bash-4.1$ more foo2.htypedef struct{foo123 a[8];} bar;-bash-4.1$ more foo1.htypedef struct{int x;}foo123;-bash-4.1$ more foo.pgcEXEC SQL INCLUDE "foo1.h";EXEC SQL INCLUDE "foo2.h";int main(){    EXEC SQL BEGIN DECLARE SECTION;        char* dbname = "edb";        char* db     = "edb@localhost:5444";        char* user   = "enterprisedb";        char* passwd = "adminedb";    EXEC SQL END DECLARE SECTION;    bar records;    EXEC SQL WHENEVER SQLERROR      GOTO sql_error;    EXEC SQL CONNECT :user IDENTIFIED BY :passwd AT :dbname USING :db;    EXEC SQL AT :dbname DECLARE cur_TBL CURSOR FOR                SELECT COUNT(*) AS rec_count                  FROM EMP        ;    EXEC SQL AT :dbname    OPEN  cur_TBL;    EXEC SQL AT :dbname    FETCH cur_TBL INTO :records.a[0].x;    EXEC SQL AT :dbname    CLOSE cur_TBL;    EXEC SQL DISCONNECT CUR…