summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/lib')
-rw-r--r--src/interfaces/ecpg/lib/connect.c4
-rw-r--r--src/interfaces/ecpg/lib/descriptor.c98
-rw-r--r--src/interfaces/ecpg/lib/execute.c812
-rw-r--r--src/interfaces/ecpg/lib/extern.h9
-rw-r--r--src/interfaces/ecpg/lib/misc.c33
-rw-r--r--src/interfaces/ecpg/lib/pg_type.h3
-rw-r--r--src/interfaces/ecpg/lib/typename.c11
7 files changed, 508 insertions, 462 deletions
diff --git a/src/interfaces/ecpg/lib/connect.c b/src/interfaces/ecpg/lib/connect.c
index 9da651a0205..239c766d7c7 100644
--- a/src/interfaces/ecpg/lib/connect.c
+++ b/src/interfaces/ecpg/lib/connect.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.12 2001/09/19 14:09:32 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.13 2001/10/25 05:50:11 momjian Exp $ */
#include "postgres_fe.h"
@@ -313,7 +313,7 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
/*------
* new style:
- * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:]
+ * <tcp|unix>:postgresql://server[:port|:/unixsocket/path:]
* [/db name][?options]
*------
*/
diff --git a/src/interfaces/ecpg/lib/descriptor.c b/src/interfaces/ecpg/lib/descriptor.c
index ba11f5af5e8..af30723266a 100644
--- a/src/interfaces/ecpg/lib/descriptor.c
+++ b/src/interfaces/ecpg/lib/descriptor.c
@@ -1,6 +1,6 @@
/* dynamic SQL support routines
*
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.16 2001/09/19 14:09:32 meskes Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.17 2001/10/25 05:50:11 momjian Exp $
*/
#include "postgres_fe.h"
@@ -18,8 +18,10 @@ static PGresult
*
ECPGresultByDescriptor(int line, const char *name)
{
- PGresult **resultpp = ECPGdescriptor_lvalue ( line, name );
- if (resultpp) return *resultpp;
+ PGresult **resultpp = ECPGdescriptor_lvalue(line, name);
+
+ if (resultpp)
+ return *resultpp;
return NULL;
}
@@ -28,7 +30,8 @@ ECPGDynamicType_DDT(Oid type)
{
switch (type)
{
- case 1082:return SQL3_DDT_DATE; /* date */
+ case 1082:
+ return SQL3_DDT_DATE; /* date */
case 1083:
return SQL3_DDT_TIME; /* time */
case 1184:
@@ -103,8 +106,8 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
{
switch (vartype)
{
- case ECPGt_char:
- case ECPGt_unsigned_char:
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
strncpy((char *) var, value, varcharsize);
break;
case ECPGt_varchar:
@@ -136,9 +139,10 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
va_list args;
PGresult *ECPGresult = ECPGresultByDescriptor(lineno, desc_name);
enum ECPGdtype type;
- bool Indicator_seen = false,
- Data_seen = false;
- int ntuples, act_tuple;
+ bool Indicator_seen = false,
+ Data_seen = false;
+ int ntuples,
+ act_tuple;
va_start(args, index);
if (!ECPGresult)
@@ -180,21 +184,24 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
switch (type)
{
case (ECPGd_indicator):
- /* this is like ECPGexecute
- * missing : allocate arrays, perhaps this should go into
- * a common function !!
+
+ /*
+ * this is like ECPGexecute missing : allocate arrays,
+ * perhaps this should go into a common function !!
*/
if (ntuples > arrsize)
- { ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
- lineno, ntuples, arrsize);
+ {
+ ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
+ lineno, ntuples, arrsize);
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, NULL);
return false;
}
Indicator_seen = true;
- for (act_tuple = 0; act_tuple < ntuples ; act_tuple++)
- { if (!get_int_item(lineno, var, vartype, -PQgetisnull(ECPGresult, act_tuple, index)))
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ {
+ if (!get_int_item(lineno, var, vartype, -PQgetisnull(ECPGresult, act_tuple, index)))
return (false);
- var = (char*)var + offset;
+ var = (char *) var + offset;
ECPGlog("ECPGget_desc: INDICATOR[%d] = %d\n", act_tuple, -PQgetisnull(ECPGresult, act_tuple, index));
}
break;
@@ -234,20 +241,23 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
case ECPGd_ret_length:
case ECPGd_ret_octet:
- /* this is like ECPGexecute
- * missing : allocate arrays, perhaps this should go into
- * a common function !!
+
+ /*
+ * this is like ECPGexecute missing : allocate arrays,
+ * perhaps this should go into a common function !!
*/
if (ntuples > arrsize)
- { ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
- lineno, ntuples, arrsize);
+ {
+ ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
+ lineno, ntuples, arrsize);
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, NULL);
return false;
}
- for (act_tuple = 0; act_tuple < ntuples ; act_tuple++)
- { if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index)))
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ {
+ if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index)))
return (false);
- var = (char*)var + offset;
+ var = (char *) var + offset;
ECPGlog("ECPGget_desc: RETURNED[%d] = %d\n", act_tuple, PQgetlength(ECPGresult, act_tuple, index));
}
break;
@@ -280,27 +290,30 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
ECPGlog("ECPGget_desc: TYPE = %d\n", ECPGDynamicType_DDT(PQftype(ECPGresult, index)));
break;
case ECPGd_data:
- /* this is like ECPGexecute
- * missing : allocate arrays, perhaps this should go into
- * a common function !!
+
+ /*
+ * this is like ECPGexecute missing : allocate arrays,
+ * perhaps this should go into a common function !!
*/
if (ntuples > arrsize)
- { ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
- lineno, ntuples, arrsize);
+ {
+ ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
+ lineno, ntuples, arrsize);
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, NULL);
return false;
}
Data_seen = true;
- for (act_tuple = 0; act_tuple < ntuples ; act_tuple++)
- { if (PQgetisnull(ECPGresult, act_tuple, index))
- continue; /* do not touch data on null value */
- if (!get_data(ECPGresult, act_tuple, index, lineno,
- vartype, ECPGt_NO_INDICATOR, var, NULL,
- varcharsize, offset, false))
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ {
+ if (PQgetisnull(ECPGresult, act_tuple, index))
+ continue; /* do not touch data on null value */
+ if (!get_data(ECPGresult, act_tuple, index, lineno,
+ vartype, ECPGt_NO_INDICATOR, var, NULL,
+ varcharsize, offset, false))
return (false);
}
break;
-
+
case ECPGd_cardinality:
if (!get_int_item(lineno, var, vartype, PQntuples(ECPGresult)))
return (false);
@@ -318,9 +331,10 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
}
if (Data_seen && !Indicator_seen)
- {
- for (act_tuple = 0; act_tuple < ntuples ; act_tuple++)
- { if (PQgetisnull(ECPGresult, act_tuple, index))
+ {
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ {
+ if (PQgetisnull(ECPGresult, act_tuple, index))
{
ECPGraise(lineno, ECPG_MISSING_INDICATOR, NULL);
return (false);
@@ -365,14 +379,14 @@ ECPGallocate_desc(int line, const char *name)
return true;
}
-PGresult **
+PGresult **
ECPGdescriptor_lvalue(int line, const char *descriptor)
{
struct descriptor *i;
for (i = all_descriptors; i != NULL; i = i->next)
{
- if (!strcmp(descriptor, i->name))
+ if (!strcmp(descriptor, i->name))
return &i->result;
}
diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c
index 099b4cff276..e9454ec215e 100644
--- a/src/interfaces/ecpg/lib/execute.c
+++ b/src/interfaces/ecpg/lib/execute.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.28 2001/10/05 17:37:07 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.29 2001/10/25 05:50:11 momjian Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -30,14 +30,29 @@
/* variables visible to the programs */
struct sqlca sqlca =
{
- {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},
- sizeof(struct sqlca),
- 0,
- {0, {0}},
- {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},
- {0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {
+ 'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '
+ } ,
+ sizeof(struct sqlca),
+ 0,
+ {
+ 0,
+ {
+ 0
+ }
+ },
+ {
+ 'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '
+ },
+ {
+ 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0
+ }
};
struct variable
@@ -288,7 +303,6 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
if ((stmt->connection->cache_head) == NULL)
{
-
/*
* Text like types are not an array for ecpg, but postgres counts
* them as an array. This define reminds you to not 'correct'
@@ -356,7 +370,6 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
if (ECPGDynamicType(type) == SQL3_CHARACTER ||
ECPGDynamicType(type) == SQL3_CHARACTER_VARYING)
{
-
/*
* arrays of character strings are not yet implemented
*/
@@ -371,443 +384,439 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
bool
-ECPGstore_result(const PGresult *results, int act_field,
- const struct statement * stmt, struct variable *var)
-{ int isarray,
- act_tuple,
- ntuples = PQntuples(results);
- bool status = true;
-
- isarray = ECPGis_type_an_array(PQftype(results, act_field), stmt, var);
-
- if (!isarray)
- {
+ECPGstore_result(const PGresult *results, int act_field,
+ const struct statement * stmt, struct variable * var)
+{
+ int isarray,
+ act_tuple,
+ ntuples = PQntuples(results);
+ bool status = true;
- /*
- * if we don't have enough space, we cannot read
- * all tuples
- */
- if ((var->arrsize > 0 && ntuples > var->arrsize) || (var->ind_arrsize > 0 && ntuples > var->ind_arrsize))
- {
- ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d\n",
- stmt->lineno, ntuples, var->arrsize);
- ECPGraise(stmt->lineno, ECPG_TOO_MANY_MATCHES, NULL);
- return false;
- }
- }
- else
- {
+ isarray = ECPGis_type_an_array(PQftype(results, act_field), stmt, var);
- /*
- * since we read an array, the variable has to be
- * an array too
- */
- if (var->arrsize == 0)
- {
- ECPGraise(stmt->lineno, ECPG_NO_ARRAY, NULL);
- return false;
- }
- }
+ if (!isarray)
+ {
+ /*
+ * if we don't have enough space, we cannot read all tuples
+ */
+ if ((var->arrsize > 0 && ntuples > var->arrsize) || (var->ind_arrsize > 0 && ntuples > var->ind_arrsize))
+ {
+ ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d\n",
+ stmt->lineno, ntuples, var->arrsize);
+ ECPGraise(stmt->lineno, ECPG_TOO_MANY_MATCHES, NULL);
+ return false;
+ }
+ }
+ else
+ {
+ /*
+ * since we read an array, the variable has to be an array too
+ */
+ if (var->arrsize == 0)
+ {
+ ECPGraise(stmt->lineno, ECPG_NO_ARRAY, NULL);
+ return false;
+ }
+ }
- /*
- * allocate memory for NULL pointers
- */
- if ((var->arrsize == 0 || var->varcharsize == 0) && var->value == NULL)
- {
- int len = 0;
+ /*
+ * allocate memory for NULL pointers
+ */
+ if ((var->arrsize == 0 || var->varcharsize == 0) && var->value == NULL)
+ {
+ int len = 0;
- switch (var->type)
- {
- case ECPGt_char:
- case ECPGt_unsigned_char:
- var->varcharsize = 0;
- /* check strlen for each tuple */
- for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
- {
- int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
-
- if (len > var->varcharsize)
- var->varcharsize = len;
- }
- var->offset *= var->varcharsize;
- len = var->offset * ntuples;
- break;
- case ECPGt_varchar:
- len = ntuples * (var->varcharsize + sizeof(int));
- break;
- default:
- len = var->offset * ntuples;
- break;
- }
- var->value = (void *) ecpg_alloc(len, stmt->lineno);
- *((void **) var->pointer) = var->value;
- add_mem(var->value, stmt->lineno);
- }
+ switch (var->type)
+ {
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
+ var->varcharsize = 0;
+ /* check strlen for each tuple */
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ {
+ int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
- for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
- {
- if (!get_data(results, act_tuple, act_field, stmt->lineno,
- var->type, var->ind_type, var->value,
- var->ind_value, var->varcharsize, var->offset, isarray))
- status = false;
- }
+ if (len > var->varcharsize)
+ var->varcharsize = len;
+ }
+ var->offset *= var->varcharsize;
+ len = var->offset * ntuples;
+ break;
+ case ECPGt_varchar:
+ len = ntuples * (var->varcharsize + sizeof(int));
+ break;
+ default:
+ len = var->offset * ntuples;
+ break;
+ }
+ var->value = (void *) ecpg_alloc(len, stmt->lineno);
+ *((void **) var->pointer) = var->value;
+ add_mem(var->value, stmt->lineno);
+ }
+
+ for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
+ {
+ if (!get_data(results, act_tuple, act_field, stmt->lineno,
+ var->type, var->ind_type, var->value,
+ var->ind_value, var->varcharsize, var->offset, isarray))
+ status = false;
+ }
return status;
}
static bool
-ECPGstore_input(const struct statement * stmt, const struct variable *var,
- const char **tobeinserted_p, bool *malloced_p)
+ECPGstore_input(const struct statement * stmt, const struct variable * var,
+ const char **tobeinserted_p, bool *malloced_p)
{
- char *mallocedval = NULL;
- char *newcopy = NULL;
+ char *mallocedval = NULL;
+ char *newcopy = NULL;
- /*
- * Some special treatment is needed for records since we want
- * their contents to arrive in a comma-separated list on insert (I
- * think).
- */
-
- *malloced_p=false;
- *tobeinserted_p="";
+ /*
+ * Some special treatment is needed for records since we want their
+ * contents to arrive in a comma-separated list on insert (I think).
+ */
- /* check for null value and set input buffer accordingly */
- switch (var->ind_type)
- {
- case ECPGt_short:
- case ECPGt_unsigned_short:
- if (*(short *) var->ind_value < 0)
- *tobeinserted_p="null";
- break;
- case ECPGt_int:
- case ECPGt_unsigned_int:
- if (*(int *) var->ind_value < 0)
- *tobeinserted_p="null";
- break;
- case ECPGt_long:
- case ECPGt_unsigned_long:
- if (*(long *) var->ind_value < 0L)
- *tobeinserted_p="null";
- break;
+ *malloced_p = false;
+ *tobeinserted_p = "";
+
+ /* check for null value and set input buffer accordingly */
+ switch (var->ind_type)
+ {
+ case ECPGt_short:
+ case ECPGt_unsigned_short:
+ if (*(short *) var->ind_value < 0)
+ *tobeinserted_p = "null";
+ break;
+ case ECPGt_int:
+ case ECPGt_unsigned_int:
+ if (*(int *) var->ind_value < 0)
+ *tobeinserted_p = "null";
+ break;
+ case ECPGt_long:
+ case ECPGt_unsigned_long:
+ if (*(long *) var->ind_value < 0L)
+ *tobeinserted_p = "null";
+ break;
#ifdef HAVE_LONG_LONG_INT_64
- case ECPGt_long_long:
- case ECPGt_unsigned_long_long:
- if (*(long long int *) var->ind_value < (long long) 0)
- *tobeinserted_p="null";
- break;
+ case ECPGt_long_long:
+ case ECPGt_unsigned_long_long:
+ if (*(long long int *) var->ind_value < (long long) 0)
+ *tobeinserted_p = "null";
+ break;
#endif /* HAVE_LONG_LONG_INT_64 */
- default:
- break;
- }
+ default:
+ break;
+ }
- if (**tobeinserted_p == '\0')
+ if (**tobeinserted_p == '\0')
+ {
+ switch (var->type)
{
- switch (var->type)
- {
- int element;
+ int element;
- case ECPGt_short:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_short:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%hd,", ((short *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%hd,", ((short *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%hd", *((short *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%hd", *((short *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_int:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_int:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%d,", ((int *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%d,", ((int *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%d", *((int *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%d", *((int *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_unsigned_short:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_unsigned_short:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%hu,", ((unsigned short *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%hu,", ((unsigned short *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%hu", *((unsigned short *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%hu", *((unsigned short *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_unsigned_int:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_unsigned_int:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%u,", ((unsigned int *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%u,", ((unsigned int *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%u", *((unsigned int *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%u", *((unsigned int *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_long:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_long:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%ld,", ((long *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%ld,", ((long *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%ld", *((long *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%ld", *((long *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_unsigned_long:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_unsigned_long:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%lu,", ((unsigned long *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%lu,", ((unsigned long *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%lu", *((unsigned long *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%lu", *((unsigned long *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
#ifdef HAVE_LONG_LONG_INT_64
- case ECPGt_long_long:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
- return false;
+ case ECPGt_long_long:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%lld", *((long long *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%lld", *((long long *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_unsigned_long_long:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
- return false;
+ case ECPGt_unsigned_long_long:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%llu", *((unsigned long long *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%llu", *((unsigned long long *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
#endif /* HAVE_LONG_LONG_INT_64 */
- case ECPGt_float:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_float:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%.14g,", ((float *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%.14g,", ((float *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%.14g", *((float *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%.14g", *((float *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_double:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_double:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%.14g,", ((double *) var->value)[element]);
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%.14g,", ((double *) var->value)[element]);
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
- else
- sprintf(mallocedval, "%.14g", *((double *) var->value));
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ sprintf(mallocedval, "%.14g", *((double *) var->value));
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
- case ECPGt_bool:
- if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
- return false;
+ case ECPGt_bool:
+ if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
+ return false;
- if (var->arrsize > 1)
- {
- strncpy(mallocedval, "'{", sizeof("'{"));
-
- if (var->offset == sizeof(char))
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((char *) var->value)[element]) ? 't' : 'f');
-
- /*
- * this is necessary since sizeof(C++'s
- * bool)==sizeof(int)
- */
- else if (var->offset == sizeof(int))
- for (element = 0; element < var->arrsize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
- else
- ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size");
-
- strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
- }
+ if (var->arrsize > 1)
+ {
+ strncpy(mallocedval, "'{", sizeof("'{"));
+
+ if (var->offset == sizeof(char))
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%c,", (((char *) var->value)[element]) ? 't' : 'f');
+
+ /*
+ * this is necessary since sizeof(C++'s
+ * bool)==sizeof(int)
+ */
+ else if (var->offset == sizeof(int))
+ for (element = 0; element < var->arrsize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
else
- {
- if (var->offset == sizeof(char))
- sprintf(mallocedval, "'%c'", (*((char *) var->value)) ? 't' : 'f');
- else if (var->offset == sizeof(int))
- sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
- else
- ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size");
- }
+ ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size");
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- break;
+ strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
+ }
+ else
+ {
+ if (var->offset == sizeof(char))
+ sprintf(mallocedval, "'%c'", (*((char *) var->value)) ? 't' : 'f');
+ else if (var->offset == sizeof(int))
+ sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
+ else
+ ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size");
+ }
- case ECPGt_char:
- case ECPGt_unsigned_char:
- {
- /* set slen to string length if type is char * */
- int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ break;
+
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
+ {
+ /* set slen to string length if type is char * */
+ int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize;
- if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno)))
- return false;
+ if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno)))
+ return false;
- strncpy(newcopy, (char *) var->value, slen);
- newcopy[slen] = '\0';
+ strncpy(newcopy, (char *) var->value, slen);
+ newcopy[slen] = '\0';
- mallocedval = quote_postgres(newcopy, stmt->lineno);
- if (!mallocedval)
- return false;
+ mallocedval = quote_postgres(newcopy, stmt->lineno);
+ if (!mallocedval)
+ return false;
- free(newcopy);
+ free(newcopy);
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- }
- break;
- case ECPGt_char_variable:
- {
- int slen = strlen((char *) var->value);
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ }
+ break;
+ case ECPGt_char_variable:
+ {
+ int slen = strlen((char *) var->value);
- if (!(mallocedval = ecpg_alloc(slen + 1, stmt->lineno)))
- return false;
+ if (!(mallocedval = ecpg_alloc(slen + 1, stmt->lineno)))
+ return false;
- strncpy(mallocedval, (char *) var->value, slen);
- mallocedval[slen] = '\0';
+ strncpy(mallocedval, (char *) var->value, slen);
+ mallocedval[slen] = '\0';
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- }
- break;
- case ECPGt_varchar:
- {
- struct ECPGgeneric_varchar *variable =
- (struct ECPGgeneric_varchar *) (var->value);
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ }
+ break;
+ case ECPGt_varchar:
+ {
+ struct ECPGgeneric_varchar *variable =
+ (struct ECPGgeneric_varchar *) (var->value);
- if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, stmt->lineno)))
- return false;
+ if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, stmt->lineno)))
+ return false;
- strncpy(newcopy, variable->arr, variable->len);
- newcopy[variable->len] = '\0';
+ strncpy(newcopy, variable->arr, variable->len);
+ newcopy[variable->len] = '\0';
- mallocedval = quote_postgres(newcopy, stmt->lineno);
- if (!mallocedval)
- return false;
+ mallocedval = quote_postgres(newcopy, stmt->lineno);
+ if (!mallocedval)
+ return false;
- free(newcopy);
+ free(newcopy);
- *tobeinserted_p = mallocedval;
- *malloced_p = true;
- }
- break;
+ *tobeinserted_p = mallocedval;
+ *malloced_p = true;
+ }
+ break;
- default:
- /* Not implemented yet */
- ECPGraise(stmt->lineno, ECPG_UNSUPPORTED, (char *) ECPGtype_name(var->type));
- return false;
- break;
- }
+ default:
+ /* Not implemented yet */
+ ECPGraise(stmt->lineno, ECPG_UNSUPPORTED, (char *) ECPGtype_name(var->type));
+ return false;
+ break;
}
+ }
return true;
}
@@ -831,15 +840,15 @@ ECPGexecute(struct statement * stmt)
var = stmt->inlist;
while (var)
{
- char *newcopy = NULL;
+ char *newcopy = NULL;
const char *tobeinserted = NULL;
char *p;
- bool malloced=FALSE;
- int hostvarl = 0;
+ bool malloced = FALSE;
+ int hostvarl = 0;
if (!ECPGstore_input(stmt, var, &tobeinserted, &malloced))
return false;
-
+
/*
* Now tobeinserted points to an area that is to be inserted at
* the first %s
@@ -850,7 +859,6 @@ ECPGexecute(struct statement * stmt)
strcpy(newcopy, copiedquery);
if ((p = next_insert(newcopy + hostvarl)) == NULL)
{
-
/*
* We have an argument but we dont have the matched up string
* in the string
@@ -880,7 +888,7 @@ ECPGexecute(struct statement * stmt)
*/
if (malloced)
{
- free((char*)tobeinserted);
+ free((char *) tobeinserted);
tobeinserted = NULL;
}
@@ -921,11 +929,14 @@ ECPGexecute(struct statement * stmt)
ECPGraise(stmt->lineno, ECPG_PGSQL, PQerrorMessage(stmt->connection->connection));
}
else
- /* note: since some of the following code is duplicated in descriptor.c
- * it should go into a separate function
- */
+
+ /*
+ * note: since some of the following code is duplicated in
+ * descriptor.c it should go into a separate function
+ */
{
- bool clear_result = TRUE;
+ bool clear_result = TRUE;
+
var = stmt->outlist;
switch (PQresultStatus(results))
{
@@ -940,37 +951,43 @@ ECPGexecute(struct statement * stmt)
if (ntuples < 1)
{
- if (ntuples) ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
- stmt->lineno, ntuples);
+ if (ntuples)
+ ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
+ stmt->lineno, ntuples);
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL);
status = false;
break;
}
- if (var != NULL && var->type==ECPGt_descriptor)
- { PGresult **resultpp = ECPGdescriptor_lvalue(stmt->lineno, (const char*)var->pointer);
- if (resultpp == NULL) status = false;
+ if (var != NULL && var->type == ECPGt_descriptor)
+ {
+ PGresult **resultpp = ECPGdescriptor_lvalue(stmt->lineno, (const char *) var->pointer);
+
+ if (resultpp == NULL)
+ status = false;
else
- { if (*resultpp)
- PQclear(*resultpp);
- *resultpp=results;
+ {
+ if (*resultpp)
+ PQclear(*resultpp);
+ *resultpp = results;
clear_result = FALSE;
- ECPGlog("ECPGexecute putting result (%d tuples) into descriptor '%s'\n", PQntuples(results), (const char*)var->pointer);
+ ECPGlog("ECPGexecute putting result (%d tuples) into descriptor '%s'\n", PQntuples(results), (const char *) var->pointer);
}
var = var->next;
}
- else for (act_field = 0; act_field < nfields && status; act_field++)
- {
- if (var == NULL)
+ else
+ for (act_field = 0; act_field < nfields && status; act_field++)
{
- ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, NULL);
- return (false);
- }
-
- status = ECPGstore_result(results, act_field, stmt, var);
+ if (var == NULL)
+ {
+ ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, NULL);
+ return (false);
+ }
- var = var->next;
- }
+ status = ECPGstore_result(results, act_field, stmt, var);
+
+ var = var->next;
+ }
if (status && var != NULL)
{
@@ -1016,7 +1033,8 @@ ECPGexecute(struct statement * stmt)
status = false;
break;
}
- if (clear_result) PQclear(results);
+ if (clear_result)
+ PQclear(results);
}
/* check for asynchronous returns */
@@ -1038,7 +1056,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
struct statement *stmt;
struct connection *con = get_connection(connection_name);
bool status;
- char *oldlocale;
+ char *oldlocale;
/* Make sure we do NOT honor the locale for numeric input/output */
/* since the database wants the standard decimal point */
@@ -1081,12 +1099,12 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
return (status);
}
-/* old descriptor interface */
+/* old descriptor interface */
bool
ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query)
{
- return ECPGdo(line, connection, (char *)query, ECPGt_EOIT,
- ECPGt_descriptor, descriptor, 0L, 0L, 0L,
- ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+ return ECPGdo(line, connection, (char *) query, ECPGt_EOIT,
+ ECPGt_descriptor, descriptor, 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
diff --git a/src/interfaces/ecpg/lib/extern.h b/src/interfaces/ecpg/lib/extern.h
index 971924e708a..8e7ba566a36 100644
--- a/src/interfaces/ecpg/lib/extern.h
+++ b/src/interfaces/ecpg/lib/extern.h
@@ -62,9 +62,8 @@ struct descriptor
struct descriptor *next;
};
-PGresult **
-ECPGdescriptor_lvalue(int line, const char *descriptor);
+PGresult **
+ ECPGdescriptor_lvalue(int line, const char *descriptor);
-bool
-ECPGstore_result(const PGresult *results, int act_field,
- const struct statement * stmt, struct variable *var);
+bool ECPGstore_result(const PGresult *results, int act_field,
+ const struct statement * stmt, struct variable * var);
diff --git a/src/interfaces/ecpg/lib/misc.c b/src/interfaces/ecpg/lib/misc.c
index b5dd56e3cfc..a37cd7ceb67 100644
--- a/src/interfaces/ecpg/lib/misc.c
+++ b/src/interfaces/ecpg/lib/misc.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.6 2001/10/05 17:37:07 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.7 2001/10/25 05:50:12 momjian Exp $ */
#include "postgres_fe.h"
@@ -11,14 +11,29 @@
static struct sqlca sqlca_init =
{
- {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},
- sizeof(struct sqlca),
- 0,
- {0, {0}},
- {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},
- {0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {
+ 'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '
+ } ,
+ sizeof(struct sqlca),
+ 0,
+ {
+ 0,
+ {
+ 0
+ }
+ },
+ {
+ 'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '
+ },
+ {
+ 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0
+ }
};
static int simple_debug = 0;
diff --git a/src/interfaces/ecpg/lib/pg_type.h b/src/interfaces/ecpg/lib/pg_type.h
index a9ffbfb6277..5961dc23c6a 100644
--- a/src/interfaces/ecpg/lib/pg_type.h
+++ b/src/interfaces/ecpg/lib/pg_type.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_type.h,v 1.2 2001/01/24 19:43:29 momjian Exp $
+ * $Id: pg_type.h,v 1.3 2001/10/25 05:50:12 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -68,5 +68,4 @@
#define ZPBITOID 1560
#define VARBITOID 1562
#define NUMERICOID 1700
-
#endif /* PG_TYPE_H */
diff --git a/src/interfaces/ecpg/lib/typename.c b/src/interfaces/ecpg/lib/typename.c
index 345a5f36f1f..48747e2c719 100644
--- a/src/interfaces/ecpg/lib/typename.c
+++ b/src/interfaces/ecpg/lib/typename.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/typename.c,v 1.19 2001/09/19 14:09:32 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/typename.c,v 1.20 2001/10/25 05:50:12 momjian Exp $ */
#include "postgres_fe.h"
@@ -17,7 +17,7 @@ ECPGtype_name(enum ECPGttype typ)
{
switch (typ)
{
- case ECPGt_char:
+ case ECPGt_char:
return "char";
case ECPGt_unsigned_char:
return "unsigned char";
@@ -58,11 +58,12 @@ ECPGDynamicType(Oid type)
{
switch (type)
{
- case BOOLOID:return SQL3_BOOLEAN; /* bool */
+ case BOOLOID:
+ return SQL3_BOOLEAN; /* bool */
case INT2OID:
return SQL3_SMALLINT; /* int2 */
case INT4OID:
- return SQL3_INTEGER;/* int4 */
+ return SQL3_INTEGER; /* int4 */
case TEXTOID:
return SQL3_CHARACTER; /* text */
case FLOAT4OID:
@@ -80,7 +81,7 @@ ECPGDynamicType(Oid type)
case TIMESTAMPOID:
return SQL3_DATE_TIME_TIMESTAMP; /* datetime */
case NUMERICOID:
- return SQL3_NUMERIC;/* numeric */
+ return SQL3_NUMERIC; /* numeric */
default:
return -type;
}