1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00
Files
postgres/src/interfaces/ecpg/test/testdynalloc.pgc
Neil Conway 4802bb57a6 Warning cleanups for ecpg tests. Avoid doing pointer arithmetic on void *,
remove old-style function declarations, and mark a function "static".
There are some remaining warnings, but this fixes most of them, anyway.
2005-06-30 07:08:59 +00:00

34 lines
775 B
Plaintext

#include <stdio.h>
exec sql include sqlca;
#include <stdlib.h>
int main(void)
{
exec sql begin declare section;
char **cpp=0;
int *ipointer=0;
exec sql end declare section;
int i;
if (getenv("SQLOPT")) ECPGdebug(1,stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to postgres;
exec sql allocate descriptor mydesc;
exec sql select tablename into descriptor mydesc from pg_tables;
exec sql get descriptor mydesc value 1 :cpp=DATA, :ipointer=INDICATOR;
printf("Result ");
for (i=0;i<sqlca.sqlerrd[2];++i)
{ if (ipointer[i]) printf("NULL, ");
else printf("'%s', ",cpp[i]);
}
ECPGfree_auto_mem();
printf("\n");
exec sql deallocate descriptor mydesc;
exec sql disconnect;
return 0;
}