Remove int16 from libpgeasy examples. Improve error reporting.
This commit is contained in:
parent
936ff27696
commit
ccab6f7402
@ -18,7 +18,6 @@ main(int argc, char **argv)
|
||||
float afloat;
|
||||
double adouble;
|
||||
char achar[11],
|
||||
achar16[17],
|
||||
abpchar[11],
|
||||
avarchar[51],
|
||||
atext[51];
|
||||
@ -41,7 +40,6 @@ main(int argc, char **argv)
|
||||
afloat float4, \
|
||||
adouble float8, \
|
||||
achar char, \
|
||||
achar16 char(16), \
|
||||
abpchar char(10), \
|
||||
avarchar varchar(50), \
|
||||
atext text, \
|
||||
@ -58,7 +56,6 @@ main(int argc, char **argv)
|
||||
'Betty', \
|
||||
'Charley', \
|
||||
'Doug', \
|
||||
'Ernie', \
|
||||
'now' )", row);
|
||||
doquery(query);
|
||||
|
||||
@ -73,18 +70,16 @@ main(int argc, char **argv)
|
||||
&afloat,
|
||||
&adouble,
|
||||
achar,
|
||||
achar16,
|
||||
abpchar,
|
||||
avarchar,
|
||||
atext,
|
||||
&aabstime) != END_OF_TUPLES)
|
||||
printf("int %d\nfloat %f\ndouble %f\nchar %s\nchar16 %s\n\
|
||||
printf("int %d\nfloat %f\ndouble %f\nchar %s\n\
|
||||
bpchar %s\nvarchar %s\ntext %s\nabstime %s",
|
||||
aint,
|
||||
afloat,
|
||||
adouble,
|
||||
achar,
|
||||
achar16,
|
||||
abpchar,
|
||||
avarchar,
|
||||
atext,
|
||||
|
@ -20,7 +20,6 @@ main(int argc, char **argv)
|
||||
float afloat;
|
||||
double adouble;
|
||||
char achar[11],
|
||||
achar16[17],
|
||||
abpchar[11],
|
||||
avarchar[51],
|
||||
atext[51];
|
||||
@ -29,7 +28,6 @@ main(int argc, char **argv)
|
||||
afloat_null,
|
||||
adouble_null,
|
||||
achar_null,
|
||||
achar16_null,
|
||||
abpchar_null,
|
||||
avarchar_null,
|
||||
atext_null,
|
||||
@ -52,7 +50,6 @@ main(int argc, char **argv)
|
||||
afloat float4, \
|
||||
adouble float8, \
|
||||
achar char, \
|
||||
achar16 char(16), \
|
||||
abpchar char(10), \
|
||||
avarchar varchar(50), \
|
||||
atext text, \
|
||||
@ -68,8 +65,7 @@ main(int argc, char **argv)
|
||||
'', \
|
||||
'', \
|
||||
'', \
|
||||
'', \
|
||||
'');");
|
||||
CURRENT_TIMESTAMP::abstime);");
|
||||
#else
|
||||
sprintf(query, "INSERT INTO testfetch VALUES ( \
|
||||
NULL, \
|
||||
@ -79,7 +75,6 @@ main(int argc, char **argv)
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL);");
|
||||
#endif
|
||||
doquery(query);
|
||||
@ -99,8 +94,6 @@ main(int argc, char **argv)
|
||||
&adouble_null,
|
||||
achar,
|
||||
&achar_null,
|
||||
achar16,
|
||||
&achar16_null,
|
||||
abpchar,
|
||||
&abpchar_null,
|
||||
avarchar,
|
||||
@ -109,30 +102,28 @@ main(int argc, char **argv)
|
||||
&atext_null,
|
||||
&aabstime,
|
||||
&aabstime_null) != END_OF_TUPLES)
|
||||
printf("int %d\nfloat %f\ndouble %f\nchar %s\nchar16 %s\n\
|
||||
printf("int %d\nfloat %f\ndouble %f\nchar %s\n\
|
||||
bpchar %s\nvarchar %s\ntext %s\nabstime %s\n",
|
||||
aint,
|
||||
afloat,
|
||||
adouble,
|
||||
achar,
|
||||
achar16,
|
||||
abpchar,
|
||||
avarchar,
|
||||
atext,
|
||||
ctime(&aabstime));
|
||||
printf("NULL:\nint %d\nfloat %d\ndouble %d\nchar %d\nchar16 %d\n\
|
||||
|
||||
printf("NULL:\nint %d\nfloat %d\ndouble %d\nchar %d\n\
|
||||
bpchar %d\nvarchar %d\ntext %d\nabstime %d\n",
|
||||
aint_null,
|
||||
afloat_null,
|
||||
adouble_null,
|
||||
achar_null,
|
||||
achar16_null,
|
||||
abpchar_null,
|
||||
avarchar_null,
|
||||
atext_null,
|
||||
aabstime_null);
|
||||
|
||||
|
||||
doquery("CLOSE c_testfetch");
|
||||
doquery("COMMIT WORK");
|
||||
printf("--- %-d rows inserted so far\n", row);
|
||||
|
@ -92,11 +92,11 @@ doquery(char *query)
|
||||
PQresultStatus(res) == PGRES_FATAL_ERROR))
|
||||
{
|
||||
if (res != NULL)
|
||||
fprintf(stderr, "query error: %s\n", PQcmdStatus(res));
|
||||
fprintf(stderr, "query error: %s\n", PQresultErrorMessage(res));
|
||||
else
|
||||
fprintf(stderr, "connection error: %s\n", PQerrorMessage(conn));
|
||||
PQfinish(conn);
|
||||
halt("failed request: %s\n", query);
|
||||
halt("failed query: %s\n", query);
|
||||
}
|
||||
tuple = 0;
|
||||
return res;
|
||||
|
Loading…
Reference in New Issue
Block a user