PostgreSQL Source Code: src/interfaces/ecpg/test/expected/preproc-type.c Source File (original) (raw)

1

2

6

7#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))

8

9#line 1 "type.pgc"

10#include <stdio.h>

11#include <stdlib.h>

12

13

14#line 1 "regression.h"

15

16

17

18

19

20

21#line 4 "type.pgc"

22

23

25

26#line 6 "type.pgc"

27

28#line 6 "type.pgc"

29

31

32#line 7 "type.pgc"

33

34#line 7 "type.pgc"

35

37

38#line 8 "type.pgc"

39

40#line 8 "type.pgc"

41

43

44#line 9 "type.pgc"

45

46#line 9 "type.pgc"

47

48

49

50#line 11 "type.pgc"

51

52typedef char string[11];

53

54

55#line 14 "type.pgc"

56

57typedef char* c;

58

59

60

61

62

63

64

65

67#line 20 "type.pgc"

69

70#line 21 "type.pgc"

72

73#line 22 "type.pgc"

75 } ;

76#line 24 "type.pgc"

77

78

79int

81{

82

83

84

85

86

87

88

89

90

91

92

93#line 30 "type.pgc"

95

96#line 31 "type.pgc"

97 string str ;

98

99#line 32 "type.pgc"

100 access accs_val = 320 ;

101

102#line 33 "type.pgc"

103 c ptr = NULL ;

104

105#line 38 "type.pgc"

107#line 36 "type.pgc"

108 int len ;

109

110#line 37 "type.pgc"

111 char text [ 10 ] ;

112 } vc ;

113

114#line 39 "type.pgc"

115

116

117

118#line 41 "type.pgc"

119

121

123 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }

124#line 45 "type.pgc"

125

126 if (sqlca.sqlcode)

127 {

128 printf ("connect error = %ld\n", sqlca.sqlcode);

129 exit (sqlca.sqlcode);

130 }

131

132 { 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);}

133#line 53 "type.pgc"

134

135 if (sqlca.sqlcode)

136 {

137 printf ("create error = %ld\n", sqlca.sqlcode);

138 exit (sqlca.sqlcode);

139 }

140

141 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into empl values ( 1 , 'user name' , $1 , 'first str' , 'second str' , 'third str' )",

142 ECPGt_short,&(accs_val),(long)1,(long)1,sizeof(short),

144#line 60 "type.pgc"

145

146 if (sqlca.sqlcode)

147 {

148 printf ("insert error = %ld\n", sqlca.sqlcode);

149 exit (sqlca.sqlcode);

150 }

151

152 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select idnum , name , accs , string1 , string2 , string3 from empl where idnum = $1 ",

161 ECPGt_char,(str),(long)11,(long)1,(11)*sizeof(char),

163 ECPGt_char,&(ptr),(long)0,(long)1,(1)*sizeof(char),

167#line 70 "type.pgc"

168

169 if (sqlca.sqlcode)

170 {

171 printf ("select error = %ld\n", sqlca.sqlcode);

172 exit (sqlca.sqlcode);

173 }

174 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);

175

177#line 78 "type.pgc"

178

179

181 exit (0);

182}

bool ECPGdisconnect(int lineno, const char *connection_name)

bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)

bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)

Datum varchar(PG_FUNCTION_ARGS)