sqlca.sqlcode = code;
va_start(args, fmt);
- vsprintf(sqlca.sqlerrm.sqlerrmc, fmt, args);
+ vsnprintf(sqlca.sqlerrm.sqlerrmc, SQLERRMC_LEN, fmt, args);
va_end(args);
sqlca.sqlerrm.sqlerrml = strlen(sqlca.sqlerrm.sqlerrmc);
int nfields,
ntuples,
act_tuple,
- act_field;
+ act_field,
+ isarray;
case PGRES_TUPLES_OK:
nfields = PQnfields(results);
return (false);
}
+ array_query = (char *)ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt -> lineno);
+ sprintf(array_query, "select typelem from pg_type where oid=%d", PQftype(results, act_field));
+ query = PQexec(stmt->connection->connection, array_query);
+ isarray = 0;
+ if (PQresultStatus(query) == PGRES_TUPLES_OK) {
+ isarray = atol((char *)PQgetvalue(query, 0, 0));
+ ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array: %s\n", stmt->lineno, PQftype(results, act_field), var->type, isarray ? "yes" : "no");
+ }
+ PQclear(query);
+
/*
* if we don't have enough space, we cannot read all
* tuples
add_mem(var->value, stmt->lineno);
}
-#if 0
- array_query = (char *)ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt -> lineno);
- sprintf(array_query, "select typelem from pg_type where oid=%d", PQftype(results, act_field));
- query = PQexec(stmt->connection->connection, array_query);
- if (PQresultStatus(query) == PGRES_TUPLES_OK)
- ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array OID: %s\n", stmt->lineno, PQftype(results, act_field), var->type, (char *)PQgetvalue(query, 0, 0));
- PQclear(query);
-#endif
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
{
pval = (char *)PQgetvalue(results, act_tuple, act_field);
all: stp.so test1 test2 test3 test4 test5 perftest
#LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt
-#LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
-LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
+LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
+#LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
#ECPG=/usr/local/pgsql/bin/ecpg
-#ECPG=../preproc/ecpg -I../include
-ECPG=/usr/bin/ecpg -I/usr/include/postgresql
+ECPG=../preproc/ecpg -I../include
+#ECPG=/usr/bin/ecpg -I/usr/include/postgresql
.SUFFIXES: .pgc .c
stp.so: stp.c
cc -fPIC -I../include -I/usr/include/postgresql -c -o stp.o stp.c
- ld -Bdynamic -shared -soname stp.so -o stp.so stp.o -lpq -lecpg
+ ld -Bdynamic -shared -soname stp.so -o stp.so stp.o -lpq -lecpg -lc
clean: