~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/interfaces/ecpg/pgtypeslib/dt_common.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.48 2009/03/22 01:12:32 tgl Exp $ */
 
1
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.51 2009/06/11 14:49:13 momjian Exp $ */
2
2
 
3
3
#include "postgres_fe.h"
4
4
 
1132
1132
 */
1133
1133
static int
1134
1134
DecodeNumberField(int len, char *str, int fmask,
1135
 
        int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
 
1135
                                  int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
1136
1136
{
1137
1137
        char       *cp;
1138
1138
 
1258
1258
                 */
1259
1259
                if (cp - str > 2)
1260
1260
                        return DecodeNumberField(flen, str, (fmask | DTK_DATE_M),
1261
 
                                                                         tmask, tm, fsec, is2digits, EuroDates);
 
1261
                                                                         tmask, tm, fsec, is2digits);
1262
1262
 
1263
1263
                *fsec = strtod(cp, &cp);
1264
1264
                if (*cp != '\0')
1476
1476
 *      can be used to represent time spans.
1477
1477
 */
1478
1478
int
1479
 
DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
 
1479
DecodeTime(char *str, int *tmask, struct tm * tm, fsec_t *fsec)
1480
1480
{
1481
1481
        char       *cp;
1482
1482
 
1640
1640
 */
1641
1641
int
1642
1642
ParseDateTime(char *timestr, char *lowstr,
1643
 
          char **field, int *ftype, int maxfields, int *numfields, char **endstr)
 
1643
                          char **field, int *ftype, int *numfields, char **endstr)
1644
1644
{
1645
1645
        int                     nf = 0;
1646
1646
        char       *lp = lowstr;
1928
1928
                                                 * time
1929
1929
                                                 */
1930
1930
                                                if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask,
1931
 
                                                           &tmask, tm, fsec, &is2digits, EuroDates)) < 0)
 
1931
                                                                                  &tmask, tm, fsec, &is2digits)) < 0)
1932
1932
                                                        return -1;
1933
1933
 
1934
1934
                                                /*
1951
1951
                                break;
1952
1952
 
1953
1953
                        case DTK_TIME:
1954
 
                                if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
 
1954
                                if (DecodeTime(field[i], &tmask, tm, fsec) != 0)
1955
1955
                                        return -1;
1956
1956
 
1957
1957
                                /*
2116
2116
                                                case DTK_TIME:
2117
2117
                                                        /* previous field was "t" for ISO time */
2118
2118
                                                        if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
2119
 
                                                           &tmask, tm, fsec, &is2digits, EuroDates)) < 0)
 
2119
                                                                                  &tmask, tm, fsec, &is2digits)) < 0)
2120
2120
                                                                return -1;
2121
2121
 
2122
2122
                                                        if (tmask != DTK_TIME_M)
2154
2154
                                                 * Example: 20011223 or 040506
2155
2155
                                                 */
2156
2156
                                                if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
2157
 
                                                           &tmask, tm, fsec, &is2digits, EuroDates)) < 0)
 
2157
                                                                                  &tmask, tm, fsec, &is2digits)) < 0)
2158
2158
                                                        return -1;
2159
2159
                                        }
2160
2160
                                        else if (flen > 4)
2161
2161
                                        {
2162
2162
                                                if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
2163
 
                                                           &tmask, tm, fsec, &is2digits, EuroDates)) < 0)
 
2163
                                                                                  &tmask, tm, fsec, &is2digits)) < 0)
2164
2164
                                                        return -1;
2165
2165
                                        }
2166
2166
                                        /* otherwise it is a single date/time field... */
2583
2583
                           *pfmt,
2584
2584
                           *tmp;
2585
2585
        int                     err = 1;
2586
 
        int                     j;
 
2586
        unsigned int j;
2587
2587
        struct tm       tm;
2588
2588
 
2589
2589
        pfmt = fmt;
2908
2908
                                pfmt++;
2909
2909
                                scan_type = PGTYPES_TYPE_UINT;
2910
2910
                                err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
2911
 
                                if (scan_val.uint_val < 0 || scan_val.uint_val > 53)
 
2911
                                if (scan_val.uint_val > 53)
2912
2912
                                        err = 1;
2913
2913
                                break;
2914
2914
                        case 'V':
2922
2922
                                pfmt++;
2923
2923
                                scan_type = PGTYPES_TYPE_UINT;
2924
2924
                                err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
2925
 
                                if (scan_val.uint_val < 0 || scan_val.uint_val > 6)
 
2925
                                if (scan_val.uint_val > 6)
2926
2926
                                        err = 1;
2927
2927
                                break;
2928
2928
                        case 'W':
2929
2929
                                pfmt++;
2930
2930
                                scan_type = PGTYPES_TYPE_UINT;
2931
2931
                                err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
2932
 
                                if (scan_val.uint_val < 0 || scan_val.uint_val > 53)
 
2932
                                if (scan_val.uint_val > 53)
2933
2933
                                        err = 1;
2934
2934
                                break;
2935
2935
                        case 'x':