aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/expected/preproc-define.c
blob: b5d01a9403525302f048b75be0c12d3db430c51f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* Processed by ecpg (4.2.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */

#line 1 "define.pgc"
#include <stdio.h>
#include <stdlib.h>


#line 1 "regression.h"






#line 4 "define.pgc"


typedef long  mmInteger ;

#line 6 "define.pgc"

#line 6 "define.pgc"

typedef char  mmChar ;

#line 7 "define.pgc"

#line 7 "define.pgc"

typedef short  mmSmallInt ;

#line 8 "define.pgc"

#line 8 "define.pgc"


/* exec sql begin declare section */
 

   
   
   

struct TBempl { 
#line 13 "define.pgc"
 mmInteger  idnum    ;
 
#line 14 "define.pgc"
 mmChar  name [ 21 ]    ;
 
#line 15 "define.pgc"
 mmSmallInt  accs    ;
 } ;/* exec sql end declare section */
#line 17 "define.pgc"


int
main (void)
{
  /* exec sql begin declare section */
    
  
#line 23 "define.pgc"
 struct TBempl  empl    ;
/* exec sql end declare section */
#line 24 "define.pgc"


  ECPGdebug (1, stderr);

  empl.idnum = 1;
  { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); }
#line 29 "define.pgc"

  if (sqlca.sqlcode)
    {
      printf ("connect error = %ld\n", sqlca.sqlcode);
      exit (sqlca.sqlcode);
    }

  { ECPGdo(__LINE__, 0, 1, NULL, "create  table empl ( idnum integer   , name char  ( 20 )    , accs smallint   )    ", ECPGt_EOIT, ECPGt_EORT);}
#line 37 "define.pgc"

  if (sqlca.sqlcode)
    {
      printf ("create error = %ld\n", sqlca.sqlcode);
      exit (sqlca.sqlcode);
    }

  { ECPGdo(__LINE__, 0, 1, NULL, "insert into empl values ( 1 , 'first user' , 320 ) ", ECPGt_EOIT, ECPGt_EORT);}
#line 44 "define.pgc"

  if (sqlca.sqlcode)
    {
      printf ("insert error = %ld\n", sqlca.sqlcode);
      exit (sqlca.sqlcode);
    }

  { ECPGdo(__LINE__, 0, 1, NULL, "select  idnum , name , accs  from empl where idnum =  ?  ", 
	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_EORT);}
#line 54 "define.pgc"

  if (sqlca.sqlcode)
    {
      printf ("select error = %ld\n", sqlca.sqlcode);
      exit (sqlca.sqlcode);
    }
  printf ("id=%ld name=%s, accs=%d\n", empl.idnum, empl.name, empl.accs);

  { ECPGdisconnect(__LINE__, "CURRENT");}
#line 62 "define.pgc"

  exit (0);
}