Mapper
isQualBetter.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 #include <sqliapi.h>
3 #line 1 "isQualBetter.ec"
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 /*
8  * exec sql include sqlca;
9  */
10 #line 4 "isQualBetter.ec"
11 
12 #line 4 "isQualBetter.ec"
13 #line 1 "/opt/informix/incl/esql/sqlca.h"
14 /***************************************************************************
15  *
16  * INFORMIX SOFTWARE, INC.
17  *
18  * PROPRIETARY DATA
19  *
20  * THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF
21  * INFORMIX SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN
22  * CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR
23  * DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT
24  * SIGNED BY AN OFFICER OF INFORMIX SOFTWARE, INC.
25  *
26  * THIS MATERIAL IS ALSO COPYRIGHTED AS AN UNPUBLISHED WORK UNDER
27  * SECTIONS 104 AND 408 OF TITLE 17 OF THE UNITED STATES CODE.
28  * UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED BY LAW.
29  *
30  *
31  * Title: sqlca.h
32  * Sccsid: @(#)sqlca.h 9.4 1/18/93 11:09:48
33  * Description:
34  * SQL Control Area
35  *
36  ***************************************************************************
37  */
38 
39 #ifndef SQLCA_INCL
40 #define SQLCA_INCL
41 
42 #include "ifxtypes.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef struct sqlca_s
49  {
50  int4 sqlcode;
51  char sqlerrm[72]; /* error message parameters */
52  char sqlerrp[8];
53  int4 sqlerrd[6];
54  /* 0 - estimated number of rows returned */
55  /* 1 - serial value after insert or ISAM error code */
56  /* 2 - number of rows processed */
57  /* 3 - estimated cost */
58  /* 4 - offset of the error into the SQL statement */
59  /* 5 - rowid after insert */
60 #ifdef _FGL_
61  char sqlawarn[8];
62 #else
63  struct sqlcaw_s
64  {
65  char sqlwarn0; /* = W if any of sqlwarn[1-7] = W */
66  char sqlwarn1; /* = W if any truncation occurred or
67  database has transactions or
68  no privileges revoked */
69  char sqlwarn2; /* = W if a null value returned or
70  ANSI database */
71  char sqlwarn3; /* = W if no. in select list != no. in into list or
72  turbo backend or no privileges granted */
73  char sqlwarn4; /* = W if no where clause on prepared update, delete or
74  incompatible float format */
75  char sqlwarn5; /* = W if non-ANSI statement */
76  char sqlwarn6; /* = W if server is in data replication secondary mode */
77  char sqlwarn7; /* = W if database locale is different from proc_locale
78  */
79  } sqlwarn;
80 #endif
82 
83 /* NOTE: 4gl assumes that the sqlwarn structure can be defined as
84  * sqlawarn -- an 8 character string, because single-char
85  * variables are not recognized in 4gl.
86  *
87  * If this structure should change, the code generated by 4gl compiler
88  * must also change
89  */
90 
91 #ifdef VMS
92 noshare
93 #endif /* VMS */
94 
95 #define SQLNOTFOUND 100
96 
97 #ifndef IFX_THREAD
98 extern struct sqlca_s sqlca;
99 
100 extern int4 SQLCODE;
101 
102 extern char SQLSTATE[];
103 #else /* IFX_THREAD */
104 extern int4 * ifx_sqlcode();
105 extern struct sqlca_s * ifx_sqlca();
106 #define SQLCODE (*(ifx_sqlcode()))
107 #define SQLSTATE ((char *)(ifx_sqlstate()))
108 #define sqlca (*(ifx_sqlca()))
109 #endif /* IFX_THREAD */
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif /* SQLCA_INCL */
116 
117 #line 103 "/opt/informix/incl/esql/sqlca.h"
118 #line 5 "isQualBetter.ec"
119 
120 int isQualBetter(char ch1, char ch2)
121 {
122 
123 /*
124  * $char a1, a2;
125  */
126 #line 9 "isQualBetter.ec"
127 #line 9 "isQualBetter.ec"
128  char a1, a2;
129 /*
130  * $int power1, power2, i;
131  */
132 #line 10 "isQualBetter.ec"
133 #line 10 "isQualBetter.ec"
134 int power1, power2, i;
135 
136 
137 
138 
139 
140 /* $database fastetc; */
141 
142 power1 = -1; power2 = -2;
143 a1 = ch1; a2 = ch2;
144 
145 /*
146  * $select power into :power1 from qual_code
147  * where q=:a1;
148  */
149 #line 21 "isQualBetter.ec"
150  {
151 #line 22 "isQualBetter.ec"
152  static const char *sqlcmdtxt[] =
153 #line 22 "isQualBetter.ec"
154  {
155 #line 22 "isQualBetter.ec"
156  " select power from qual_code where q = ?",
157  0
158  };
159 #line 22 "isQualBetter.ec"
160 static ifx_cursor_t _SQ0 = {0};
161  static ifx_sqlvar_t _sqibind[] =
162  {
163  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
164 #line 22 "isQualBetter.ec"
165  };
166  static ifx_sqlvar_t _sqobind[] =
167  {
168  { 102, sizeof(power1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
169 #line 22 "isQualBetter.ec"
170  };
171 #line 22 "isQualBetter.ec"
172  _sqibind[0].sqldata = &a1;
173 #line 22 "isQualBetter.ec"
174  _sqobind[0].sqldata = (char *) &power1;
175 #line 22 "isQualBetter.ec"
176  sqli_slct(ESQLINTVERSION, &_SQ0,(char **) sqlcmdtxt,1,_sqibind,1,_sqobind,0,(ifx_literal_t *) 0,(ifx_namelist_t *) 0,0);
177 #line 22 "isQualBetter.ec"
178  }
179 if(SQLCODE != 0) return -4;
180 if(power1 < 0) return power1;
181 
182 /*
183  * $select power into :power2 from qual_code
184  * where q=:a2;
185  */
186 #line 26 "isQualBetter.ec"
187  {
188 #line 27 "isQualBetter.ec"
189  static const char *sqlcmdtxt[] =
190 #line 27 "isQualBetter.ec"
191  {
192 #line 27 "isQualBetter.ec"
193  " select power from qual_code where q = ?",
194  0
195  };
196 #line 27 "isQualBetter.ec"
197 static ifx_cursor_t _SQ0 = {0};
198  static ifx_sqlvar_t _sqibind[] =
199  {
200  { 108, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
201 #line 27 "isQualBetter.ec"
202  };
203  static ifx_sqlvar_t _sqobind[] =
204  {
205  { 102, sizeof(power2), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
206 #line 27 "isQualBetter.ec"
207  };
208 #line 27 "isQualBetter.ec"
209  _sqibind[0].sqldata = &a2;
210 #line 27 "isQualBetter.ec"
211  _sqobind[0].sqldata = (char *) &power2;
212 #line 27 "isQualBetter.ec"
213  sqli_slct(ESQLINTVERSION, &_SQ0,(char **) sqlcmdtxt,1,_sqibind,1,_sqobind,0,(ifx_literal_t *) 0,(ifx_namelist_t *) 0,0);
214 #line 27 "isQualBetter.ec"
215  }
216 if(SQLCODE != 0) return -5;
217 if(power2 < 0) return power2;
218 
219 
220 if(power1 > power2)
221  return 1;
222 else
223  return -3;
224 }
225 
226 
227 
228 
229 
230 
231 
232 
233 #line 43 "isQualBetter.ec"
static int i
int isQualBetter(char ch1, char ch2)
Definition: isQualBetter.c:120
int4 SQLCODE
struct sqlca_s ifx_sqlca_t
char SQLSTATE[]
struct sqlca_s sqlca
char sqlwarn5
Definition: db.c:65
char sqlwarn3
Definition: db.c:61
char sqlwarn4
Definition: db.c:63
char sqlwarn7
Definition: db.c:67
char sqlwarn1
Definition: db.c:57
char sqlwarn6
Definition: db.c:66
char sqlwarn2
Definition: db.c:59
char sqlwarn0
Definition: db.c:56
Definition: db.c:43
long sqlerrd[6]
Definition: db.c:47
struct sqlca_s::sqlcaw_s sqlwarn
long sqlcode
Definition: db.c:44
char sqlerrm[72]
Definition: db.c:45
char sqlerrp[8]
Definition: db.c:46