~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Processed by ecpg (regression mode) */
 
2
/* These include files are added by the preprocessor */
 
3
#include <ecpglib.h>
 
4
#include <ecpgerrno.h>
 
5
#include <sqlca.h>
 
6
/* Needed for informix compatibility */
 
7
#include <ecpg_informix.h>
 
8
/* End of automatic include section */
 
9
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
 
10
 
 
11
#line 1 "rfmtlong.pgc"
 
12
#include <stdio.h>
 
13
#include <stdlib.h>
 
14
#include <pgtypes_error.h>
 
15
#include <sqltypes.h>
 
16
 
 
17
/*
 
18
 * This file tests various forms of long-input/output by means of
 
19
 * rfmtlong
 
20
 */
 
21
 
 
22
 
 
23
static void
 
24
check_return(int ret);
 
25
 
 
26
static void
 
27
fmtlong(long lng, char *fmt)
 
28
{
 
29
        static int i;
 
30
        int r;
 
31
        char buf[30];
 
32
 
 
33
        r = rfmtlong(lng, fmt, buf);
 
34
        printf("r: %d ", r);
 
35
        if (r == 0)
 
36
        {
 
37
                printf("%d: %s (fmt was: %s)\n", i++, buf, fmt);
 
38
        }
 
39
        else
 
40
                check_return(r);
 
41
}
 
42
 
 
43
int
 
44
main(void)
 
45
{
 
46
        ECPGdebug(1, stderr);
 
47
 
 
48
        fmtlong(-8494493, "-<<<<,<<<,<<<,<<<");
 
49
        fmtlong(-8494493, "################");
 
50
        fmtlong(-8494493, "+++$$$$$$$$$$$$$.##");
 
51
        fmtlong(-8494493, "(&,&&&,&&&,&&&.)");
 
52
        fmtlong(-8494493, "<<<<,<<<,<<<,<<<");
 
53
        fmtlong(-8494493, "$************.**");
 
54
        fmtlong(-8494493, "---$************.**");
 
55
        fmtlong(-8494493, "+-+################");
 
56
        fmtlong(-8494493, "abc: ################+-+");
 
57
        fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
 
58
 
 
59
        return (0);
 
60
}
 
61
 
 
62
static void
 
63
check_return(int ret)
 
64
{
 
65
        switch(ret)
 
66
        {
 
67
                case ECPG_INFORMIX_ENOTDMY:
 
68
                        printf("(ECPG_INFORMIX_ENOTDMY)");
 
69
                        break;
 
70
                case ECPG_INFORMIX_ENOSHORTDATE:
 
71
                        printf("(ECPG_INFORMIX_ENOSHORTDATE)");
 
72
                        break;
 
73
                case ECPG_INFORMIX_BAD_DAY:
 
74
                        printf("(ECPG_INFORMIX_BAD_DAY)");
 
75
                        break;
 
76
                case ECPG_INFORMIX_BAD_MONTH:
 
77
                        printf("(ECPG_INFORMIX_BAD_MONTH)");
 
78
                        break;
 
79
                default:
 
80
                        printf("(unknown ret: %d)", ret);
 
81
                        break;
 
82
        }
 
83
        printf("\n");
 
84
}