1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include <stdio.h>
#include <stdlib.h>
#include <pgtypes_error.h>
#include <sqltypes.h>
/*
* This file tests various forms of long-input/output by means of
* rfmtlong
*/
static void
check_return(int ret);
static void
fmtlong(long lng, const char *fmt)
{
static int i;
int r;
char buf[30];
r = rfmtlong(lng, fmt, buf);
printf("r: %d ", r);
if (r == 0)
{
printf("%d: %s (fmt was: %s)\n", i++, buf, fmt);
}
else
check_return(r);
}
int
main(void)
{
ECPGdebug(1, stderr);
fmtlong(-8494493, "-<<<<,<<<,<<<,<<<");
fmtlong(-8494493, "################");
fmtlong(-8494493, "+++$$$$$$$$$$$$$.##");
fmtlong(-8494493, "(&,&&&,&&&,&&&.)");
fmtlong(-8494493, "<<<<,<<<,<<<,<<<");
fmtlong(-8494493, "$************.**");
fmtlong(-8494493, "---$************.**");
fmtlong(-8494493, "+-+################");
fmtlong(-8494493, "abc: ################+-+");
fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
return 0;
}
static void
check_return(int ret)
{
switch(ret)
{
case ECPG_INFORMIX_ENOTDMY:
printf("(ECPG_INFORMIX_ENOTDMY)");
break;
case ECPG_INFORMIX_ENOSHORTDATE:
printf("(ECPG_INFORMIX_ENOSHORTDATE)");
break;
case ECPG_INFORMIX_BAD_DAY:
printf("(ECPG_INFORMIX_BAD_DAY)");
break;
case ECPG_INFORMIX_BAD_MONTH:
printf("(ECPG_INFORMIX_BAD_MONTH)");
break;
default:
printf("(unknown ret: %d)", ret);
break;
}
printf("\n");
}
|