#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | TBempl |
Defines | |
#define | ECPGdebug(X, Y) ECPGdebug((X)+100,(Y)) |
Typedefs | |
typedef long | mmInteger |
typedef char | mmChar |
typedef short | mmSmallInt |
typedef char | string [11] |
typedef char * | c |
Functions | |
int | main (void) |
#define ECPGdebug | ( | X, | ||
Y | ||||
) | ECPGdebug((X)+100,(Y)) |
Definition at line 7 of file preproc-type.c.
typedef char* c |
Definition at line 51 of file preproc-type.c.
typedef char mmChar |
Definition at line 30 of file preproc-type.c.
typedef long mmInteger |
Definition at line 24 of file preproc-type.c.
typedef short mmSmallInt |
Definition at line 36 of file preproc-type.c.
typedef char string[11] |
Definition at line 46 of file preproc-type.c.
int main | ( | void | ) |
Definition at line 74 of file preproc-type.c.
References TBempl::accs, ECPGconnect(), ECPGdebug, ECPGdisconnect(), ECPGdo(), ECPGst_normal, ECPGt_char, ECPGt_EOIT, ECPGt_EORT, ECPGt_long, ECPGt_NO_INDICATOR, ECPGt_short, ECPGt_varchar, free, TBempl::idnum, TBempl::name, NULL, sqlca, and varchar().
{ /* exec sql begin declare section */ #line 29 "type.pgc" struct TBempl empl ; #line 30 "type.pgc" string str ; #line 31 "type.pgc" c ptr = NULL ; #line 36 "type.pgc" struct varchar { #line 34 "type.pgc" int len ; #line 35 "type.pgc" char text [ 10 ] ; } vc ; /* exec sql end declare section */ #line 37 "type.pgc" /* exec sql var vc is [ 10 ] */ #line 39 "type.pgc" ECPGdebug (1, stderr); empl.idnum = 1; { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); } #line 43 "type.pgc" if (sqlca.sqlcode) { printf ("connect error = %ld\n", sqlca.sqlcode); exit (sqlca.sqlcode); } { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table empl ( idnum integer , name char ( 20 ) , accs smallint , string1 char ( 10 ) , string2 char ( 10 ) , string3 char ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);} #line 51 "type.pgc" if (sqlca.sqlcode) { printf ("create error = %ld\n", sqlca.sqlcode); exit (sqlca.sqlcode); } { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'user name' , 320 , 'first str' , 'second str' , 'third str' )", ECPGt_EOIT, ECPGt_EORT);} #line 58 "type.pgc" if (sqlca.sqlcode) { printf ("insert error = %ld\n", sqlca.sqlcode); exit (sqlca.sqlcode); } { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ", ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_long,&(empl.idnum),(long)1,(long)1,sizeof(long), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(empl.name),(long)21,(long)1,(21)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_short,&(empl.accs),(long)1,(long)1,sizeof(short), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,(str),(long)11,(long)1,(11)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(ptr),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_varchar,&(vc),(long)10,(long)1,sizeof(struct varchar), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);} #line 68 "type.pgc" if (sqlca.sqlcode) { printf ("select error = %ld\n", sqlca.sqlcode); exit (sqlca.sqlcode); } printf ("id=%ld name='%s' accs=%d str='%s' ptr='%s' vc='%10.10s'\n", empl.idnum, empl.name, empl.accs, str, ptr, vc.text); { ECPGdisconnect(__LINE__, "CURRENT");} #line 76 "type.pgc" free(ptr); exit (0); }