Commit 17273d05 authored by Peter Eisentraut's avatar Peter Eisentraut

Remove unnecessary parentheses in return statements

The parenthesized style has only been used in a few modules.  Change
that to use the style that is predominant across the whole tree.
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
Reviewed-by: default avatarRyan Murphy <ryanfmurphy@gmail.com>
parent ba26f5cf
...@@ -296,7 +296,7 @@ gbt_num_consistent(const GBT_NUMKEY_R *key, ...@@ -296,7 +296,7 @@ gbt_num_consistent(const GBT_NUMKEY_R *key,
retval = false; retval = false;
} }
return (retval); return retval;
} }
......
...@@ -159,7 +159,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo) ...@@ -159,7 +159,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo)
l--; l--;
i++; i++;
} }
return (ml); /* lower == upper */ return ml; /* lower == upper */
} }
...@@ -299,7 +299,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo) ...@@ -299,7 +299,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
else else
retval = entry; retval = entry;
return (retval); return retval;
} }
......
...@@ -625,7 +625,7 @@ g_cube_leaf_consistent(NDBOX *key, ...@@ -625,7 +625,7 @@ g_cube_leaf_consistent(NDBOX *key,
default: default:
retval = FALSE; retval = FALSE;
} }
return (retval); return retval;
} }
bool bool
...@@ -652,7 +652,7 @@ g_cube_internal_consistent(NDBOX *key, ...@@ -652,7 +652,7 @@ g_cube_internal_consistent(NDBOX *key,
default: default:
retval = FALSE; retval = FALSE;
} }
return (retval); return retval;
} }
NDBOX * NDBOX *
...@@ -663,7 +663,7 @@ g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep) ...@@ -663,7 +663,7 @@ g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep)
retval = cube_union_v0(r1, r2); retval = cube_union_v0(r1, r2);
*sizep = VARSIZE(retval); *sizep = VARSIZE(retval);
return (retval); return retval;
} }
...@@ -729,7 +729,7 @@ cube_union_v0(NDBOX *a, NDBOX *b) ...@@ -729,7 +729,7 @@ cube_union_v0(NDBOX *a, NDBOX *b)
SET_POINT_BIT(result); SET_POINT_BIT(result);
} }
return (result); return result;
} }
Datum Datum
...@@ -1058,7 +1058,7 @@ cube_contains_v0(NDBOX *a, NDBOX *b) ...@@ -1058,7 +1058,7 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
int i; int i;
if ((a == NULL) || (b == NULL)) if ((a == NULL) || (b == NULL))
return (FALSE); return FALSE;
if (DIM(a) < DIM(b)) if (DIM(a) < DIM(b))
{ {
...@@ -1070,9 +1070,9 @@ cube_contains_v0(NDBOX *a, NDBOX *b) ...@@ -1070,9 +1070,9 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
for (i = DIM(a); i < DIM(b); i++) for (i = DIM(a); i < DIM(b); i++)
{ {
if (LL_COORD(b, i) != 0) if (LL_COORD(b, i) != 0)
return (FALSE); return FALSE;
if (UR_COORD(b, i) != 0) if (UR_COORD(b, i) != 0)
return (FALSE); return FALSE;
} }
} }
...@@ -1081,13 +1081,13 @@ cube_contains_v0(NDBOX *a, NDBOX *b) ...@@ -1081,13 +1081,13 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
{ {
if (Min(LL_COORD(a, i), UR_COORD(a, i)) > if (Min(LL_COORD(a, i), UR_COORD(a, i)) >
Min(LL_COORD(b, i), UR_COORD(b, i))) Min(LL_COORD(b, i), UR_COORD(b, i)))
return (FALSE); return FALSE;
if (Max(LL_COORD(a, i), UR_COORD(a, i)) < if (Max(LL_COORD(a, i), UR_COORD(a, i)) <
Max(LL_COORD(b, i), UR_COORD(b, i))) Max(LL_COORD(b, i), UR_COORD(b, i)))
return (FALSE); return FALSE;
} }
return (TRUE); return TRUE;
} }
Datum Datum
...@@ -1128,7 +1128,7 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) ...@@ -1128,7 +1128,7 @@ cube_overlap_v0(NDBOX *a, NDBOX *b)
int i; int i;
if ((a == NULL) || (b == NULL)) if ((a == NULL) || (b == NULL))
return (FALSE); return FALSE;
/* swap the box pointers if needed */ /* swap the box pointers if needed */
if (DIM(a) < DIM(b)) if (DIM(a) < DIM(b))
...@@ -1143,21 +1143,21 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) ...@@ -1143,21 +1143,21 @@ cube_overlap_v0(NDBOX *a, NDBOX *b)
for (i = 0; i < DIM(b); i++) for (i = 0; i < DIM(b); i++)
{ {
if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Max(LL_COORD(b, i), UR_COORD(b, i))) if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Max(LL_COORD(b, i), UR_COORD(b, i)))
return (FALSE); return FALSE;
if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Min(LL_COORD(b, i), UR_COORD(b, i))) if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Min(LL_COORD(b, i), UR_COORD(b, i)))
return (FALSE); return FALSE;
} }
/* compare to zero those dimensions in (a) absent in (b) */ /* compare to zero those dimensions in (a) absent in (b) */
for (i = DIM(b); i < DIM(a); i++) for (i = DIM(b); i < DIM(a); i++)
{ {
if (Min(LL_COORD(a, i), UR_COORD(a, i)) > 0) if (Min(LL_COORD(a, i), UR_COORD(a, i)) > 0)
return (FALSE); return FALSE;
if (Max(LL_COORD(a, i), UR_COORD(a, i)) < 0) if (Max(LL_COORD(a, i), UR_COORD(a, i)) < 0)
return (FALSE); return FALSE;
} }
return (TRUE); return TRUE;
} }
...@@ -1385,7 +1385,7 @@ distance_1D(double a1, double a2, double b1, double b2) ...@@ -1385,7 +1385,7 @@ distance_1D(double a1, double a2, double b1, double b2)
return (Min(a1, a2) - Max(b1, b2)); return (Min(a1, a2) - Max(b1, b2));
/* the rest are all sorts of intersections */ /* the rest are all sorts of intersections */
return (0.0); return 0.0;
} }
/* Test if a box is also a point */ /* Test if a box is also a point */
......
...@@ -2217,7 +2217,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals ...@@ -2217,7 +2217,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
} }
appendStringInfoChar(&buf, ')'); appendStringInfoChar(&buf, ')');
return (buf.data); return buf.data;
} }
static char * static char *
...@@ -2254,7 +2254,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals ...@@ -2254,7 +2254,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
appendStringInfoString(&buf, " IS NULL"); appendStringInfoString(&buf, " IS NULL");
} }
return (buf.data); return buf.data;
} }
static char * static char *
...@@ -2341,7 +2341,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals ...@@ -2341,7 +2341,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
appendStringInfoString(&buf, " IS NULL"); appendStringInfoString(&buf, " IS NULL");
} }
return (buf.data); return buf.data;
} }
/* /*
...@@ -2549,9 +2549,9 @@ getConnectionByName(const char *name) ...@@ -2549,9 +2549,9 @@ getConnectionByName(const char *name)
key, HASH_FIND, NULL); key, HASH_FIND, NULL);
if (hentry) if (hentry)
return (hentry->rconn); return hentry->rconn;
return (NULL); return NULL;
} }
static HTAB * static HTAB *
......
...@@ -245,7 +245,7 @@ checkcondition_arr(void *checkval, ITEM *item) ...@@ -245,7 +245,7 @@ checkcondition_arr(void *checkval, ITEM *item)
{ {
StopMiddle = StopLow + (StopHigh - StopLow) / 2; StopMiddle = StopLow + (StopHigh - StopLow) / 2;
if (*StopMiddle == item->val) if (*StopMiddle == item->val)
return (true); return true;
else if (*StopMiddle < item->val) else if (*StopMiddle < item->val)
StopLow = StopMiddle + 1; StopLow = StopMiddle + 1;
else else
...@@ -274,7 +274,7 @@ execute(ITEM *curitem, void *checkval, bool calcnot, ...@@ -274,7 +274,7 @@ execute(ITEM *curitem, void *checkval, bool calcnot,
return (*chkcond) (checkval, curitem); return (*chkcond) (checkval, curitem);
else if (curitem->val == (int32) '!') else if (curitem->val == (int32) '!')
{ {
return (calcnot) ? return calcnot ?
((execute(curitem - 1, checkval, calcnot, chkcond)) ? false : true) ((execute(curitem - 1, checkval, calcnot, chkcond)) ? false : true)
: true; : true;
} }
......
...@@ -26,7 +26,7 @@ ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void ...@@ -26,7 +26,7 @@ ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void
return (*chkcond) (checkval, curitem); return (*chkcond) (checkval, curitem);
else if (curitem->val == (int32) '!') else if (curitem->val == (int32) '!')
{ {
return (calcnot) ? return calcnot ?
((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true) ((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true)
: true; : true;
} }
......
...@@ -206,18 +206,18 @@ static inline int ...@@ -206,18 +206,18 @@ static inline int
ascii_to_bin(char ch) ascii_to_bin(char ch)
{ {
if (ch > 'z') if (ch > 'z')
return (0); return 0;
if (ch >= 'a') if (ch >= 'a')
return (ch - 'a' + 38); return (ch - 'a' + 38);
if (ch > 'Z') if (ch > 'Z')
return (0); return 0;
if (ch >= 'A') if (ch >= 'A')
return (ch - 'A' + 12); return (ch - 'A' + 12);
if (ch > '9') if (ch > '9')
return (0); return 0;
if (ch >= '.') if (ch >= '.')
return (ch - '.'); return (ch - '.');
return (0); return 0;
} }
static void static void
...@@ -420,7 +420,7 @@ des_setkey(const char *key) ...@@ -420,7 +420,7 @@ des_setkey(const char *key)
* (which is weak and has bad parity anyway) in order to simplify the * (which is weak and has bad parity anyway) in order to simplify the
* starting conditions. * starting conditions.
*/ */
return (0); return 0;
} }
old_rawkey0 = rawkey0; old_rawkey0 = rawkey0;
old_rawkey1 = rawkey1; old_rawkey1 = rawkey1;
...@@ -479,7 +479,7 @@ des_setkey(const char *key) ...@@ -479,7 +479,7 @@ des_setkey(const char *key)
| comp_maskr[6][(t1 >> 7) & 0x7f] | comp_maskr[6][(t1 >> 7) & 0x7f]
| comp_maskr[7][t1 & 0x7f]; | comp_maskr[7][t1 & 0x7f];
} }
return (0); return 0;
} }
static int static int
...@@ -500,7 +500,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count) ...@@ -500,7 +500,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count)
int round; int round;
if (count == 0) if (count == 0)
return (1); return 1;
else if (count > 0) else if (count > 0)
{ {
/* /*
...@@ -613,7 +613,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count) ...@@ -613,7 +613,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count)
| fp_maskr[5][(r >> 16) & 0xff] | fp_maskr[5][(r >> 16) & 0xff]
| fp_maskr[6][(r >> 8) & 0xff] | fp_maskr[6][(r >> 8) & 0xff]
| fp_maskr[7][r & 0xff]; | fp_maskr[7][r & 0xff];
return (0); return 0;
} }
static int static int
...@@ -639,7 +639,7 @@ des_cipher(const char *in, char *out, long salt, int count) ...@@ -639,7 +639,7 @@ des_cipher(const char *in, char *out, long salt, int count)
retval = do_des(rawl, rawr, &l_out, &r_out, count); retval = do_des(rawl, rawr, &l_out, &r_out, count);
if (retval) if (retval)
return (retval); return retval;
buffer[0] = htonl(l_out); buffer[0] = htonl(l_out);
buffer[1] = htonl(r_out); buffer[1] = htonl(r_out);
...@@ -647,7 +647,7 @@ des_cipher(const char *in, char *out, long salt, int count) ...@@ -647,7 +647,7 @@ des_cipher(const char *in, char *out, long salt, int count)
/* copy data to avoid assuming output is word-aligned */ /* copy data to avoid assuming output is word-aligned */
memcpy(out, buffer, sizeof(buffer)); memcpy(out, buffer, sizeof(buffer));
return (retval); return retval;
} }
char * char *
...@@ -680,7 +680,7 @@ px_crypt_des(const char *key, const char *setting) ...@@ -680,7 +680,7 @@ px_crypt_des(const char *key, const char *setting)
key++; key++;
} }
if (des_setkey((char *) keybuf)) if (des_setkey((char *) keybuf))
return (NULL); return NULL;
#ifndef DISABLE_XDES #ifndef DISABLE_XDES
if (*setting == _PASSWORD_EFMT1) if (*setting == _PASSWORD_EFMT1)
...@@ -711,7 +711,7 @@ px_crypt_des(const char *key, const char *setting) ...@@ -711,7 +711,7 @@ px_crypt_des(const char *key, const char *setting)
* Encrypt the key with itself. * Encrypt the key with itself.
*/ */
if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1)) if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1))
return (NULL); return NULL;
/* /*
* And XOR with the next 8 characters of the key. * And XOR with the next 8 characters of the key.
...@@ -721,7 +721,7 @@ px_crypt_des(const char *key, const char *setting) ...@@ -721,7 +721,7 @@ px_crypt_des(const char *key, const char *setting)
*q++ ^= *key++ << 1; *q++ ^= *key++ << 1;
if (des_setkey((char *) keybuf)) if (des_setkey((char *) keybuf))
return (NULL); return NULL;
} }
StrNCpy(output, setting, 10); StrNCpy(output, setting, 10);
...@@ -767,7 +767,7 @@ px_crypt_des(const char *key, const char *setting) ...@@ -767,7 +767,7 @@ px_crypt_des(const char *key, const char *setting)
* Do it. * Do it.
*/ */
if (do_des(0L, 0L, &r0, &r1, count)) if (do_des(0L, 0L, &r0, &r1, count))
return (NULL); return NULL;
/* /*
* Now encode the result... * Now encode the result...
...@@ -790,5 +790,5 @@ px_crypt_des(const char *key, const char *setting) ...@@ -790,5 +790,5 @@ px_crypt_des(const char *key, const char *setting)
*p++ = _crypt_a64[l & 0x3f]; *p++ = _crypt_a64[l & 0x3f];
*p = 0; *p = 0;
return (output); return output;
} }
...@@ -568,7 +568,7 @@ pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo) ...@@ -568,7 +568,7 @@ pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo)
tuple = heap_form_tuple(tupleDesc, values, nulls); tuple = heap_form_tuple(tupleDesc, values, nulls);
result = HeapTupleGetDatum(tuple); result = HeapTupleGetDatum(tuple);
return (result); return result;
} }
/* ------------------------------------------------------ /* ------------------------------------------------------
......
...@@ -528,7 +528,7 @@ gseg_binary_union(Datum r1, Datum r2, int *sizep) ...@@ -528,7 +528,7 @@ gseg_binary_union(Datum r1, Datum r2, int *sizep)
retval = DirectFunctionCall2(seg_union, r1, r2); retval = DirectFunctionCall2(seg_union, r1, r2);
*sizep = sizeof(SEG); *sizep = sizeof(SEG);
return (retval); return retval;
} }
...@@ -1040,7 +1040,7 @@ restore(char *result, float val, int n) ...@@ -1040,7 +1040,7 @@ restore(char *result, float val, int n)
/* ... this is not done yet. */ /* ... this is not done yet. */
} }
return (strlen(result)); return strlen(result);
} }
...@@ -1080,7 +1080,7 @@ significant_digits(char *s) ...@@ -1080,7 +1080,7 @@ significant_digits(char *s)
} }
if (!n) if (!n)
return (zeroes); return zeroes;
return (n); return n;
} }
...@@ -636,5 +636,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans) ...@@ -636,5 +636,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans)
newp->splan = NULL; newp->splan = NULL;
(*nplans)++; (*nplans)++;
return (newp); return newp;
} }
...@@ -517,7 +517,7 @@ findTTStatus(char *name) ...@@ -517,7 +517,7 @@ findTTStatus(char *name)
AbsoluteTime AbsoluteTime
currabstime() currabstime()
{ {
return (GetCurrentAbsoluteTime()); return GetCurrentAbsoluteTime();
} }
*/ */
...@@ -549,5 +549,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans) ...@@ -549,5 +549,5 @@ find_plan(char *ident, EPlan **eplan, int *nplans)
newp->splan = NULL; newp->splan = NULL;
(*nplans)++; (*nplans)++;
return (newp); return newp;
} }
...@@ -4397,7 +4397,7 @@ execq(text *sql, int cnt) ...@@ -4397,7 +4397,7 @@ execq(text *sql, int cnt)
SPI_finish(); SPI_finish();
pfree(command); pfree(command);
return (proc); return proc;
} }
</programlisting> </programlisting>
......
...@@ -72,25 +72,25 @@ arrayid [A-Za-z0-9_]+\[{D}*\] ...@@ -72,25 +72,25 @@ arrayid [A-Za-z0-9_]+\[{D}*\]
%% %%
open { return(OPEN); } open { return OPEN; }
close { return(XCLOSE); } close { return XCLOSE; }
create { return(XCREATE); } create { return XCREATE; }
OID { return(OBJ_ID); } OID { return OBJ_ID; }
bootstrap { return(XBOOTSTRAP); } bootstrap { return XBOOTSTRAP; }
"shared_relation" { return(XSHARED_RELATION); } "shared_relation" { return XSHARED_RELATION; }
"without_oids" { return(XWITHOUT_OIDS); } "without_oids" { return XWITHOUT_OIDS; }
"rowtype_oid" { return(XROWTYPE_OID); } "rowtype_oid" { return XROWTYPE_OID; }
_null_ { return(NULLVAL); } _null_ { return NULLVAL; }
insert { return(INSERT_TUPLE); } insert { return INSERT_TUPLE; }
"," { return(COMMA); } "," { return COMMA; }
"=" { return(EQUALS); } "=" { return EQUALS; }
"(" { return(LPAREN); } "(" { return LPAREN; }
")" { return(RPAREN); } ")" { return RPAREN; }
[\n] { yyline++; } [\n] { yyline++; }
[\t] ; [\t] ;
...@@ -99,31 +99,31 @@ insert { return(INSERT_TUPLE); } ...@@ -99,31 +99,31 @@ insert { return(INSERT_TUPLE); }
^\#[^\n]* ; /* drop everything after "#" for comments */ ^\#[^\n]* ; /* drop everything after "#" for comments */
"declare" { return(XDECLARE); } "declare" { return XDECLARE; }
"build" { return(XBUILD); } "build" { return XBUILD; }
"indices" { return(INDICES); } "indices" { return INDICES; }
"unique" { return(UNIQUE); } "unique" { return UNIQUE; }
"index" { return(INDEX); } "index" { return INDEX; }
"on" { return(ON); } "on" { return ON; }
"using" { return(USING); } "using" { return USING; }
"toast" { return(XTOAST); } "toast" { return XTOAST; }
"FORCE" { return(XFORCE); } "FORCE" { return XFORCE; }
"NOT" { return(XNOT); } "NOT" { return XNOT; }
"NULL" { return(XNULL); } "NULL" { return XNULL; }
{arrayid} { {arrayid} {
yylval.str = MapArrayTypeName(yytext); yylval.str = MapArrayTypeName(yytext);
return(ID); return ID;
} }
{id} { {id} {
yylval.str = scanstr(yytext); yylval.str = scanstr(yytext);
return(ID); return ID;
} }
{sid} { {sid} {
yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */ yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
yylval.str = scanstr(yytext+1); yylval.str = scanstr(yytext+1);
yytext[strlen(yytext)] = '"'; /* restore quotes */ yytext[strlen(yytext)] = '"'; /* restore quotes */
return(ID); return ID;
} }
. { . {
......
...@@ -195,14 +195,14 @@ static char *VoidString = ""; ...@@ -195,14 +195,14 @@ static char *VoidString = "";
static int static int
cmpspell(const void *s1, const void *s2) cmpspell(const void *s1, const void *s2)
{ {
return (strcmp((*(SPELL *const *) s1)->word, (*(SPELL *const *) s2)->word)); return strcmp((*(SPELL *const *) s1)->word, (*(SPELL *const *) s2)->word);
} }
static int static int
cmpspellaffix(const void *s1, const void *s2) cmpspellaffix(const void *s1, const void *s2)
{ {
return (strcmp((*(SPELL *const *) s1)->p.flag, return strcmp((*(SPELL *const *) s1)->p.flag,
(*(SPELL *const *) s2)->p.flag)); (*(SPELL *const *) s2)->p.flag);
} }
static int static int
...@@ -2240,9 +2240,9 @@ NormalizeSubWord(IspellDict *Conf, char *word, int flag) ...@@ -2240,9 +2240,9 @@ NormalizeSubWord(IspellDict *Conf, char *word, int flag)
if (cur == forms) if (cur == forms)
{ {
pfree(forms); pfree(forms);
return (NULL); return NULL;
} }
return (forms); return forms;
} }
typedef struct SplitVar typedef struct SplitVar
......
...@@ -58,12 +58,12 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size) ...@@ -58,12 +58,12 @@ inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size)
switch (af) switch (af)
{ {
case PGSQL_AF_INET: case PGSQL_AF_INET:
return (inet_cidr_ntop_ipv4(src, bits, dst, size)); return inet_cidr_ntop_ipv4(src, bits, dst, size);
case PGSQL_AF_INET6: case PGSQL_AF_INET6:
return (inet_cidr_ntop_ipv6(src, bits, dst, size)); return inet_cidr_ntop_ipv6(src, bits, dst, size);
default: default:
errno = EAFNOSUPPORT; errno = EAFNOSUPPORT;
return (NULL); return NULL;
} }
} }
...@@ -92,7 +92,7 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) ...@@ -92,7 +92,7 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
if (bits < 0 || bits > 32) if (bits < 0 || bits > 32)
{ {
errno = EINVAL; errno = EINVAL;
return (NULL); return NULL;
} }
if (bits == 0) if (bits == 0)
...@@ -137,11 +137,11 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) ...@@ -137,11 +137,11 @@ inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
if (size <= sizeof "/32") if (size <= sizeof "/32")
goto emsgsize; goto emsgsize;
dst += SPRINTF((dst, "/%u", bits)); dst += SPRINTF((dst, "/%u", bits));
return (odst); return odst;
emsgsize: emsgsize:
errno = EMSGSIZE; errno = EMSGSIZE;
return (NULL); return NULL;
} }
/* /*
...@@ -182,7 +182,7 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) ...@@ -182,7 +182,7 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
if (bits < 0 || bits > 128) if (bits < 0 || bits > 128)
{ {
errno = EINVAL; errno = EINVAL;
return (NULL); return NULL;
} }
cp = outbuf; cp = outbuf;
...@@ -286,9 +286,9 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) ...@@ -286,9 +286,9 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
goto emsgsize; goto emsgsize;
strcpy(dst, outbuf); strcpy(dst, outbuf);
return (dst); return dst;
emsgsize: emsgsize:
errno = EMSGSIZE; errno = EMSGSIZE;
return (NULL); return NULL;
} }
...@@ -73,7 +73,7 @@ inet_net_pton(int af, const char *src, void *dst, size_t size) ...@@ -73,7 +73,7 @@ inet_net_pton(int af, const char *src, void *dst, size_t size)
inet_cidr_pton_ipv6(src, dst, size); inet_cidr_pton_ipv6(src, dst, size);
default: default:
errno = EAFNOSUPPORT; errno = EAFNOSUPPORT;
return (-1); return -1;
} }
} }
...@@ -228,15 +228,15 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -228,15 +228,15 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
goto emsgsize; goto emsgsize;
*dst++ = '\0'; *dst++ = '\0';
} }
return (bits); return bits;
enoent: enoent:
errno = ENOENT; errno = ENOENT;
return (-1); return -1;
emsgsize: emsgsize:
errno = EMSGSIZE; errno = EMSGSIZE;
return (-1); return -1;
} }
/* /*
...@@ -338,11 +338,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst) ...@@ -338,11 +338,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
enoent: enoent:
errno = ENOENT; errno = ENOENT;
return (-1); return -1;
emsgsize: emsgsize:
errno = EMSGSIZE; errno = EMSGSIZE;
return (-1); return -1;
} }
static int static int
...@@ -363,19 +363,19 @@ getbits(const char *src, int *bitsp) ...@@ -363,19 +363,19 @@ getbits(const char *src, int *bitsp)
if (pch != NULL) if (pch != NULL)
{ {
if (n++ != 0 && val == 0) /* no leading zeros */ if (n++ != 0 && val == 0) /* no leading zeros */
return (0); return 0;
val *= 10; val *= 10;
val += (pch - digits); val += (pch - digits);
if (val > 128) /* range */ if (val > 128) /* range */
return (0); return 0;
continue; continue;
} }
return (0); return 0;
} }
if (n == 0) if (n == 0)
return (0); return 0;
*bitsp = val; *bitsp = val;
return (1); return 1;
} }
static int static int
...@@ -397,32 +397,32 @@ getv4(const char *src, u_char *dst, int *bitsp) ...@@ -397,32 +397,32 @@ getv4(const char *src, u_char *dst, int *bitsp)
if (pch != NULL) if (pch != NULL)
{ {
if (n++ != 0 && val == 0) /* no leading zeros */ if (n++ != 0 && val == 0) /* no leading zeros */
return (0); return 0;
val *= 10; val *= 10;
val += (pch - digits); val += (pch - digits);
if (val > 255) /* range */ if (val > 255) /* range */
return (0); return 0;
continue; continue;
} }
if (ch == '.' || ch == '/') if (ch == '.' || ch == '/')
{ {
if (dst - odst > 3) /* too many octets? */ if (dst - odst > 3) /* too many octets? */
return (0); return 0;
*dst++ = val; *dst++ = val;
if (ch == '/') if (ch == '/')
return (getbits(src, bitsp)); return getbits(src, bitsp);
val = 0; val = 0;
n = 0; n = 0;
continue; continue;
} }
return (0); return 0;
} }
if (n == 0) if (n == 0)
return (0); return 0;
if (dst - odst > 3) /* too many octets? */ if (dst - odst > 3) /* too many octets? */
return (0); return 0;
*dst++ = val; *dst++ = val;
return (1); return 1;
} }
static int static int
...@@ -552,13 +552,13 @@ inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size) ...@@ -552,13 +552,13 @@ inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size)
*/ */
memcpy(dst, tmp, NS_IN6ADDRSZ); memcpy(dst, tmp, NS_IN6ADDRSZ);
return (bits); return bits;
enoent: enoent:
errno = ENOENT; errno = ENOENT;
return (-1); return -1;
emsgsize: emsgsize:
errno = EMSGSIZE; errno = EMSGSIZE;
return (-1); return -1;
} }
...@@ -317,14 +317,14 @@ checkcondition_arr(void *checkval, QueryOperand *val, ExecPhraseData *data) ...@@ -317,14 +317,14 @@ checkcondition_arr(void *checkval, QueryOperand *val, ExecPhraseData *data)
{ {
StopMiddle = StopLow + (StopHigh - StopLow) / 2; StopMiddle = StopLow + (StopHigh - StopLow) / 2;
if (*StopMiddle == val->valcrc) if (*StopMiddle == val->valcrc)
return (true); return true;
else if (*StopMiddle < val->valcrc) else if (*StopMiddle < val->valcrc)
StopLow = StopMiddle + 1; StopLow = StopMiddle + 1;
else else
StopHigh = StopMiddle; StopHigh = StopMiddle;
} }
return (false); return false;
} }
static bool static bool
......
...@@ -812,7 +812,7 @@ sub ucs2utf ...@@ -812,7 +812,7 @@ sub ucs2utf
(((($ucs & 0x3ffff) >> 12) | 0x80) << 16) | (((($ucs & 0x3ffff) >> 12) | 0x80) << 16) |
(((($ucs & 0x0fc0) >> 6) | 0x80) << 8) | (($ucs & 0x003f) | 0x80); (((($ucs & 0x0fc0) >> 6) | 0x80) << 8) | (($ucs & 0x003f) | 0x80);
} }
return ($utf); return $utf;
} }
1; 1;
...@@ -361,14 +361,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc) ...@@ -361,14 +361,14 @@ CNStoBIG5(unsigned short cns, unsigned char lc)
for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++) for (i = 0; i < sizeof(b2c3) / (sizeof(unsigned short) * 2); i++)
{ {
if (b2c3[i][1] == cns) if (b2c3[i][1] == cns)
return (b2c3[i][0]); return b2c3[i][0];
} }
break; break;
case LC_CNS11643_4: case LC_CNS11643_4:
for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++) for (i = 0; i < sizeof(b1c4) / (sizeof(unsigned short) * 2); i++)
{ {
if (b1c4[i][1] == cns) if (b1c4[i][1] == cns)
return (b1c4[i][0]); return b1c4[i][0];
} }
default: default:
break; break;
......
...@@ -79,7 +79,7 @@ deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *)) ...@@ -79,7 +79,7 @@ deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
PGTYPESnumeric_free(a1); PGTYPESnumeric_free(a1);
PGTYPESnumeric_free(a2); PGTYPESnumeric_free(a2);
return (i); return i;
} }
static int static int
...@@ -143,7 +143,7 @@ deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, n ...@@ -143,7 +143,7 @@ deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, n
PGTYPESnumeric_free(a1); PGTYPESnumeric_free(a1);
PGTYPESnumeric_free(a2); PGTYPESnumeric_free(a2);
return (i); return i;
} }
/* we start with the numeric functions */ /* we start with the numeric functions */
...@@ -166,7 +166,7 @@ decadd(decimal *arg1, decimal *arg2, decimal *sum) ...@@ -166,7 +166,7 @@ decadd(decimal *arg1, decimal *arg2, decimal *sum)
int int
deccmp(decimal *arg1, decimal *arg2) deccmp(decimal *arg1, decimal *arg2)
{ {
return (deccall2(arg1, arg2, PGTYPESnumeric_cmp)); return deccall2(arg1, arg2, PGTYPESnumeric_cmp);
} }
void void
...@@ -261,7 +261,7 @@ deccvdbl(double dbl, decimal *np) ...@@ -261,7 +261,7 @@ deccvdbl(double dbl, decimal *np)
result = PGTYPESnumeric_to_decimal(nres, np); result = PGTYPESnumeric_to_decimal(nres, np);
PGTYPESnumeric_free(nres); PGTYPESnumeric_free(nres);
return (result); return result;
} }
int int
...@@ -283,7 +283,7 @@ deccvint(int in, decimal *np) ...@@ -283,7 +283,7 @@ deccvint(int in, decimal *np)
result = PGTYPESnumeric_to_decimal(nres, np); result = PGTYPESnumeric_to_decimal(nres, np);
PGTYPESnumeric_free(nres); PGTYPESnumeric_free(nres);
return (result); return result;
} }
int int
...@@ -305,7 +305,7 @@ deccvlong(long lng, decimal *np) ...@@ -305,7 +305,7 @@ deccvlong(long lng, decimal *np)
result = PGTYPESnumeric_to_decimal(nres, np); result = PGTYPESnumeric_to_decimal(nres, np);
PGTYPESnumeric_free(nres); PGTYPESnumeric_free(nres);
return (result); return result;
} }
int int
...@@ -598,7 +598,7 @@ rmdyjul(short mdy[3], date * d) ...@@ -598,7 +598,7 @@ rmdyjul(short mdy[3], date * d)
int int
rdayofweek(date d) rdayofweek(date d)
{ {
return (PGTYPESdate_dayofweek(d)); return PGTYPESdate_dayofweek(d);
} }
/* And the datetime stuff */ /* And the datetime stuff */
...@@ -1049,5 +1049,5 @@ rsetnull(int t, char *ptr) ...@@ -1049,5 +1049,5 @@ rsetnull(int t, char *ptr)
int int
risnull(int t, char *ptr) risnull(int t, char *ptr)
{ {
return (ECPGis_noind_null(t, ptr)); return ECPGis_noind_null(t, ptr);
} }
...@@ -67,7 +67,7 @@ ecpg_get_connection_nr(const char *connection_name) ...@@ -67,7 +67,7 @@ ecpg_get_connection_nr(const char *connection_name)
ret = con; ret = con;
} }
return (ret); return ret;
} }
struct connection * struct connection *
...@@ -106,7 +106,7 @@ ecpg_get_connection(const char *connection_name) ...@@ -106,7 +106,7 @@ ecpg_get_connection(const char *connection_name)
#endif #endif
} }
return (ret); return ret;
} }
static void static void
...@@ -168,7 +168,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name) ...@@ -168,7 +168,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
PGresult *results; PGresult *results;
if (!ecpg_init(con, connection_name, lineno)) if (!ecpg_init(con, connection_name, lineno))
return (false); return false;
ecpg_log("ECPGsetcommit on line %d: action \"%s\"; connection \"%s\"\n", lineno, mode, con->name); ecpg_log("ECPGsetcommit on line %d: action \"%s\"; connection \"%s\"\n", lineno, mode, con->name);
...@@ -204,7 +204,7 @@ ECPGsetconn(int lineno, const char *connection_name) ...@@ -204,7 +204,7 @@ ECPGsetconn(int lineno, const char *connection_name)
struct connection *con = ecpg_get_connection(connection_name); struct connection *con = ecpg_get_connection(connection_name);
if (!ecpg_init(con, connection_name, lineno)) if (!ecpg_init(con, connection_name, lineno))
return (false); return false;
#ifdef ENABLE_THREAD_SAFETY #ifdef ENABLE_THREAD_SAFETY
pthread_setspecific(actual_connection_key, con); pthread_setspecific(actual_connection_key, con);
...@@ -675,7 +675,7 @@ ECPGdisconnect(int lineno, const char *connection_name) ...@@ -675,7 +675,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
{ {
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false); return false;
} }
#ifdef ENABLE_THREAD_SAFETY #ifdef ENABLE_THREAD_SAFETY
...@@ -702,7 +702,7 @@ ECPGdisconnect(int lineno, const char *connection_name) ...@@ -702,7 +702,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
#ifdef ENABLE_THREAD_SAFETY #ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex); pthread_mutex_unlock(&connections_mutex);
#endif #endif
return (false); return false;
} }
else else
ecpg_finish(con); ecpg_finish(con);
......
...@@ -134,7 +134,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -134,7 +134,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false); return false;
} }
/* /*
...@@ -156,7 +156,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -156,7 +156,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
* at least one tuple, but let's play it safe. * at least one tuple, but let's play it safe.
*/ */
ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL); ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
return (false); return false;
} }
/* We will have to decode the value */ /* We will have to decode the value */
...@@ -204,7 +204,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -204,7 +204,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ecpg_raise(lineno, ECPG_MISSING_INDICATOR, ecpg_raise(lineno, ECPG_MISSING_INDICATOR,
ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER, ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER,
NULL); NULL);
return (false); return false;
} }
} }
break; break;
...@@ -212,12 +212,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -212,12 +212,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ecpg_raise(lineno, ECPG_UNSUPPORTED, ecpg_raise(lineno, ECPG_UNSUPPORTED,
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR,
ecpg_type_name(ind_type)); ecpg_type_name(ind_type));
return (false); return false;
break; break;
} }
if (value_for_indicator == -1) if (value_for_indicator == -1)
return (true); return true;
/* let's check if it really is an array if it should be one */ /* let's check if it really is an array if it should be one */
if (isarray == ECPG_ARRAY_ARRAY) if (isarray == ECPG_ARRAY_ARRAY)
...@@ -226,7 +226,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -226,7 +226,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_DATA_NOT_ARRAY, ecpg_raise(lineno, ECPG_DATA_NOT_ARRAY,
ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL); ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
return (false); return false;
} }
switch (type) switch (type)
...@@ -307,7 +307,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -307,7 +307,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_INT_FORMAT, ecpg_raise(lineno, ECPG_INT_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
pval = scan_length; pval = scan_length;
...@@ -336,7 +336,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -336,7 +336,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_UINT_FORMAT, ecpg_raise(lineno, ECPG_UINT_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
pval = scan_length; pval = scan_length;
...@@ -364,7 +364,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -364,7 +364,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if (garbage_left(isarray, scan_length, compat)) if (garbage_left(isarray, scan_length, compat))
{ {
ecpg_raise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ecpg_raise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
pval = scan_length; pval = scan_length;
...@@ -376,7 +376,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -376,7 +376,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if (garbage_left(isarray, scan_length, compat)) if (garbage_left(isarray, scan_length, compat))
{ {
ecpg_raise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ecpg_raise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
pval = scan_length; pval = scan_length;
...@@ -399,7 +399,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -399,7 +399,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_FLOAT_FORMAT, ecpg_raise(lineno, ECPG_FLOAT_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
pval = scan_length; pval = scan_length;
...@@ -438,7 +438,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -438,7 +438,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ecpg_raise(lineno, ECPG_CONVERT_BOOL, ecpg_raise(lineno, ECPG_CONVERT_BOOL,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
break; break;
case ECPGt_char: case ECPGt_char:
...@@ -581,14 +581,14 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -581,14 +581,14 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false); return false;
} }
} }
else else
{ {
ecpg_raise(lineno, ECPG_NUMERIC_FORMAT, ecpg_raise(lineno, ECPG_NUMERIC_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
else else
...@@ -598,7 +598,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -598,7 +598,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
free(nres); free(nres);
ecpg_raise(lineno, ECPG_NUMERIC_FORMAT, ecpg_raise(lineno, ECPG_NUMERIC_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
pval = scan_length; pval = scan_length;
...@@ -635,7 +635,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -635,7 +635,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
*/ */
ires = (interval *) ecpg_alloc(sizeof(interval), lineno); ires = (interval *) ecpg_alloc(sizeof(interval), lineno);
if (!ires) if (!ires)
return (false); return false;
ECPGset_noind_null(ECPGt_interval, ires); ECPGset_noind_null(ECPGt_interval, ires);
} }
...@@ -643,7 +643,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -643,7 +643,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_INTERVAL_FORMAT, ecpg_raise(lineno, ECPG_INTERVAL_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
else else
...@@ -656,7 +656,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -656,7 +656,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
free(ires); free(ires);
ecpg_raise(lineno, ECPG_INTERVAL_FORMAT, ecpg_raise(lineno, ECPG_INTERVAL_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
pval = scan_length; pval = scan_length;
...@@ -693,7 +693,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -693,7 +693,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_DATE_FORMAT, ecpg_raise(lineno, ECPG_DATE_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
else else
...@@ -705,7 +705,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -705,7 +705,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_DATE_FORMAT, ecpg_raise(lineno, ECPG_DATE_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
...@@ -741,7 +741,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -741,7 +741,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT, ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
else else
...@@ -753,7 +753,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -753,7 +753,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{ {
ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT, ecpg_raise(lineno, ECPG_TIMESTAMP_FORMAT,
ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false); return false;
} }
} }
...@@ -765,7 +765,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -765,7 +765,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ecpg_raise(lineno, ECPG_UNSUPPORTED, ecpg_raise(lineno, ECPG_UNSUPPORTED,
ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR,
ecpg_type_name(type)); ecpg_type_name(type));
return (false); return false;
break; break;
} }
if (ECPG_IS_ARRAY(isarray)) if (ECPG_IS_ARRAY(isarray))
...@@ -791,5 +791,5 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -791,5 +791,5 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
} }
} while (*pval != '\0' && !array_boundary(isarray, *pval)); } while (*pval != '\0' && !array_boundary(isarray, *pval));
return (true); return true;
} }
...@@ -150,10 +150,10 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value) ...@@ -150,10 +150,10 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
break; break;
default: default:
ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
return (false); return false;
} }
return (true); return true;
} }
static bool static bool
...@@ -195,7 +195,7 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype) ...@@ -195,7 +195,7 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype)
break; break;
default: default:
ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
return (false); return false;
} }
return true; return true;
...@@ -228,17 +228,17 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va ...@@ -228,17 +228,17 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
break; break;
default: default:
ecpg_raise(lineno, ECPG_VAR_NOT_CHAR, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL); ecpg_raise(lineno, ECPG_VAR_NOT_CHAR, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
return (false); return false;
} }
return (true); return true;
} }
#define RETURN_IF_NO_DATA if (ntuples < 1) \ #define RETURN_IF_NO_DATA if (ntuples < 1) \
{ \ { \
va_end(args); \ va_end(args); \
ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL); \ ecpg_raise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL); \
return (false); \ return false; \
} }
bool bool
...@@ -265,7 +265,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -265,7 +265,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!ECPGresult) if (!ECPGresult)
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ntuples = PQntuples(ECPGresult); ntuples = PQntuples(ECPGresult);
...@@ -274,7 +274,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -274,7 +274,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
{ {
ecpg_raise(lineno, ECPG_INVALID_DESCRIPTOR_INDEX, ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX, NULL); ecpg_raise(lineno, ECPG_INVALID_DESCRIPTOR_INDEX, ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX, NULL);
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: reading items for tuple %d\n", index); ecpg_log("ECPGget_desc: reading items for tuple %d\n", index);
...@@ -333,7 +333,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -333,7 +333,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_char_item(lineno, var, vartype, PQfname(ECPGresult, index), varcharsize)) if (!get_char_item(lineno, var, vartype, PQfname(ECPGresult, index), varcharsize))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: NAME = %s\n", PQfname(ECPGresult, index)); ecpg_log("ECPGget_desc: NAME = %s\n", PQfname(ECPGresult, index));
...@@ -343,7 +343,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -343,7 +343,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, 1)) if (!get_int_item(lineno, var, vartype, 1))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
break; break;
...@@ -352,7 +352,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -352,7 +352,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, 0)) if (!get_int_item(lineno, var, vartype, 0))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
break; break;
...@@ -361,7 +361,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -361,7 +361,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff)) if (!get_int_item(lineno, var, vartype, (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: SCALE = %d\n", (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff); ecpg_log("ECPGget_desc: SCALE = %d\n", (PQfmod(ECPGresult, index) - VARHDRSZ) & 0xffff);
...@@ -371,7 +371,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -371,7 +371,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) >> 16)) if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) >> 16))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: PRECISION = %d\n", PQfmod(ECPGresult, index) >> 16); ecpg_log("ECPGget_desc: PRECISION = %d\n", PQfmod(ECPGresult, index) >> 16);
...@@ -381,7 +381,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -381,7 +381,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, PQfsize(ECPGresult, index))) if (!get_int_item(lineno, var, vartype, PQfsize(ECPGresult, index)))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: OCTET_LENGTH = %d\n", PQfsize(ECPGresult, index)); ecpg_log("ECPGget_desc: OCTET_LENGTH = %d\n", PQfsize(ECPGresult, index));
...@@ -391,7 +391,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -391,7 +391,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) - VARHDRSZ)) if (!get_int_item(lineno, var, vartype, PQfmod(ECPGresult, index) - VARHDRSZ))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: LENGTH = %d\n", PQfmod(ECPGresult, index) - VARHDRSZ); ecpg_log("ECPGget_desc: LENGTH = %d\n", PQfmod(ECPGresult, index) - VARHDRSZ);
...@@ -401,7 +401,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -401,7 +401,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type(PQftype(ECPGresult, index)))) if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type(PQftype(ECPGresult, index))))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type(PQftype(ECPGresult, index))); ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type(PQftype(ECPGresult, index)));
...@@ -411,7 +411,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -411,7 +411,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type_DDT(PQftype(ECPGresult, index)))) if (!get_int_item(lineno, var, vartype, ecpg_dynamic_type_DDT(PQftype(ECPGresult, index))))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type_DDT(PQftype(ECPGresult, index))); ecpg_log("ECPGget_desc: TYPE = %d\n", ecpg_dynamic_type_DDT(PQftype(ECPGresult, index)));
...@@ -421,7 +421,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -421,7 +421,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, PQntuples(ECPGresult))) if (!get_int_item(lineno, var, vartype, PQntuples(ECPGresult)))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
ecpg_log("ECPGget_desc: CARDINALITY = %d\n", PQntuples(ECPGresult)); ecpg_log("ECPGget_desc: CARDINALITY = %d\n", PQntuples(ECPGresult));
...@@ -462,7 +462,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -462,7 +462,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index))) if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index)))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
var = (char *) var + offset; var = (char *) var + offset;
ecpg_log("ECPGget_desc: RETURNED[%d] = %d\n", act_tuple, PQgetlength(ECPGresult, act_tuple, index)); ecpg_log("ECPGget_desc: RETURNED[%d] = %d\n", act_tuple, PQgetlength(ECPGresult, act_tuple, index));
...@@ -473,7 +473,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -473,7 +473,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
snprintf(type_str, sizeof(type_str), "%d", type); snprintf(type_str, sizeof(type_str), "%d", type);
ecpg_raise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str); ecpg_raise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str);
va_end(args); va_end(args);
return (false); return false;
} }
type = va_arg(args, enum ECPGdtype); type = va_arg(args, enum ECPGdtype);
...@@ -539,7 +539,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -539,7 +539,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
if (!get_int_item(lineno, data_var.ind_value, data_var.ind_type, -PQgetisnull(ECPGresult, act_tuple, index))) if (!get_int_item(lineno, data_var.ind_value, data_var.ind_type, -PQgetisnull(ECPGresult, act_tuple, index)))
{ {
va_end(args); va_end(args);
return (false); return false;
} }
data_var.ind_value = (char *) data_var.ind_value + data_var.ind_offset; data_var.ind_value = (char *) data_var.ind_value + data_var.ind_offset;
ecpg_log("ECPGget_desc: INDICATOR[%d] = %d\n", act_tuple, -PQgetisnull(ECPGresult, act_tuple, index)); ecpg_log("ECPGget_desc: INDICATOR[%d] = %d\n", act_tuple, -PQgetisnull(ECPGresult, act_tuple, index));
...@@ -547,7 +547,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) ...@@ -547,7 +547,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
} }
sqlca->sqlerrd[2] = ntuples; sqlca->sqlerrd[2] = ntuples;
va_end(args); va_end(args);
return (true); return true;
} }
#undef RETURN_IF_NO_DATA #undef RETURN_IF_NO_DATA
......
...@@ -286,23 +286,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP ...@@ -286,23 +286,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP
{ {
ecpg_log("ecpg_check_PQresult on line %d: no result - %s", lineno, PQerrorMessage(connection)); ecpg_log("ecpg_check_PQresult on line %d: no result - %s", lineno, PQerrorMessage(connection));
ecpg_raise_backend(lineno, NULL, connection, compat); ecpg_raise_backend(lineno, NULL, connection, compat);
return (false); return false;
} }
switch (PQresultStatus(results)) switch (PQresultStatus(results))
{ {
case PGRES_TUPLES_OK: case PGRES_TUPLES_OK:
return (true); return true;
break; break;
case PGRES_EMPTY_QUERY: case PGRES_EMPTY_QUERY:
/* do nothing */ /* do nothing */
ecpg_raise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL); ecpg_raise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
PQclear(results); PQclear(results);
return (false); return false;
break; break;
case PGRES_COMMAND_OK: case PGRES_COMMAND_OK:
return (true); return true;
break; break;
case PGRES_NONFATAL_ERROR: case PGRES_NONFATAL_ERROR:
case PGRES_FATAL_ERROR: case PGRES_FATAL_ERROR:
...@@ -310,23 +310,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP ...@@ -310,23 +310,23 @@ ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMP
ecpg_log("ecpg_check_PQresult on line %d: bad response - %s", lineno, PQresultErrorMessage(results)); ecpg_log("ecpg_check_PQresult on line %d: bad response - %s", lineno, PQresultErrorMessage(results));
ecpg_raise_backend(lineno, results, connection, compat); ecpg_raise_backend(lineno, results, connection, compat);
PQclear(results); PQclear(results);
return (false); return false;
break; break;
case PGRES_COPY_OUT: case PGRES_COPY_OUT:
return (true); return true;
break; break;
case PGRES_COPY_IN: case PGRES_COPY_IN:
ecpg_log("ecpg_check_PQresult on line %d: COPY IN data transfer in progress\n", lineno); ecpg_log("ecpg_check_PQresult on line %d: COPY IN data transfer in progress\n", lineno);
PQendcopy(connection); PQendcopy(connection);
PQclear(results); PQclear(results);
return (false); return false;
break; break;
default: default:
ecpg_log("ecpg_check_PQresult on line %d: unknown execution status type\n", ecpg_log("ecpg_check_PQresult on line %d: unknown execution status type\n",
lineno); lineno);
ecpg_raise_backend(lineno, results, connection, compat); ecpg_raise_backend(lineno, results, connection, compat);
PQclear(results); PQclear(results);
return (false); return false;
break; break;
} }
} }
......
...@@ -58,7 +58,7 @@ quote_postgres(char *arg, bool quote, int lineno) ...@@ -58,7 +58,7 @@ quote_postgres(char *arg, bool quote, int lineno)
buffer_len = 2 * length + 1; buffer_len = 2 * length + 1;
res = (char *) ecpg_alloc(buffer_len + 3, lineno); res = (char *) ecpg_alloc(buffer_len + 3, lineno);
if (!res) if (!res)
return (res); return res;
escaped_len = PQescapeString(res + 1, arg, buffer_len); escaped_len = PQescapeString(res + 1, arg, buffer_len);
if (length == escaped_len) if (length == escaped_len)
{ {
...@@ -151,13 +151,13 @@ ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enu ...@@ -151,13 +151,13 @@ ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enu
= (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno); = (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno);
if (new_entry == NULL) if (new_entry == NULL)
return (false); return false;
new_entry->oid = oid; new_entry->oid = oid;
new_entry->isarray = isarray; new_entry->isarray = isarray;
new_entry->next = *cache; new_entry->next = *cache;
*cache = new_entry; *cache = new_entry;
return (true); return true;
} }
static enum ARRAY_TYPE static enum ARRAY_TYPE
...@@ -178,89 +178,89 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia ...@@ -178,89 +178,89 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia
/* populate cache with well known types to speed things up */ /* populate cache with well known types to speed things up */
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOOLOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOOLOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BYTEAOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BYTEAOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CHAROID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CHAROID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NAMEOID, not_an_array_in_ecpg, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NAMEOID, not_an_array_in_ecpg, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT8OID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT8OID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2OID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2OID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2VECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT2VECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT4OID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INT4OID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), REGPROCOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), REGPROCOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TEXTOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TEXTOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIDOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIDOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), XIDOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), XIDOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDVECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), OIDVECTOROID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POINTOID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POINTOID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LSEGOID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LSEGOID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), PATHOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), PATHOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOXOID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BOXOID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POLYGONOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), POLYGONOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LINEOID, ECPG_ARRAY_VECTOR, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), LINEOID, ECPG_ARRAY_VECTOR, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT4OID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT4OID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT8OID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), FLOAT8OID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ABSTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ABSTIMEOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), RELTIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), RELTIMEOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TINTERVALOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TINTERVALOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), UNKNOWNOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), UNKNOWNOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIRCLEOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIRCLEOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CASHOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CASHOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INETOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INETOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDROID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), CIDROID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BPCHAROID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), BPCHAROID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARCHAROID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARCHAROID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), DATEOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), DATEOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMEOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMEOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPTZOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMESTAMPTZOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INTERVALOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), INTERVALOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMETZOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), TIMETZOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ZPBITOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), ZPBITOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARBITOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), VARBITOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NUMERICOID, ECPG_ARRAY_NONE, stmt->lineno)) if (!ecpg_type_infocache_push(&(stmt->connection->cache_head), NUMERICOID, ECPG_ARRAY_NONE, stmt->lineno))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
} }
for (cache_entry = (stmt->connection->cache_head); cache_entry != NULL; cache_entry = cache_entry->next) for (cache_entry = (stmt->connection->cache_head); cache_entry != NULL; cache_entry = cache_entry->next)
...@@ -271,13 +271,13 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia ...@@ -271,13 +271,13 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia
array_query = (char *) ecpg_alloc(strlen("select typlen from pg_type where oid= and typelem<>0") + 11, stmt->lineno); array_query = (char *) ecpg_alloc(strlen("select typlen from pg_type where oid= and typelem<>0") + 11, stmt->lineno);
if (array_query == NULL) if (array_query == NULL)
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
sprintf(array_query, "select typlen from pg_type where oid=%d and typelem<>0", type); sprintf(array_query, "select typlen from pg_type where oid=%d and typelem<>0", type);
query = PQexec(stmt->connection->connection, array_query); query = PQexec(stmt->connection->connection, array_query);
ecpg_free(array_query); ecpg_free(array_query);
if (!ecpg_check_PQresult(query, stmt->lineno, stmt->connection->connection, stmt->compat)) if (!ecpg_check_PQresult(query, stmt->lineno, stmt->connection->connection, stmt->compat))
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
else if (PQresultStatus(query) == PGRES_TUPLES_OK) else if (PQresultStatus(query) == PGRES_TUPLES_OK)
{ {
if (PQntuples(query) == 0) if (PQntuples(query) == 0)
...@@ -297,7 +297,7 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia ...@@ -297,7 +297,7 @@ ecpg_is_type_an_array(int type, const struct statement *stmt, const struct varia
PQclear(query); PQclear(query);
} }
else else
return (ECPG_ARRAY_ERROR); return ECPG_ARRAY_ERROR;
ecpg_type_infocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno); ecpg_type_infocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno);
ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, ECPG_IS_ARRAY(isarray) ? "yes" : "no"); ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, ECPG_IS_ARRAY(isarray) ? "yes" : "no");
...@@ -1486,7 +1486,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result) ...@@ -1486,7 +1486,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result)
{ {
ecpg_raise(stmt->lineno, ECPG_OUT_OF_MEMORY, ecpg_raise(stmt->lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false); return false;
} }
var = stmt->outlist; var = stmt->outlist;
...@@ -1654,7 +1654,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result) ...@@ -1654,7 +1654,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result)
else if (!INFORMIX_MODE(stmt->compat)) else if (!INFORMIX_MODE(stmt->compat))
{ {
ecpg_raise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL); ecpg_raise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
return (false); return false;
} }
} }
...@@ -1830,7 +1830,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator, ...@@ -1830,7 +1830,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
{ {
ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command); ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command);
ecpg_do_epilogue(stmt); ecpg_do_epilogue(stmt);
return (false); return false;
} }
} }
......
...@@ -26,7 +26,7 @@ ecpg_alloc(long size, int lineno) ...@@ -26,7 +26,7 @@ ecpg_alloc(long size, int lineno)
return NULL; return NULL;
} }
return (new); return new;
} }
char * char *
...@@ -40,7 +40,7 @@ ecpg_realloc(void *ptr, long size, int lineno) ...@@ -40,7 +40,7 @@ ecpg_realloc(void *ptr, long size, int lineno)
return NULL; return NULL;
} }
return (new); return new;
} }
char * char *
...@@ -58,7 +58,7 @@ ecpg_strdup(const char *string, int lineno) ...@@ -58,7 +58,7 @@ ecpg_strdup(const char *string, int lineno)
return NULL; return NULL;
} }
return (new); return new;
} }
/* keep a list of memory we allocated for the user */ /* keep a list of memory we allocated for the user */
......
...@@ -110,7 +110,7 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l ...@@ -110,7 +110,7 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l
{ {
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY,
NULL); NULL);
return (false); return false;
} }
ecpg_init_sqlca(sqlca); ecpg_init_sqlca(sqlca);
...@@ -118,10 +118,10 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l ...@@ -118,10 +118,10 @@ ecpg_init(const struct connection *con, const char *connection_name, const int l
{ {
ecpg_raise(lineno, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST, ecpg_raise(lineno, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST,
connection_name ? connection_name : ecpg_gettext("NULL")); connection_name ? connection_name : ecpg_gettext("NULL"));
return (false); return false;
} }
return (true); return true;
} }
#ifdef ENABLE_THREAD_SAFETY #ifdef ENABLE_THREAD_SAFETY
...@@ -155,9 +155,9 @@ ECPGget_sqlca(void) ...@@ -155,9 +155,9 @@ ECPGget_sqlca(void)
ecpg_init_sqlca(sqlca); ecpg_init_sqlca(sqlca);
pthread_setspecific(sqlca_key, sqlca); pthread_setspecific(sqlca_key, sqlca);
} }
return (sqlca); return sqlca;
#else #else
return (&sqlca); return &sqlca;
#endif #endif
} }
...@@ -167,7 +167,7 @@ ECPGstatus(int lineno, const char *connection_name) ...@@ -167,7 +167,7 @@ ECPGstatus(int lineno, const char *connection_name)
struct connection *con = ecpg_get_connection(connection_name); struct connection *con = ecpg_get_connection(connection_name);
if (!ecpg_init(con, connection_name, lineno)) if (!ecpg_init(con, connection_name, lineno))
return (false); return false;
/* are we connected? */ /* are we connected? */
if (con->connection == NULL) if (con->connection == NULL)
...@@ -176,7 +176,7 @@ ECPGstatus(int lineno, const char *connection_name) ...@@ -176,7 +176,7 @@ ECPGstatus(int lineno, const char *connection_name)
return false; return false;
} }
return (true); return true;
} }
PGTransactionStatusType PGTransactionStatusType
...@@ -202,7 +202,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction) ...@@ -202,7 +202,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
struct connection *con = ecpg_get_connection(connection_name); struct connection *con = ecpg_get_connection(connection_name);
if (!ecpg_init(con, connection_name, lineno)) if (!ecpg_init(con, connection_name, lineno))
return (false); return false;
ecpg_log("ECPGtrans on line %d: action \"%s\"; connection \"%s\"\n", lineno, transaction, con ? con->name : "null"); ecpg_log("ECPGtrans on line %d: action \"%s\"; connection \"%s\"\n", lineno, transaction, con ? con->name : "null");
...@@ -419,10 +419,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) ...@@ -419,10 +419,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
break; break;
#endif /* HAVE_LONG_LONG_INT */ #endif /* HAVE_LONG_LONG_INT */
case ECPGt_float: case ECPGt_float:
return (_check(ptr, sizeof(float))); return _check(ptr, sizeof(float));
break; break;
case ECPGt_double: case ECPGt_double:
return (_check(ptr, sizeof(double))); return _check(ptr, sizeof(double));
break; break;
case ECPGt_varchar: case ECPGt_varchar:
if (*(((struct ECPGgeneric_varchar *) ptr)->arr) == 0x00) if (*(((struct ECPGgeneric_varchar *) ptr)->arr) == 0x00)
...@@ -437,10 +437,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) ...@@ -437,10 +437,10 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
return true; return true;
break; break;
case ECPGt_interval: case ECPGt_interval:
return (_check(ptr, sizeof(interval))); return _check(ptr, sizeof(interval));
break; break;
case ECPGt_timestamp: case ECPGt_timestamp:
return (_check(ptr, sizeof(timestamp))); return _check(ptr, sizeof(timestamp));
break; break;
default: default:
break; break;
......
...@@ -42,7 +42,7 @@ isvarchar(unsigned char c) ...@@ -42,7 +42,7 @@ isvarchar(unsigned char c)
if (c >= 128) if (c >= 128)
return true; return true;
return (false); return false;
} }
static bool static bool
...@@ -371,7 +371,7 @@ SearchStmtCache(const char *ecpgQuery) ...@@ -371,7 +371,7 @@ SearchStmtCache(const char *ecpgQuery)
if (entIx >= stmtCacheEntPerBucket) if (entIx >= stmtCacheEntPerBucket)
entNo = 0; entNo = 0;
return (entNo); return entNo;
} }
/* /*
...@@ -389,14 +389,14 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ ...@@ -389,14 +389,14 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */
entry = &stmtCacheEntries[entNo]; entry = &stmtCacheEntries[entNo];
if (!entry->stmtID[0]) /* return if the entry isn't in use */ if (!entry->stmtID[0]) /* return if the entry isn't in use */
return (0); return 0;
con = ecpg_get_connection(entry->connection); con = ecpg_get_connection(entry->connection);
/* free the 'prepared_statement' list entry */ /* free the 'prepared_statement' list entry */
this = ecpg_find_prepared_statement(entry->stmtID, con, &prev); this = ecpg_find_prepared_statement(entry->stmtID, con, &prev);
if (this && !deallocate_one(lineno, compat, con, prev, this)) if (this && !deallocate_one(lineno, compat, con, prev, this))
return (-1); return -1;
entry->stmtID[0] = '\0'; entry->stmtID[0] = '\0';
...@@ -407,7 +407,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ ...@@ -407,7 +407,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */
entry->ecpgQuery = 0; entry->ecpgQuery = 0;
} }
return (entNo); return entNo;
} }
/* /*
...@@ -450,7 +450,7 @@ AddStmtToCache(int lineno, /* line # of statement */ ...@@ -450,7 +450,7 @@ AddStmtToCache(int lineno, /* line # of statement */
/* 'entNo' is the entry to use - make sure its free */ /* 'entNo' is the entry to use - make sure its free */
if (ecpg_freeStmtCacheEntry(lineno, compat, entNo) < 0) if (ecpg_freeStmtCacheEntry(lineno, compat, entNo) < 0)
return (-1); return -1;
/* add the query to the entry */ /* add the query to the entry */
entry = &stmtCacheEntries[entNo]; entry = &stmtCacheEntries[entNo];
...@@ -460,7 +460,7 @@ AddStmtToCache(int lineno, /* line # of statement */ ...@@ -460,7 +460,7 @@ AddStmtToCache(int lineno, /* line # of statement */
entry->execs = 0; entry->execs = 0;
memcpy(entry->stmtID, stmtID, sizeof(entry->stmtID)); memcpy(entry->stmtID, stmtID, sizeof(entry->stmtID));
return (entNo); return entNo;
} }
/* handle cache and preparation of statements in auto-prepare mode */ /* handle cache and preparation of statements in auto-prepare mode */
...@@ -487,7 +487,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha ...@@ -487,7 +487,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha
prep = ecpg_find_prepared_statement(stmtID, con, NULL); prep = ecpg_find_prepared_statement(stmtID, con, NULL);
/* This prepared name doesn't exist on this connection. */ /* This prepared name doesn't exist on this connection. */
if (!prep && !prepare_common(lineno, con, stmtID, query)) if (!prep && !prepare_common(lineno, con, stmtID, query))
return (false); return false;
*name = ecpg_strdup(stmtID, lineno); *name = ecpg_strdup(stmtID, lineno);
} }
...@@ -501,9 +501,9 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha ...@@ -501,9 +501,9 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha
sprintf(stmtID, "ecpg%d", nextStmtID++); sprintf(stmtID, "ecpg%d", nextStmtID++);
if (!ECPGprepare(lineno, connection_name, 0, stmtID, query)) if (!ECPGprepare(lineno, connection_name, 0, stmtID, query))
return (false); return false;
if (AddStmtToCache(lineno, stmtID, connection_name, compat, query) < 0) if (AddStmtToCache(lineno, stmtID, connection_name, compat, query) < 0)
return (false); return false;
*name = ecpg_strdup(stmtID, lineno); *name = ecpg_strdup(stmtID, lineno);
} }
...@@ -511,5 +511,5 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha ...@@ -511,5 +511,5 @@ ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, cha
/* increase usage counter */ /* increase usage counter */
stmtCacheEntries[entNo].execs++; stmtCacheEntries[entNo].execs++;
return (true); return true;
} }
...@@ -12,7 +12,7 @@ pgtypes_alloc(long size) ...@@ -12,7 +12,7 @@ pgtypes_alloc(long size)
if (!new) if (!new)
errno = ENOMEM; errno = ENOMEM;
return (new); return new;
} }
char * char *
...@@ -22,7 +22,7 @@ pgtypes_strdup(const char *str) ...@@ -22,7 +22,7 @@ pgtypes_strdup(const char *str)
if (!new) if (!new)
errno = ENOMEM; errno = ENOMEM;
return (new); return new;
} }
int int
......
...@@ -40,7 +40,7 @@ apply_typmod(numeric *var, long typmod) ...@@ -40,7 +40,7 @@ apply_typmod(numeric *var, long typmod)
/* Do nothing if we have a default typmod (-1) */ /* Do nothing if we have a default typmod (-1) */
if (typmod < (long) (VARHDRSZ)) if (typmod < (long) (VARHDRSZ))
return (0); return 0;
typmod -= VARHDRSZ; typmod -= VARHDRSZ;
precision = (typmod >> 16) & 0xffff; precision = (typmod >> 16) & 0xffff;
...@@ -100,7 +100,7 @@ apply_typmod(numeric *var, long typmod) ...@@ -100,7 +100,7 @@ apply_typmod(numeric *var, long typmod)
var->rscale = scale; var->rscale = scale;
var->dscale = scale; var->dscale = scale;
return (0); return 0;
} }
#endif #endif
...@@ -296,7 +296,7 @@ set_var_from_str(char *str, char **ptr, numeric *dest) ...@@ -296,7 +296,7 @@ set_var_from_str(char *str, char **ptr, numeric *dest)
dest->weight = 0; dest->weight = 0;
dest->rscale = dest->dscale; dest->rscale = dest->dscale;
return (0); return 0;
} }
...@@ -412,16 +412,16 @@ PGTYPESnumeric_from_asc(char *str, char **endptr) ...@@ -412,16 +412,16 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
char **ptr = (endptr != NULL) ? endptr : &realptr; char **ptr = (endptr != NULL) ? endptr : &realptr;
if (!value) if (!value)
return (NULL); return NULL;
ret = set_var_from_str(str, ptr, value); ret = set_var_from_str(str, ptr, value);
if (ret) if (ret)
{ {
PGTYPESnumeric_free(value); PGTYPESnumeric_free(value);
return (NULL); return NULL;
} }
return (value); return value;
} }
char * char *
...@@ -445,7 +445,7 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale) ...@@ -445,7 +445,7 @@ PGTYPESnumeric_to_asc(numeric *num, int dscale)
/* get_str_from_var may change its argument */ /* get_str_from_var may change its argument */
s = get_str_from_var(numcopy, dscale); s = get_str_from_var(numcopy, dscale);
PGTYPESnumeric_free(numcopy); PGTYPESnumeric_free(numcopy);
return (s); return s;
} }
/* ---------- /* ----------
......
...@@ -224,14 +224,14 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) ...@@ -224,14 +224,14 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
if (strlen(str) > MAXDATELEN) if (strlen(str) > MAXDATELEN)
{ {
errno = PGTYPES_TS_BAD_TIMESTAMP; errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult); return noresult;
} }
if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 || if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 ||
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0) DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0)
{ {
errno = PGTYPES_TS_BAD_TIMESTAMP; errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult); return noresult;
} }
switch (dtype) switch (dtype)
...@@ -240,7 +240,7 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) ...@@ -240,7 +240,7 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
if (tm2timestamp(tm, fsec, NULL, &result) != 0) if (tm2timestamp(tm, fsec, NULL, &result) != 0)
{ {
errno = PGTYPES_TS_BAD_TIMESTAMP; errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult); return noresult;
} }
break; break;
...@@ -258,11 +258,11 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr) ...@@ -258,11 +258,11 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
case DTK_INVALID: case DTK_INVALID:
errno = PGTYPES_TS_BAD_TIMESTAMP; errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult); return noresult;
default: default:
errno = PGTYPES_TS_BAD_TIMESTAMP; errno = PGTYPES_TS_BAD_TIMESTAMP;
return (noresult); return noresult;
} }
/* AdjustTimestampForTypmod(&result, typmod); */ /* AdjustTimestampForTypmod(&result, typmod); */
......
...@@ -137,7 +137,7 @@ main(int argc, char *const argv[]) ...@@ -137,7 +137,7 @@ main(int argc, char *const argv[])
if (find_my_exec(argv[0], my_exec_path) < 0) if (find_my_exec(argv[0], my_exec_path) < 0)
{ {
fprintf(stderr, _("%s: could not locate my own executable path\n"), argv[0]); fprintf(stderr, _("%s: could not locate my own executable path\n"), argv[0]);
return (ILLEGAL_OPTION); return ILLEGAL_OPTION;
} }
if (argc > 1) if (argc > 1)
...@@ -266,7 +266,7 @@ main(int argc, char *const argv[]) ...@@ -266,7 +266,7 @@ main(int argc, char *const argv[])
{ {
fprintf(stderr, _("%s: no input files specified\n"), progname); fprintf(stderr, _("%s: no input files specified\n"), progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), argv[0]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), argv[0]);
return (ILLEGAL_OPTION); return ILLEGAL_OPTION;
} }
else else
{ {
......
...@@ -142,7 +142,7 @@ cat2_str(char *str1, char *str2) ...@@ -142,7 +142,7 @@ cat2_str(char *str1, char *str2)
strcat(res_str, str2); strcat(res_str, str2);
free(str1); free(str1);
free(str2); free(str2);
return(res_str); return res_str;
} }
static char * static char *
...@@ -162,7 +162,7 @@ cat_str(int count, ...) ...@@ -162,7 +162,7 @@ cat_str(int count, ...)
va_end(args); va_end(args);
return(res_str); return res_str;
} }
static char * static char *
...@@ -174,7 +174,7 @@ make2_str(char *str1, char *str2) ...@@ -174,7 +174,7 @@ make2_str(char *str1, char *str2)
strcat(res_str, str2); strcat(res_str, str2);
free(str1); free(str1);
free(str2); free(str2);
return(res_str); return res_str;
} }
static char * static char *
...@@ -188,7 +188,7 @@ make3_str(char *str1, char *str2, char *str3) ...@@ -188,7 +188,7 @@ make3_str(char *str1, char *str2, char *str3)
free(str1); free(str1);
free(str2); free(str2);
free(str3); free(str3);
return(res_str); return res_str;
} }
/* and the rest */ /* and the rest */
...@@ -233,7 +233,7 @@ create_questionmarks(char *name, bool array) ...@@ -233,7 +233,7 @@ create_questionmarks(char *name, bool array)
/* removed the trailing " ," */ /* removed the trailing " ," */
result[strlen(result)-3] = '\0'; result[strlen(result)-3] = '\0';
return(result); return result;
} }
static char * static char *
......
...@@ -768,7 +768,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -768,7 +768,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
} }
<SQL>:{identifier}((("->"|\.){identifier})|(\[{array}\]))* { <SQL>:{identifier}((("->"|\.){identifier})|(\[{array}\]))* {
base_yylval.str = mm_strdup(yytext+1); base_yylval.str = mm_strdup(yytext+1);
return(CVARIABLE); return CVARIABLE;
} }
<SQL>{identifier} { <SQL>{identifier} {
const ScanKeyword *keyword; const ScanKeyword *keyword;
...@@ -832,7 +832,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -832,7 +832,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
base_yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return CPP_LINE;
} }
} }
<C>{cppinclude_next} { <C>{cppinclude_next} {
...@@ -844,12 +844,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -844,12 +844,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
base_yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return CPP_LINE;
} }
} }
<C,SQL>{cppline} { <C,SQL>{cppline} {
base_yylval.str = mm_strdup(yytext); base_yylval.str = mm_strdup(yytext);
return(CPP_LINE); return CPP_LINE;
} }
<C>{identifier} { <C>{identifier} {
const ScanKeyword *keyword; const ScanKeyword *keyword;
...@@ -879,38 +879,38 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -879,38 +879,38 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
} }
} }
<C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); } <C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); }
<C>":" { return(':'); } <C>":" { return ':'; }
<C>";" { return(';'); } <C>";" { return ';'; }
<C>"," { return(','); } <C>"," { return ','; }
<C>"*" { return('*'); } <C>"*" { return '*'; }
<C>"%" { return('%'); } <C>"%" { return '%'; }
<C>"/" { return('/'); } <C>"/" { return '/'; }
<C>"+" { return('+'); } <C>"+" { return '+'; }
<C>"-" { return('-'); } <C>"-" { return '-'; }
<C>"(" { parenths_open++; return('('); } <C>"(" { parenths_open++; return '('; }
<C>")" { parenths_open--; return(')'); } <C>")" { parenths_open--; return ')'; }
<C,xskip>{space} { ECHO; } <C,xskip>{space} { ECHO; }
<C>\{ { return('{'); } <C>\{ { return '{'; }
<C>\} { return('}'); } <C>\} { return '}'; }
<C>\[ { return('['); } <C>\[ { return '['; }
<C>\] { return(']'); } <C>\] { return ']'; }
<C>\= { return('='); } <C>\= { return '='; }
<C>"->" { return(S_MEMBER); } <C>"->" { return S_MEMBER; }
<C>">>" { return(S_RSHIFT); } <C>">>" { return S_RSHIFT; }
<C>"<<" { return(S_LSHIFT); } <C>"<<" { return S_LSHIFT; }
<C>"||" { return(S_OR); } <C>"||" { return S_OR; }
<C>"&&" { return(S_AND); } <C>"&&" { return S_AND; }
<C>"++" { return(S_INC); } <C>"++" { return S_INC; }
<C>"--" { return(S_DEC); } <C>"--" { return S_DEC; }
<C>"==" { return(S_EQUAL); } <C>"==" { return S_EQUAL; }
<C>"!=" { return(S_NEQUAL); } <C>"!=" { return S_NEQUAL; }
<C>"+=" { return(S_ADD); } <C>"+=" { return S_ADD; }
<C>"-=" { return(S_SUB); } <C>"-=" { return S_SUB; }
<C>"*=" { return(S_MUL); } <C>"*=" { return S_MUL; }
<C>"/=" { return(S_DIV); } <C>"/=" { return S_DIV; }
<C>"%=" { return(S_MOD); } <C>"%=" { return S_MOD; }
<C>"->*" { return(S_MEMPOINT); } <C>"->*" { return S_MEMPOINT; }
<C>".*" { return(S_DOTPOINT); } <C>".*" { return S_DOTPOINT; }
<C>{other} { return S_ANYTHING; } <C>{other} { return S_ANYTHING; }
<C>{exec_sql}{define}{space}* { BEGIN(def_ident); } <C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
<C>{informix_special}{define}{space}* { <C>{informix_special}{define}{space}* {
...@@ -922,7 +922,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -922,7 +922,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<C>{exec_sql}{undef}{space}* { BEGIN(undef); } <C>{exec_sql}{undef}{space}* { BEGIN(undef); }
...@@ -935,7 +935,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -935,7 +935,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<undef>{identifier}{space}*";" { <undef>{identifier}{space}*";" {
...@@ -984,7 +984,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -984,7 +984,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); } <C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
...@@ -998,7 +998,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -998,7 +998,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); } <C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
...@@ -1012,7 +1012,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -1012,7 +1012,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<C,xskip>{exec_sql}{elif}{space}* { /* pop stack */ <C,xskip>{exec_sql}{elif}{space}* { /* pop stack */
...@@ -1043,7 +1043,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -1043,7 +1043,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
...@@ -1085,7 +1085,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -1085,7 +1085,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
<C,xskip>{exec_sql}{endif}{space}*";" { <C,xskip>{exec_sql}{endif}{space}*";" {
...@@ -1116,7 +1116,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ ...@@ -1116,7 +1116,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
else else
{ {
yyless(1); yyless(1);
return (S_ANYTHING); return S_ANYTHING;
} }
} }
......
...@@ -69,7 +69,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member *rm) ...@@ -69,7 +69,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member *rm)
rm = rm->next; rm = rm->next;
} }
return (new); return new;
} }
/* The NAME argument is copied. The type argument is preserved as a pointer. */ /* The NAME argument is copied. The type argument is preserved as a pointer. */
...@@ -135,78 +135,78 @@ get_type(enum ECPGttype type) ...@@ -135,78 +135,78 @@ get_type(enum ECPGttype type)
switch (type) switch (type)
{ {
case ECPGt_char: case ECPGt_char:
return ("ECPGt_char"); return "ECPGt_char";
break; break;
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
return ("ECPGt_unsigned_char"); return "ECPGt_unsigned_char";
break; break;
case ECPGt_short: case ECPGt_short:
return ("ECPGt_short"); return "ECPGt_short";
break; break;
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
return ("ECPGt_unsigned_short"); return "ECPGt_unsigned_short";
break; break;
case ECPGt_int: case ECPGt_int:
return ("ECPGt_int"); return "ECPGt_int";
break; break;
case ECPGt_unsigned_int: case ECPGt_unsigned_int:
return ("ECPGt_unsigned_int"); return "ECPGt_unsigned_int";
break; break;
case ECPGt_long: case ECPGt_long:
return ("ECPGt_long"); return "ECPGt_long";
break; break;
case ECPGt_unsigned_long: case ECPGt_unsigned_long:
return ("ECPGt_unsigned_long"); return "ECPGt_unsigned_long";
break; break;
case ECPGt_long_long: case ECPGt_long_long:
return ("ECPGt_long_long"); return "ECPGt_long_long";
break; break;
case ECPGt_unsigned_long_long: case ECPGt_unsigned_long_long:
return ("ECPGt_unsigned_long_long"); return "ECPGt_unsigned_long_long";
break; break;
case ECPGt_float: case ECPGt_float:
return ("ECPGt_float"); return "ECPGt_float";
break; break;
case ECPGt_double: case ECPGt_double:
return ("ECPGt_double"); return "ECPGt_double";
break; break;
case ECPGt_bool: case ECPGt_bool:
return ("ECPGt_bool"); return "ECPGt_bool";
break; break;
case ECPGt_varchar: case ECPGt_varchar:
return ("ECPGt_varchar"); return "ECPGt_varchar";
case ECPGt_NO_INDICATOR: /* no indicator */ case ECPGt_NO_INDICATOR: /* no indicator */
return ("ECPGt_NO_INDICATOR"); return "ECPGt_NO_INDICATOR";
break; break;
case ECPGt_char_variable: /* string that should not be quoted */ case ECPGt_char_variable: /* string that should not be quoted */
return ("ECPGt_char_variable"); return "ECPGt_char_variable";
break; break;
case ECPGt_const: /* constant string quoted */ case ECPGt_const: /* constant string quoted */
return ("ECPGt_const"); return "ECPGt_const";
break; break;
case ECPGt_decimal: case ECPGt_decimal:
return ("ECPGt_decimal"); return "ECPGt_decimal";
break; break;
case ECPGt_numeric: case ECPGt_numeric:
return ("ECPGt_numeric"); return "ECPGt_numeric";
break; break;
case ECPGt_interval: case ECPGt_interval:
return ("ECPGt_interval"); return "ECPGt_interval";
break; break;
case ECPGt_descriptor: case ECPGt_descriptor:
return ("ECPGt_descriptor"); return "ECPGt_descriptor";
break; break;
case ECPGt_sqlda: case ECPGt_sqlda:
return ("ECPGt_sqlda"); return "ECPGt_sqlda";
break; break;
case ECPGt_date: case ECPGt_date:
return ("ECPGt_date"); return "ECPGt_date";
break; break;
case ECPGt_timestamp: case ECPGt_timestamp:
return ("ECPGt_timestamp"); return "ECPGt_timestamp";
break; break;
case ECPGt_string: case ECPGt_string:
return ("ECPGt_string"); return "ECPGt_string";
break; break;
default: default:
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type); mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type);
...@@ -674,51 +674,51 @@ get_dtype(enum ECPGdtype type) ...@@ -674,51 +674,51 @@ get_dtype(enum ECPGdtype type)
switch (type) switch (type)
{ {
case ECPGd_count: case ECPGd_count:
return ("ECPGd_countr"); return "ECPGd_countr";
break; break;
case ECPGd_data: case ECPGd_data:
return ("ECPGd_data"); return "ECPGd_data";
break; break;
case ECPGd_di_code: case ECPGd_di_code:
return ("ECPGd_di_code"); return "ECPGd_di_code";
break; break;
case ECPGd_di_precision: case ECPGd_di_precision:
return ("ECPGd_di_precision"); return "ECPGd_di_precision";
break; break;
case ECPGd_indicator: case ECPGd_indicator:
return ("ECPGd_indicator"); return "ECPGd_indicator";
break; break;
case ECPGd_key_member: case ECPGd_key_member:
return ("ECPGd_key_member"); return "ECPGd_key_member";
break; break;
case ECPGd_length: case ECPGd_length:
return ("ECPGd_length"); return "ECPGd_length";
break; break;
case ECPGd_name: case ECPGd_name:
return ("ECPGd_name"); return "ECPGd_name";
break; break;
case ECPGd_nullable: case ECPGd_nullable:
return ("ECPGd_nullable"); return "ECPGd_nullable";
break; break;
case ECPGd_octet: case ECPGd_octet:
return ("ECPGd_octet"); return "ECPGd_octet";
break; break;
case ECPGd_precision: case ECPGd_precision:
return ("ECPGd_precision"); return "ECPGd_precision";
break; break;
case ECPGd_ret_length: case ECPGd_ret_length:
return ("ECPGd_ret_length"); return "ECPGd_ret_length";
case ECPGd_ret_octet: case ECPGd_ret_octet:
return ("ECPGd_ret_octet"); return "ECPGd_ret_octet";
break; break;
case ECPGd_scale: case ECPGd_scale:
return ("ECPGd_scale"); return "ECPGd_scale";
break; break;
case ECPGd_type: case ECPGd_type:
return ("ECPGd_type"); return "ECPGd_type";
break; break;
case ECPGd_cardinality: case ECPGd_cardinality:
return ("ECPGd_cardinality"); return "ECPGd_cardinality";
default: default:
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized descriptor item code %d", type); mmerror(PARSE_ERROR, ET_ERROR, "unrecognized descriptor item code %d", type);
} }
......
...@@ -18,7 +18,7 @@ new_variable(const char *name, struct ECPGtype *type, int brace_level) ...@@ -18,7 +18,7 @@ new_variable(const char *name, struct ECPGtype *type, int brace_level)
p->next = allvariables; p->next = allvariables;
allvariables = p; allvariables = p;
return (p); return p;
} }
static struct variable * static struct variable *
...@@ -44,12 +44,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int ...@@ -44,12 +44,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int
switch (members->type->type) switch (members->type->type)
{ {
case ECPGt_array: case ECPGt_array:
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), members->type->size), brace_level)); return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), members->type->size), brace_level);
case ECPGt_struct: case ECPGt_struct:
case ECPGt_union: case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level)); return new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level);
default: default:
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->counter), brace_level)); return new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->counter), brace_level);
} }
} }
else else
...@@ -91,26 +91,26 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int ...@@ -91,26 +91,26 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int
switch (members->type->u.element->type) switch (members->type->u.element->type)
{ {
case ECPGt_array: case ECPGt_array:
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->counter), members->type->u.element->size), brace_level)); return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->counter), members->type->u.element->size), brace_level);
case ECPGt_struct: case ECPGt_struct:
case ECPGt_union: case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level)); return new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level);
default: default:
return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), brace_level)); return new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), brace_level);
} }
break; break;
case '-': case '-':
if (members->type->type == ECPGt_array) if (members->type->type == ECPGt_array)
return (find_struct_member(name, ++end, members->type->u.element->u.members, brace_level)); return find_struct_member(name, ++end, members->type->u.element->u.members, brace_level);
else else
return (find_struct_member(name, ++end, members->type->u.members, brace_level)); return find_struct_member(name, ++end, members->type->u.members, brace_level);
break; break;
break; break;
case '.': case '.':
if (members->type->type == ECPGt_array) if (members->type->type == ECPGt_array)
return (find_struct_member(name, end, members->type->u.element->u.members, brace_level)); return find_struct_member(name, end, members->type->u.element->u.members, brace_level);
else else
return (find_struct_member(name, end, members->type->u.members, brace_level)); return find_struct_member(name, end, members->type->u.members, brace_level);
break; break;
default: default:
mmfatal(PARSE_ERROR, "incorrectly formed variable \"%s\"", name); mmfatal(PARSE_ERROR, "incorrectly formed variable \"%s\"", name);
...@@ -120,7 +120,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int ...@@ -120,7 +120,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int
} }
} }
return (NULL); return NULL;
} }
static struct variable * static struct variable *
...@@ -185,7 +185,7 @@ find_simple(char *name) ...@@ -185,7 +185,7 @@ find_simple(char *name)
return p; return p;
} }
return (NULL); return NULL;
} }
/* Note that this function will end the program in case of an unknown */ /* Note that this function will end the program in case of an unknown */
...@@ -236,12 +236,12 @@ find_variable(char *name) ...@@ -236,12 +236,12 @@ find_variable(char *name)
switch (p->type->u.element->type) switch (p->type->u.element->type)
{ {
case ECPGt_array: case ECPGt_array:
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->counter), p->type->u.element->size), p->brace_level)); return new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->counter), p->type->u.element->size), p->brace_level);
case ECPGt_struct: case ECPGt_struct:
case ECPGt_union: case ECPGt_union:
return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level)); return new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level);
default: default:
return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->counter), p->brace_level)); return new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->counter), p->brace_level);
} }
} }
} }
...@@ -254,7 +254,7 @@ find_variable(char *name) ...@@ -254,7 +254,7 @@ find_variable(char *name)
if (p == NULL) if (p == NULL)
mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name); mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name);
return (p); return p;
} }
void void
...@@ -505,7 +505,7 @@ get_typedef(char *name) ...@@ -505,7 +505,7 @@ get_typedef(char *name)
if (!this) if (!this)
mmfatal(PARSE_ERROR, "unrecognized data type name \"%s\"", name); mmfatal(PARSE_ERROR, "unrecognized data type name \"%s\"", name);
return (this); return this;
} }
void void
......
...@@ -206,7 +206,7 @@ main(void) ...@@ -206,7 +206,7 @@ main(void)
} }
free(decarr); free(decarr);
return (0); return 0;
} }
static void static void
......
...@@ -195,5 +195,5 @@ exec sql end declare section; ...@@ -195,5 +195,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -147,7 +147,7 @@ main(void) ...@@ -147,7 +147,7 @@ main(void)
/* ECPG_INFORMIX_BAD_YEAR */ /* ECPG_INFORMIX_BAD_YEAR */
/* ??? */ /* ??? */
return (0); return 0;
} }
static void static void
......
...@@ -45,7 +45,7 @@ main(void) ...@@ -45,7 +45,7 @@ main(void)
fmtlong(-8494493, "abc: ################+-+"); fmtlong(-8494493, "abc: ################+-+");
fmtlong(-8494493, "+<<<<,<<<,<<<,<<<"); fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
return (0); return 0;
} }
static void static void
......
...@@ -246,5 +246,5 @@ exec sql end declare section; ...@@ -246,5 +246,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -61,5 +61,5 @@ exec sql end declare section; ...@@ -61,5 +61,5 @@ exec sql end declare section;
exec sql connect to unix:postgresql://localhost/ecpg2_regression user regress_ecpg_user1 identified by "wrongpw"; exec sql connect to unix:postgresql://localhost/ecpg2_regression user regress_ecpg_user1 identified by "wrongpw";
/* no disconnect necessary */ /* no disconnect necessary */
return (0); return 0;
} }
...@@ -42,5 +42,5 @@ exec sql end declare section; ...@@ -42,5 +42,5 @@ exec sql end declare section;
/* disconnect from "second" */ /* disconnect from "second" */
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -48,5 +48,5 @@ exec sql end declare section; ...@@ -48,5 +48,5 @@ exec sql end declare section;
* are used in other tests * are used in other tests
*/ */
return (0); return 0;
} }
...@@ -16,5 +16,5 @@ main(void) ...@@ -16,5 +16,5 @@ main(void)
exec sql disconnect DEFAULT; exec sql disconnect DEFAULT;
return (0); return 0;
} }
...@@ -72,5 +72,5 @@ exec sql end declare section; ...@@ -72,5 +72,5 @@ exec sql end declare section;
/* not connected */ /* not connected */
exec sql disconnect nonexistant; exec sql disconnect nonexistant;
return (0); return 0;
} }
...@@ -226,7 +226,7 @@ main(void) ...@@ -226,7 +226,7 @@ main(void)
} }
free(decarr); free(decarr);
return (0); return 0;
} }
static void static void
......
...@@ -463,5 +463,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -463,5 +463,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 196 "describe.pgc" #line 196 "describe.pgc"
return (0); return 0;
} }
...@@ -158,7 +158,7 @@ main(void) ...@@ -158,7 +158,7 @@ main(void)
/* ECPG_INFORMIX_BAD_YEAR */ /* ECPG_INFORMIX_BAD_YEAR */
/* ??? */ /* ??? */
return (0); return 0;
} }
static void static void
......
...@@ -56,7 +56,7 @@ main(void) ...@@ -56,7 +56,7 @@ main(void)
fmtlong(-8494493, "abc: ################+-+"); fmtlong(-8494493, "abc: ################+-+");
fmtlong(-8494493, "+<<<<,<<<,<<<,<<<"); fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
return (0); return 0;
} }
static void static void
......
...@@ -526,5 +526,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -526,5 +526,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 247 "sqlda.pgc" #line 247 "sqlda.pgc"
return (0); return 0;
} }
...@@ -120,5 +120,5 @@ main(void) ...@@ -120,5 +120,5 @@ main(void)
/* no disconnect necessary */ /* no disconnect necessary */
return (0); return 0;
} }
...@@ -100,5 +100,5 @@ main(void) ...@@ -100,5 +100,5 @@ main(void)
#line 43 "test2.pgc" #line 43 "test2.pgc"
return (0); return 0;
} }
...@@ -102,5 +102,5 @@ main(void) ...@@ -102,5 +102,5 @@ main(void)
* are used in other tests * are used in other tests
*/ */
return (0); return 0;
} }
...@@ -40,5 +40,5 @@ main(void) ...@@ -40,5 +40,5 @@ main(void)
#line 17 "test4.pgc" #line 17 "test4.pgc"
return (0); return 0;
} }
...@@ -158,5 +158,5 @@ main(void) ...@@ -158,5 +158,5 @@ main(void)
#line 73 "test5.pgc" #line 73 "test5.pgc"
return (0); return 0;
} }
...@@ -449,5 +449,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );} ...@@ -449,5 +449,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
#line 366 "dt_test.pgc" #line 366 "dt_test.pgc"
return (0); return 0;
} }
...@@ -182,5 +182,5 @@ main(void) ...@@ -182,5 +182,5 @@ main(void)
PGTYPESinterval_free(i1); PGTYPESinterval_free(i1);
} }
return (0); return 0;
} }
...@@ -269,5 +269,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );} ...@@ -269,5 +269,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
#line 91 "nan_test.pgc" #line 91 "nan_test.pgc"
return (0); return 0;
} }
...@@ -157,5 +157,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );} ...@@ -157,5 +157,5 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
#line 94 "num_test.pgc" #line 94 "num_test.pgc"
return (0); return 0;
} }
...@@ -228,7 +228,7 @@ main(void) ...@@ -228,7 +228,7 @@ main(void)
} }
free(numarr); free(numarr);
return (0); return 0;
} }
static void static void
......
...@@ -284,5 +284,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -284,5 +284,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 92 "array_of_struct.pgc" #line 92 "array_of_struct.pgc"
return( 0 ); return 0;
} }
...@@ -830,5 +830,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -830,5 +830,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 253 "cursor.pgc" #line 253 "cursor.pgc"
return (0); return 0;
} }
...@@ -164,5 +164,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -164,5 +164,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 59 "define.pgc" #line 59 "define.pgc"
return (0); return 0;
} }
...@@ -477,5 +477,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -477,5 +477,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 144 "describe.pgc" #line 144 "describe.pgc"
return (0); return 0;
} }
...@@ -374,5 +374,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -374,5 +374,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 124 "outofscope.pgc" #line 124 "outofscope.pgc"
return (0); return 0;
} }
...@@ -289,5 +289,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -289,5 +289,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* All the memory will anyway be freed at the end */ /* All the memory will anyway be freed at the end */
return( 0 ); return 0;
} }
...@@ -66,5 +66,5 @@ int main(void) ...@@ -66,5 +66,5 @@ int main(void)
{ ECPGdisconnect(__LINE__, "CURRENT");} { ECPGdisconnect(__LINE__, "CURRENT");}
#line 25 "strings.pgc" #line 25 "strings.pgc"
return (0); return 0;
} }
...@@ -272,5 +272,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -272,5 +272,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 98 "variable.pgc" #line 98 "variable.pgc"
return (0); return 0;
} }
...@@ -351,5 +351,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -351,5 +351,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
free(t); free(t);
return (0); return 0;
} }
...@@ -461,5 +461,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -461,5 +461,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 196 "describe.pgc" #line 196 "describe.pgc"
return (0); return 0;
} }
...@@ -327,5 +327,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -327,5 +327,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 110 "execute.pgc" #line 110 "execute.pgc"
return (0); return 0;
} }
...@@ -247,5 +247,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -247,5 +247,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 87 "oldexec.pgc" #line 87 "oldexec.pgc"
return (0); return 0;
} }
...@@ -527,5 +527,5 @@ if (sqlca.sqlcode < 0) exit (1);} ...@@ -527,5 +527,5 @@ if (sqlca.sqlcode < 0) exit (1);}
#line 247 "sqlda.pgc" #line 247 "sqlda.pgc"
return (0); return 0;
} }
...@@ -110,5 +110,5 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -110,5 +110,5 @@ if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "twophase.pgc" #line 41 "twophase.pgc"
return (0); return 0;
} }
...@@ -91,7 +91,7 @@ int main() ...@@ -91,7 +91,7 @@ int main()
if( threads == NULL ) if( threads == NULL )
{ {
fprintf(stderr, "Cannot alloc memory\n"); fprintf(stderr, "Cannot alloc memory\n");
return( 1 ); return 1;
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
...@@ -133,7 +133,7 @@ int main() ...@@ -133,7 +133,7 @@ int main()
else else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows); printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 ); return 0;
} }
void *test_thread(void *arg) void *test_thread(void *arg)
...@@ -177,7 +177,7 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -177,7 +177,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if( sqlca.sqlcode != 0 ) if( sqlca.sqlcode != 0 )
{ {
printf("%s: ERROR: cannot connect to database!\n", l_connection); printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL ); return NULL;
} }
{ ECPGtrans(__LINE__, l_connection, "begin"); { ECPGtrans(__LINE__, l_connection, "begin");
#line 126 "thread.pgc" #line 126 "thread.pgc"
...@@ -216,6 +216,6 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -216,6 +216,6 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 138 "thread.pgc" #line 138 "thread.pgc"
return( NULL ); return NULL;
} }
#endif /* ENABLE_THREAD_SAFETY */ #endif /* ENABLE_THREAD_SAFETY */
...@@ -92,7 +92,7 @@ int main() ...@@ -92,7 +92,7 @@ int main()
if( threads == NULL ) if( threads == NULL )
{ {
fprintf(stderr, "Cannot alloc memory\n"); fprintf(stderr, "Cannot alloc memory\n");
return( 1 ); return 1;
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
...@@ -134,7 +134,7 @@ int main() ...@@ -134,7 +134,7 @@ int main()
else else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows); printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 ); return 0;
} }
void *test_thread(void *arg) void *test_thread(void *arg)
...@@ -178,7 +178,7 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -178,7 +178,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
if( sqlca.sqlcode != 0 ) if( sqlca.sqlcode != 0 )
{ {
printf("%s: ERROR: cannot connect to database!\n", l_connection); printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL ); return NULL;
} }
{ ECPGtrans(__LINE__, NULL, "begin"); { ECPGtrans(__LINE__, NULL, "begin");
#line 127 "thread_implicit.pgc" #line 127 "thread_implicit.pgc"
...@@ -217,6 +217,6 @@ if (sqlca.sqlcode < 0) sqlprint();} ...@@ -217,6 +217,6 @@ if (sqlca.sqlcode < 0) sqlprint();}
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 139 "thread_implicit.pgc" #line 139 "thread_implicit.pgc"
return( NULL ); return NULL;
} }
#endif /* ENABLE_THREAD_SAFETY */ #endif /* ENABLE_THREAD_SAFETY */
...@@ -140,5 +140,5 @@ exec sql end declare section; ...@@ -140,5 +140,5 @@ exec sql end declare section;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -365,5 +365,5 @@ main(void) ...@@ -365,5 +365,5 @@ main(void)
exec sql rollback; exec sql rollback;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -147,5 +147,5 @@ main(void) ...@@ -147,5 +147,5 @@ main(void)
PGTYPESinterval_free(i1); PGTYPESinterval_free(i1);
} }
return (0); return 0;
} }
...@@ -90,5 +90,5 @@ main(void) ...@@ -90,5 +90,5 @@ main(void)
exec sql rollback; exec sql rollback;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -93,5 +93,5 @@ main(void) ...@@ -93,5 +93,5 @@ main(void)
exec sql rollback; exec sql rollback;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -210,7 +210,7 @@ main(void) ...@@ -210,7 +210,7 @@ main(void)
} }
free(numarr); free(numarr);
return (0); return 0;
} }
static void static void
......
...@@ -91,5 +91,5 @@ int main() ...@@ -91,5 +91,5 @@ int main()
EXEC SQL disconnect all; EXEC SQL disconnect all;
return( 0 ); return 0;
} }
...@@ -252,5 +252,5 @@ exec sql end declare section; ...@@ -252,5 +252,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect all; exec sql disconnect all;
return (0); return 0;
} }
...@@ -58,5 +58,5 @@ exec sql end declare section; ...@@ -58,5 +58,5 @@ exec sql end declare section;
exec sql commit; exec sql commit;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -123,5 +123,5 @@ main (void) ...@@ -123,5 +123,5 @@ main (void)
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -96,5 +96,5 @@ int main() ...@@ -96,5 +96,5 @@ int main()
EXEC SQL disconnect all; EXEC SQL disconnect all;
/* All the memory will anyway be freed at the end */ /* All the memory will anyway be freed at the end */
return( 0 ); return 0;
} }
...@@ -23,5 +23,5 @@ int main(void) ...@@ -23,5 +23,5 @@ int main(void)
printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6); printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -97,5 +97,5 @@ exec sql end declare section; ...@@ -97,5 +97,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -107,5 +107,5 @@ EXEC SQL END DECLARE SECTION; ...@@ -107,5 +107,5 @@ EXEC SQL END DECLARE SECTION;
free(t); free(t);
return (0); return 0;
} }
...@@ -195,5 +195,5 @@ exec sql end declare section; ...@@ -195,5 +195,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -109,5 +109,5 @@ exec sql end declare section; ...@@ -109,5 +109,5 @@ exec sql end declare section;
exec sql commit; exec sql commit;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -86,5 +86,5 @@ exec sql end declare section; ...@@ -86,5 +86,5 @@ exec sql end declare section;
exec sql commit; exec sql commit;
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -246,5 +246,5 @@ exec sql end declare section; ...@@ -246,5 +246,5 @@ exec sql end declare section;
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect; exec sql disconnect;
return (0); return 0;
} }
...@@ -40,5 +40,5 @@ int main(void) ...@@ -40,5 +40,5 @@ int main(void)
strcpy(msg, "disconnect"); strcpy(msg, "disconnect");
exec sql disconnect current; exec sql disconnect current;
return (0); return 0;
} }
...@@ -60,7 +60,7 @@ int main() ...@@ -60,7 +60,7 @@ int main()
if( threads == NULL ) if( threads == NULL )
{ {
fprintf(stderr, "Cannot alloc memory\n"); fprintf(stderr, "Cannot alloc memory\n");
return( 1 ); return 1;
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
...@@ -92,7 +92,7 @@ int main() ...@@ -92,7 +92,7 @@ int main()
else else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows); printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 ); return 0;
} }
void *test_thread(void *arg) void *test_thread(void *arg)
...@@ -121,7 +121,7 @@ void *test_thread(void *arg) ...@@ -121,7 +121,7 @@ void *test_thread(void *arg)
if( sqlca.sqlcode != 0 ) if( sqlca.sqlcode != 0 )
{ {
printf("%s: ERROR: cannot connect to database!\n", l_connection); printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL ); return NULL;
} }
EXEC SQL AT :l_connection BEGIN; EXEC SQL AT :l_connection BEGIN;
...@@ -136,6 +136,6 @@ void *test_thread(void *arg) ...@@ -136,6 +136,6 @@ void *test_thread(void *arg)
/* all done */ /* all done */
EXEC SQL AT :l_connection COMMIT; EXEC SQL AT :l_connection COMMIT;
EXEC SQL DISCONNECT :l_connection; EXEC SQL DISCONNECT :l_connection;
return( NULL ); return NULL;
} }
#endif /* ENABLE_THREAD_SAFETY */ #endif /* ENABLE_THREAD_SAFETY */
...@@ -61,7 +61,7 @@ int main() ...@@ -61,7 +61,7 @@ int main()
if( threads == NULL ) if( threads == NULL )
{ {
fprintf(stderr, "Cannot alloc memory\n"); fprintf(stderr, "Cannot alloc memory\n");
return( 1 ); return 1;
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
...@@ -93,7 +93,7 @@ int main() ...@@ -93,7 +93,7 @@ int main()
else else
printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows); printf("ERROR: Failure - expecting %d rows, got %d.\n", nthreads * iterations, l_rows);
return( 0 ); return 0;
} }
void *test_thread(void *arg) void *test_thread(void *arg)
...@@ -122,7 +122,7 @@ void *test_thread(void *arg) ...@@ -122,7 +122,7 @@ void *test_thread(void *arg)
if( sqlca.sqlcode != 0 ) if( sqlca.sqlcode != 0 )
{ {
printf("%s: ERROR: cannot connect to database!\n", l_connection); printf("%s: ERROR: cannot connect to database!\n", l_connection);
return( NULL ); return NULL;
} }
EXEC SQL BEGIN; EXEC SQL BEGIN;
...@@ -137,6 +137,6 @@ void *test_thread(void *arg) ...@@ -137,6 +137,6 @@ void *test_thread(void *arg)
/* all done */ /* all done */
EXEC SQL COMMIT; EXEC SQL COMMIT;
EXEC SQL DISCONNECT :l_connection; EXEC SQL DISCONNECT :l_connection;
return( NULL ); return NULL;
} }
#endif /* ENABLE_THREAD_SAFETY */ #endif /* ENABLE_THREAD_SAFETY */
...@@ -39,11 +39,11 @@ comment ("#"{non_newline}*) ...@@ -39,11 +39,11 @@ comment ("#"{non_newline}*)
%% %%
permutation { return(PERMUTATION); } permutation { return PERMUTATION; }
session { return(SESSION); } session { return SESSION; }
setup { return(SETUP); } setup { return SETUP; }
step { return(STEP); } step { return STEP; }
teardown { return(TEARDOWN); } teardown { return TEARDOWN; }
[\n] { yyline++; } [\n] { yyline++; }
{comment} { /* ignore */ } {comment} { /* ignore */ }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment