mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Another pgindent run with lib typedefs added.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
char *ECPGalloc(long, int);
|
||||
|
||||
static int
|
||||
deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *))
|
||||
deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
|
||||
{
|
||||
numeric *a1,
|
||||
*a2;
|
||||
@@ -53,7 +53,7 @@ deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *))
|
||||
}
|
||||
|
||||
static int
|
||||
deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *, numeric *, numeric *))
|
||||
deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, numeric *, numeric *))
|
||||
{
|
||||
numeric *a1,
|
||||
*a2,
|
||||
@@ -118,7 +118,7 @@ deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *
|
||||
|
||||
/* we start with the numeric functions */
|
||||
int
|
||||
decadd(decimal * arg1, decimal * arg2, decimal * sum)
|
||||
decadd(decimal *arg1, decimal *arg2, decimal *sum)
|
||||
{
|
||||
deccall3(arg1, arg2, sum, PGTYPESnumeric_add);
|
||||
|
||||
@@ -131,13 +131,13 @@ decadd(decimal * arg1, decimal * arg2, decimal * sum)
|
||||
}
|
||||
|
||||
int
|
||||
deccmp(decimal * arg1, decimal * arg2)
|
||||
deccmp(decimal *arg1, decimal *arg2)
|
||||
{
|
||||
return (deccall2(arg1, arg2, PGTYPESnumeric_cmp));
|
||||
}
|
||||
|
||||
void
|
||||
deccopy(decimal * src, decimal * target)
|
||||
deccopy(decimal *src, decimal *target)
|
||||
{
|
||||
memcpy(target, src, sizeof(decimal));
|
||||
}
|
||||
@@ -162,7 +162,7 @@ ecpg_strndup(const char *str, size_t len)
|
||||
}
|
||||
|
||||
int
|
||||
deccvasc(char *cp, int len, decimal * np)
|
||||
deccvasc(char *cp, int len, decimal *np)
|
||||
{
|
||||
char *str = ecpg_strndup(cp, len); /* decimal_in always
|
||||
* converts the complete
|
||||
@@ -208,7 +208,7 @@ deccvasc(char *cp, int len, decimal * np)
|
||||
}
|
||||
|
||||
int
|
||||
deccvdbl(double dbl, decimal * np)
|
||||
deccvdbl(double dbl, decimal *np)
|
||||
{
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
int result = 1;
|
||||
@@ -229,7 +229,7 @@ deccvdbl(double dbl, decimal * np)
|
||||
}
|
||||
|
||||
int
|
||||
deccvint(int in, decimal * np)
|
||||
deccvint(int in, decimal *np)
|
||||
{
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
int result = 1;
|
||||
@@ -250,7 +250,7 @@ deccvint(int in, decimal * np)
|
||||
}
|
||||
|
||||
int
|
||||
deccvlong(long lng, decimal * np)
|
||||
deccvlong(long lng, decimal *np)
|
||||
{
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
int result = 1;
|
||||
@@ -271,7 +271,7 @@ deccvlong(long lng, decimal * np)
|
||||
}
|
||||
|
||||
int
|
||||
decdiv(decimal * n1, decimal * n2, decimal * result)
|
||||
decdiv(decimal *n1, decimal *n2, decimal *result)
|
||||
{
|
||||
|
||||
int i;
|
||||
@@ -296,7 +296,7 @@ decdiv(decimal * n1, decimal * n2, decimal * result)
|
||||
}
|
||||
|
||||
int
|
||||
decmul(decimal * n1, decimal * n2, decimal * result)
|
||||
decmul(decimal *n1, decimal *n2, decimal *result)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -317,7 +317,7 @@ decmul(decimal * n1, decimal * n2, decimal * result)
|
||||
}
|
||||
|
||||
int
|
||||
decsub(decimal * n1, decimal * n2, decimal * result)
|
||||
decsub(decimal *n1, decimal *n2, decimal *result)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -338,7 +338,7 @@ decsub(decimal * n1, decimal * n2, decimal * result)
|
||||
}
|
||||
|
||||
int
|
||||
dectoasc(decimal * np, char *cp, int len, int right)
|
||||
dectoasc(decimal *np, char *cp, int len, int right)
|
||||
{
|
||||
char *str;
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
@@ -373,7 +373,7 @@ dectoasc(decimal * np, char *cp, int len, int right)
|
||||
}
|
||||
|
||||
int
|
||||
dectodbl(decimal * np, double *dblp)
|
||||
dectodbl(decimal *np, double *dblp)
|
||||
{
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
int i;
|
||||
@@ -391,7 +391,7 @@ dectodbl(decimal * np, double *dblp)
|
||||
}
|
||||
|
||||
int
|
||||
dectoint(decimal * np, int *ip)
|
||||
dectoint(decimal *np, int *ip)
|
||||
{
|
||||
int ret;
|
||||
numeric *nres = PGTYPESnumeric_new();
|
||||
@@ -411,7 +411,7 @@ dectoint(decimal * np, int *ip)
|
||||
}
|
||||
|
||||
int
|
||||
dectolong(decimal * np, long *lngp)
|
||||
dectolong(decimal *np, long *lngp)
|
||||
{
|
||||
int ret;
|
||||
numeric *nres = PGTYPESnumeric_new();;
|
||||
@@ -453,7 +453,7 @@ rdatestr(date d, char *str)
|
||||
*
|
||||
*/
|
||||
int
|
||||
rstrdate(char *str, date * d)
|
||||
rstrdate(char *str, date *d)
|
||||
{
|
||||
date dat;
|
||||
char strbuf[10];
|
||||
@@ -511,7 +511,7 @@ rstrdate(char *str, date * d)
|
||||
}
|
||||
|
||||
void
|
||||
rtoday(date * d)
|
||||
rtoday(date *d)
|
||||
{
|
||||
PGTYPESdate_today(d);
|
||||
return;
|
||||
@@ -530,7 +530,7 @@ rjulmdy(date d, short mdy[3])
|
||||
}
|
||||
|
||||
int
|
||||
rdefmtdate(date * d, char *fmt, char *str)
|
||||
rdefmtdate(date *d, char *fmt, char *str)
|
||||
{
|
||||
/* TODO: take care of DBCENTURY environment variable */
|
||||
/* PGSQL functions allow all centuries */
|
||||
@@ -567,7 +567,7 @@ rfmtdate(date d, char *fmt, char *str)
|
||||
}
|
||||
|
||||
int
|
||||
rmdyjul(short mdy[3], date * d)
|
||||
rmdyjul(short mdy[3], date *d)
|
||||
{
|
||||
int mdy_int[3];
|
||||
|
||||
@@ -587,13 +587,13 @@ rdayofweek(date d)
|
||||
/* And the datetime stuff */
|
||||
|
||||
void
|
||||
dtcurrent(timestamp * ts)
|
||||
dtcurrent(timestamp *ts)
|
||||
{
|
||||
PGTYPEStimestamp_current(ts);
|
||||
}
|
||||
|
||||
int
|
||||
dtcvasc(char *str, timestamp * ts)
|
||||
dtcvasc(char *str, timestamp *ts)
|
||||
{
|
||||
timestamp ts_tmp;
|
||||
int i;
|
||||
@@ -616,13 +616,13 @@ dtcvasc(char *str, timestamp * ts)
|
||||
}
|
||||
|
||||
int
|
||||
dtsub(timestamp * ts1, timestamp * ts2, interval * iv)
|
||||
dtsub(timestamp *ts1, timestamp *ts2, interval *iv)
|
||||
{
|
||||
return PGTYPEStimestamp_sub(ts1, ts2, iv);
|
||||
}
|
||||
|
||||
int
|
||||
dttoasc(timestamp * ts, char *output)
|
||||
dttoasc(timestamp *ts, char *output)
|
||||
{
|
||||
char *asctime = PGTYPEStimestamp_to_asc(*ts);
|
||||
|
||||
@@ -632,13 +632,13 @@ dttoasc(timestamp * ts, char *output)
|
||||
}
|
||||
|
||||
int
|
||||
dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr)
|
||||
dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr)
|
||||
{
|
||||
return PGTYPEStimestamp_fmt_asc(ts, output, str_len, fmtstr);
|
||||
}
|
||||
|
||||
int
|
||||
intoasc(interval * i, char *str)
|
||||
intoasc(interval *i, char *str)
|
||||
{
|
||||
str = PGTYPESinterval_to_asc(i);
|
||||
|
||||
@@ -963,7 +963,7 @@ rtypwidth(int sqltype, int sqllen)
|
||||
}
|
||||
|
||||
int
|
||||
dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue)
|
||||
dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue)
|
||||
{
|
||||
return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef struct
|
||||
#endif
|
||||
long month; /* months and years, after time for
|
||||
* alignment */
|
||||
} interval;
|
||||
} interval;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct
|
||||
* NUMERIC_NAN */
|
||||
NumericDigit *buf; /* start of alloc'd space for digits[] */
|
||||
NumericDigit *digits; /* decimal digits */
|
||||
} numeric;
|
||||
} numeric;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -35,14 +35,14 @@ typedef struct
|
||||
int sign; /* NUMERIC_POS, NUMERIC_NEG, or
|
||||
* NUMERIC_NAN */
|
||||
NumericDigit digits[DECSIZE]; /* decimal digits */
|
||||
} decimal;
|
||||
} decimal;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
numeric * PGTYPESnumeric_new(void);
|
||||
numeric *PGTYPESnumeric_new(void);
|
||||
void PGTYPESnumeric_free(numeric *);
|
||||
numeric *PGTYPESnumeric_from_asc(char *, char **);
|
||||
char *PGTYPESnumeric_to_asc(numeric *, int);
|
||||
|
||||
@@ -111,7 +111,7 @@ PGTYPESdate_julmdy(date jd, int *mdy)
|
||||
}
|
||||
|
||||
void
|
||||
PGTYPESdate_mdyjul(int *mdy, date * jdate)
|
||||
PGTYPESdate_mdyjul(int *mdy, date *jdate)
|
||||
{
|
||||
/* month is mdy[0] */
|
||||
/* day is mdy[1] */
|
||||
@@ -124,14 +124,14 @@ int
|
||||
PGTYPESdate_dayofweek(date dDate)
|
||||
{
|
||||
/*
|
||||
* Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday:
|
||||
* 4 Friday: 5 Saturday: 6
|
||||
* Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday: 4
|
||||
* Friday: 5 Saturday: 6
|
||||
*/
|
||||
return (int) (dDate + date2j(2000, 1, 1) + 1) % 7;
|
||||
}
|
||||
|
||||
void
|
||||
PGTYPESdate_today(date * d)
|
||||
PGTYPESdate_today(date *d)
|
||||
{
|
||||
struct tm ts;
|
||||
|
||||
@@ -316,7 +316,7 @@ PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf)
|
||||
|
||||
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */
|
||||
int
|
||||
PGTYPESdate_defmt_asc(date * d, char *fmt, char *str)
|
||||
PGTYPESdate_defmt_asc(date *d, char *fmt, char *str)
|
||||
{
|
||||
/*
|
||||
* token[2] = { 4,6 } means that token 2 starts at position 4 and ends
|
||||
|
||||
@@ -2729,7 +2729,7 @@ int PGTYPEStimestamp_defmt_scan(char **, char *, timestamp *, int *, int *, int
|
||||
int *, int *, int *, int *);
|
||||
|
||||
int
|
||||
PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
|
||||
PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp *d,
|
||||
int *year, int *month, int *day,
|
||||
int *hour, int *minute, int *second,
|
||||
int *tz)
|
||||
|
||||
@@ -720,7 +720,7 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec)
|
||||
} /* interval2tm() */
|
||||
|
||||
static int
|
||||
tm2interval(struct tm * tm, fsec_t fsec, interval * span)
|
||||
tm2interval(struct tm * tm, fsec_t fsec, interval *span)
|
||||
{
|
||||
span->month = ((tm->tm_year * 12) + tm->tm_mon);
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
@@ -797,7 +797,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr)
|
||||
}
|
||||
|
||||
char *
|
||||
PGTYPESinterval_to_asc(interval * span)
|
||||
PGTYPESinterval_to_asc(interval *span)
|
||||
{
|
||||
struct tm tt,
|
||||
*tm = &tt;
|
||||
@@ -821,7 +821,7 @@ PGTYPESinterval_to_asc(interval * span)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESinterval_copy(interval * intvlsrc, interval * intrcldest)
|
||||
PGTYPESinterval_copy(interval *intvlsrc, interval *intrcldest)
|
||||
{
|
||||
intrcldest->time = intvlsrc->time;
|
||||
intrcldest->month = intvlsrc->month;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
apply_typmod(numeric * var, long typmod)
|
||||
apply_typmod(numeric *var, long typmod)
|
||||
{
|
||||
int precision;
|
||||
int scale;
|
||||
@@ -108,7 +108,7 @@ apply_typmod(numeric * var, long typmod)
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
alloc_var(numeric * var, int ndigits)
|
||||
alloc_var(numeric *var, int ndigits)
|
||||
{
|
||||
digitbuf_free(var->buf);
|
||||
var->buf = digitbuf_alloc(ndigits + 1);
|
||||
@@ -141,7 +141,7 @@ PGTYPESnumeric_new(void)
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
set_var_from_str(char *str, char **ptr, numeric * dest)
|
||||
set_var_from_str(char *str, char **ptr, numeric *dest)
|
||||
{
|
||||
bool have_dp = FALSE;
|
||||
int i = 0;
|
||||
@@ -271,7 +271,7 @@ set_var_from_str(char *str, char **ptr, numeric * dest)
|
||||
* ----------
|
||||
*/
|
||||
static char *
|
||||
get_str_from_var(numeric * var, int dscale)
|
||||
get_str_from_var(numeric *var, int dscale)
|
||||
{
|
||||
char *str;
|
||||
char *cp;
|
||||
@@ -385,7 +385,7 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
|
||||
}
|
||||
|
||||
char *
|
||||
PGTYPESnumeric_to_asc(numeric * num, int dscale)
|
||||
PGTYPESnumeric_to_asc(numeric *num, int dscale)
|
||||
{
|
||||
if (dscale < 0)
|
||||
dscale = num->dscale;
|
||||
@@ -401,7 +401,7 @@ PGTYPESnumeric_to_asc(numeric * num, int dscale)
|
||||
* ----------
|
||||
*/
|
||||
static void
|
||||
zero_var(numeric * var)
|
||||
zero_var(numeric *var)
|
||||
{
|
||||
digitbuf_free(var->buf);
|
||||
var->buf = NULL;
|
||||
@@ -412,7 +412,7 @@ zero_var(numeric * var)
|
||||
}
|
||||
|
||||
void
|
||||
PGTYPESnumeric_free(numeric * var)
|
||||
PGTYPESnumeric_free(numeric *var)
|
||||
{
|
||||
digitbuf_free(var->buf);
|
||||
free(var);
|
||||
@@ -428,7 +428,7 @@ PGTYPESnumeric_free(numeric * var)
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
cmp_abs(numeric * var1, numeric * var2)
|
||||
cmp_abs(numeric *var1, numeric *var2)
|
||||
{
|
||||
int i1 = 0;
|
||||
int i2 = 0;
|
||||
@@ -486,7 +486,7 @@ cmp_abs(numeric * var1, numeric * var2)
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
add_abs(numeric * var1, numeric * var2, numeric * result)
|
||||
add_abs(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
NumericDigit *res_buf;
|
||||
NumericDigit *res_digits;
|
||||
@@ -574,7 +574,7 @@ add_abs(numeric * var1, numeric * var2, numeric * result)
|
||||
* ----------
|
||||
*/
|
||||
static int
|
||||
sub_abs(numeric * var1, numeric * var2, numeric * result)
|
||||
sub_abs(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
NumericDigit *res_buf;
|
||||
NumericDigit *res_digits;
|
||||
@@ -658,7 +658,7 @@ sub_abs(numeric * var1, numeric * var2, numeric * result)
|
||||
* ----------
|
||||
*/
|
||||
int
|
||||
PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result)
|
||||
PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
/*
|
||||
* Decide on the signs of the two variables what to do
|
||||
@@ -787,7 +787,7 @@ PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result)
|
||||
* ----------
|
||||
*/
|
||||
int
|
||||
PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result)
|
||||
PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
/*
|
||||
* Decide on the signs of the two variables what to do
|
||||
@@ -918,7 +918,7 @@ PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result)
|
||||
* ----------
|
||||
*/
|
||||
int
|
||||
PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result)
|
||||
PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
NumericDigit *res_buf;
|
||||
NumericDigit *res_digits;
|
||||
@@ -1009,7 +1009,7 @@ PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result)
|
||||
* Note that this must be called before div_var.
|
||||
*/
|
||||
static int
|
||||
select_div_scale(numeric * var1, numeric * var2, int *rscale)
|
||||
select_div_scale(numeric *var1, numeric *var2, int *rscale)
|
||||
{
|
||||
int weight1,
|
||||
weight2,
|
||||
@@ -1076,7 +1076,7 @@ select_div_scale(numeric * var1, numeric * var2, int *rscale)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result)
|
||||
PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result)
|
||||
{
|
||||
NumericDigit *res_digits;
|
||||
int res_ndigits;
|
||||
@@ -1282,7 +1282,7 @@ PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result)
|
||||
|
||||
|
||||
int
|
||||
PGTYPESnumeric_cmp(numeric * var1, numeric * var2)
|
||||
PGTYPESnumeric_cmp(numeric *var1, numeric *var2)
|
||||
{
|
||||
|
||||
/* use cmp_abs function to calculate the result */
|
||||
@@ -1313,7 +1313,7 @@ PGTYPESnumeric_cmp(numeric * var1, numeric * var2)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_from_int(signed int int_val, numeric * var)
|
||||
PGTYPESnumeric_from_int(signed int int_val, numeric *var)
|
||||
{
|
||||
/* implicit conversion */
|
||||
signed long int long_int = int_val;
|
||||
@@ -1322,7 +1322,7 @@ PGTYPESnumeric_from_int(signed int int_val, numeric * var)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_from_long(signed long int long_val, numeric * var)
|
||||
PGTYPESnumeric_from_long(signed long int long_val, numeric *var)
|
||||
{
|
||||
/* calculate the size of the long int number */
|
||||
/* a number n needs log_10 n digits */
|
||||
@@ -1392,7 +1392,7 @@ PGTYPESnumeric_from_long(signed long int long_val, numeric * var)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_copy(numeric * src, numeric * dst)
|
||||
PGTYPESnumeric_copy(numeric *src, numeric *dst)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1415,7 +1415,7 @@ PGTYPESnumeric_copy(numeric * src, numeric * dst)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_from_double(double d, numeric * dst)
|
||||
PGTYPESnumeric_from_double(double d, numeric *dst)
|
||||
{
|
||||
char buffer[100];
|
||||
numeric *tmp;
|
||||
@@ -1432,7 +1432,7 @@ PGTYPESnumeric_from_double(double d, numeric * dst)
|
||||
}
|
||||
|
||||
static int
|
||||
numericvar_to_double_no_overflow(numeric * var, double *dp)
|
||||
numericvar_to_double_no_overflow(numeric *var, double *dp)
|
||||
{
|
||||
char *tmp;
|
||||
double val;
|
||||
@@ -1456,7 +1456,7 @@ numericvar_to_double_no_overflow(numeric * var, double *dp)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_to_double(numeric * nv, double *dp)
|
||||
PGTYPESnumeric_to_double(numeric *nv, double *dp)
|
||||
{
|
||||
double tmp;
|
||||
int i;
|
||||
@@ -1468,7 +1468,7 @@ PGTYPESnumeric_to_double(numeric * nv, double *dp)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_to_int(numeric * nv, int *ip)
|
||||
PGTYPESnumeric_to_int(numeric *nv, int *ip)
|
||||
{
|
||||
long l;
|
||||
int i;
|
||||
@@ -1487,7 +1487,7 @@ PGTYPESnumeric_to_int(numeric * nv, int *ip)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_to_long(numeric * nv, long *lp)
|
||||
PGTYPESnumeric_to_long(numeric *nv, long *lp)
|
||||
{
|
||||
int i;
|
||||
long l = 0;
|
||||
@@ -1515,7 +1515,7 @@ PGTYPESnumeric_to_long(numeric * nv, long *lp)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_to_decimal(numeric * src, decimal * dst)
|
||||
PGTYPESnumeric_to_decimal(numeric *src, decimal *dst)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1538,7 +1538,7 @@ PGTYPESnumeric_to_decimal(numeric * src, decimal * dst)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPESnumeric_from_decimal(decimal * src, numeric * dst)
|
||||
PGTYPESnumeric_from_decimal(decimal *src, numeric *dst)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ dt2local(timestamp dt, int tz)
|
||||
* Returns -1 on failure (overflow).
|
||||
*/
|
||||
int
|
||||
tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp * result)
|
||||
tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp *result)
|
||||
{
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
int dDate;
|
||||
@@ -372,7 +372,7 @@ PGTYPEStimestamp_to_asc(timestamp tstamp)
|
||||
}
|
||||
|
||||
void
|
||||
PGTYPEStimestamp_current(timestamp * ts)
|
||||
PGTYPEStimestamp_current(timestamp *ts)
|
||||
{
|
||||
struct tm tm;
|
||||
|
||||
@@ -382,7 +382,7 @@ PGTYPEStimestamp_current(timestamp * ts)
|
||||
}
|
||||
|
||||
static int
|
||||
dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
|
||||
dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm,
|
||||
char *output, int *pstr_len, char *fmtstr)
|
||||
{
|
||||
union un_fmt_comb replace_val;
|
||||
@@ -772,7 +772,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
|
||||
|
||||
|
||||
int
|
||||
PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr)
|
||||
PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, char *fmtstr)
|
||||
{
|
||||
struct tm tm;
|
||||
fsec_t fsec;
|
||||
@@ -787,7 +787,7 @@ PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
|
||||
PGTYPEStimestamp_sub(timestamp *ts1, timestamp *ts2, interval *iv)
|
||||
{
|
||||
if (TIMESTAMP_NOT_FINITE(*ts1) || TIMESTAMP_NOT_FINITE(*ts2))
|
||||
return PGTYPES_TS_ERR_EINFTIME;
|
||||
@@ -804,7 +804,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
|
||||
}
|
||||
|
||||
int
|
||||
PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp * d)
|
||||
PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp *d)
|
||||
{
|
||||
int year,
|
||||
month,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.65 2004/08/29 04:13:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.66 2004/08/30 02:54:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,300 +42,300 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"analyze", ANALYZE},
|
||||
{"and", AND},
|
||||
{"any", ANY},
|
||||
{"array", ARRAY},
|
||||
{"as", AS},
|
||||
{"asc", ASC},
|
||||
{"assertion", ASSERTION},
|
||||
{"assignment", ASSIGNMENT},
|
||||
{"at", AT},
|
||||
{"authorization", AUTHORIZATION},
|
||||
{"backward", BACKWARD},
|
||||
{"before", BEFORE},
|
||||
{"begin", BEGIN_P},
|
||||
{"between", BETWEEN},
|
||||
{"bigint", BIGINT},
|
||||
{"binary", BINARY},
|
||||
{"bit", BIT},
|
||||
{"boolean", BOOLEAN_P},
|
||||
{"both", BOTH},
|
||||
{"by", BY},
|
||||
{"cache", CACHE},
|
||||
{"called", CALLED},
|
||||
{"cascade", CASCADE},
|
||||
{"case", CASE},
|
||||
{"cast", CAST},
|
||||
{"chain", CHAIN},
|
||||
{"char", CHAR_P},
|
||||
{"character", CHARACTER},
|
||||
{"characteristics", CHARACTERISTICS},
|
||||
{"check", CHECK},
|
||||
{"checkpoint", CHECKPOINT},
|
||||
{"class", CLASS},
|
||||
{"close", CLOSE},
|
||||
{"cluster", CLUSTER},
|
||||
{"coalesce", COALESCE},
|
||||
{"collate", COLLATE},
|
||||
{"column", COLUMN},
|
||||
{"comment", COMMENT},
|
||||
{"commit", COMMIT},
|
||||
{"committed", COMMITTED},
|
||||
{"constraint", CONSTRAINT},
|
||||
{"constraints", CONSTRAINTS},
|
||||
{"conversion", CONVERSION_P},
|
||||
{"convert", CONVERT},
|
||||
{"copy", COPY},
|
||||
{"create", CREATE},
|
||||
{"createdb", CREATEDB},
|
||||
{"createuser", CREATEUSER},
|
||||
{"cross", CROSS},
|
||||
{"csv", CSV},
|
||||
{"current_date", CURRENT_DATE},
|
||||
{"current_time", CURRENT_TIME},
|
||||
{"current_timestamp", CURRENT_TIMESTAMP},
|
||||
{"current_user", CURRENT_USER},
|
||||
{"cursor", CURSOR},
|
||||
{"cycle", CYCLE},
|
||||
{"database", DATABASE},
|
||||
{"day", DAY_P},
|
||||
{"deallocate", DEALLOCATE},
|
||||
{"dec", DEC},
|
||||
{"decimal", DECIMAL_P},
|
||||
{"declare", DECLARE},
|
||||
{"default", DEFAULT},
|
||||
{"defaults", DEFAULTS},
|
||||
{"deferrable", DEFERRABLE},
|
||||
{"deferred", DEFERRED},
|
||||
{"definer", DEFINER},
|
||||
{"delete", DELETE_P},
|
||||
{"delimiter", DELIMITER},
|
||||
{"delimiters", DELIMITERS},
|
||||
{"desc", DESC},
|
||||
{"distinct", DISTINCT},
|
||||
{"do", DO},
|
||||
{"domain", DOMAIN_P},
|
||||
{"double", DOUBLE_P},
|
||||
{"drop", DROP},
|
||||
{"each", EACH},
|
||||
{"else", ELSE},
|
||||
{"encoding", ENCODING},
|
||||
{"encrypted", ENCRYPTED},
|
||||
{"end", END_P},
|
||||
{"escape", ESCAPE},
|
||||
{"except", EXCEPT},
|
||||
{"excluding", EXCLUDING},
|
||||
{"exclusive", EXCLUSIVE},
|
||||
{"execute", EXECUTE},
|
||||
{"exists", EXISTS},
|
||||
{"explain", EXPLAIN},
|
||||
{"external", EXTERNAL},
|
||||
{"extract", EXTRACT},
|
||||
{"false", FALSE_P},
|
||||
{"fetch", FETCH},
|
||||
{"first", FIRST_P},
|
||||
{"float", FLOAT_P},
|
||||
{"for", FOR},
|
||||
{"force", FORCE},
|
||||
{"foreign", FOREIGN},
|
||||
{"forward", FORWARD},
|
||||
{"freeze", FREEZE},
|
||||
{"from", FROM},
|
||||
{"full", FULL},
|
||||
{"function", FUNCTION},
|
||||
{"get", GET},
|
||||
{"global", GLOBAL},
|
||||
{"grant", GRANT},
|
||||
{"group", GROUP_P},
|
||||
{"handler", HANDLER},
|
||||
{"having", HAVING},
|
||||
{"hold", HOLD},
|
||||
{"hour", HOUR_P},
|
||||
{"ilike", ILIKE},
|
||||
{"immediate", IMMEDIATE},
|
||||
{"immutable", IMMUTABLE},
|
||||
{"implicit", IMPLICIT_P},
|
||||
{"in", IN_P},
|
||||
{"including", INCLUDING},
|
||||
{"increment", INCREMENT},
|
||||
{"index", INDEX},
|
||||
{"inherits", INHERITS},
|
||||
{"initially", INITIALLY},
|
||||
{"inner", INNER_P},
|
||||
{"inout", INOUT},
|
||||
{"input", INPUT_P},
|
||||
{"insensitive", INSENSITIVE},
|
||||
{"insert", INSERT},
|
||||
{"instead", INSTEAD},
|
||||
{"int", INT_P},
|
||||
{"integer", INTEGER},
|
||||
{"intersect", INTERSECT},
|
||||
{"interval", INTERVAL},
|
||||
{"into", INTO},
|
||||
{"invoker", INVOKER},
|
||||
{"is", IS},
|
||||
{"isnull", ISNULL},
|
||||
{"isolation", ISOLATION},
|
||||
{"join", JOIN},
|
||||
{"key", KEY},
|
||||
{"lancompiler", LANCOMPILER},
|
||||
{"language", LANGUAGE},
|
||||
{"large", LARGE_P},
|
||||
{"last", LAST_P},
|
||||
{"leading", LEADING},
|
||||
{"left", LEFT},
|
||||
{"level", LEVEL},
|
||||
{"like", LIKE},
|
||||
{"limit", LIMIT},
|
||||
{"listen", LISTEN},
|
||||
{"load", LOAD},
|
||||
{"local", LOCAL},
|
||||
{"location", LOCATION},
|
||||
{"lock", LOCK_P},
|
||||
{"match", MATCH},
|
||||
{"maxvalue", MAXVALUE},
|
||||
{"minute", MINUTE_P},
|
||||
{"minvalue", MINVALUE},
|
||||
{"mode", MODE},
|
||||
{"month", MONTH_P},
|
||||
{"move", MOVE},
|
||||
{"names", NAMES},
|
||||
{"national", NATIONAL},
|
||||
{"natural", NATURAL},
|
||||
{"nchar", NCHAR},
|
||||
{"new", NEW},
|
||||
{"next", NEXT},
|
||||
{"no", NO},
|
||||
{"nocreatedb", NOCREATEDB},
|
||||
{"nocreateuser", NOCREATEUSER},
|
||||
{"none", NONE},
|
||||
{"not", NOT},
|
||||
{"nothing", NOTHING},
|
||||
{"notify", NOTIFY},
|
||||
{"notnull", NOTNULL},
|
||||
{"nowait", NOWAIT},
|
||||
{"null", NULL_P},
|
||||
{"nullif", NULLIF},
|
||||
{"numeric", NUMERIC},
|
||||
{"object", OBJECT_P},
|
||||
{"of", OF},
|
||||
{"off", OFF},
|
||||
{"offset", OFFSET},
|
||||
{"oids", OIDS},
|
||||
{"old", OLD},
|
||||
{"on", ON},
|
||||
{"only", ONLY},
|
||||
{"operator", OPERATOR},
|
||||
{"option", OPTION},
|
||||
{"or", OR},
|
||||
{"order", ORDER},
|
||||
{"out", OUT_P},
|
||||
{"outer", OUTER_P},
|
||||
{"overlaps", OVERLAPS},
|
||||
{"owner", OWNER},
|
||||
{"partial", PARTIAL},
|
||||
{"password", PASSWORD},
|
||||
{"position", POSITION},
|
||||
{"precision", PRECISION},
|
||||
{"prepare", PREPARE},
|
||||
{"preserve", PRESERVE},
|
||||
{"primary", PRIMARY},
|
||||
{"prior", PRIOR},
|
||||
{"privileges", PRIVILEGES},
|
||||
{"procedural", PROCEDURAL},
|
||||
{"procedure", PROCEDURE},
|
||||
{"quote", QUOTE},
|
||||
{"read", READ},
|
||||
{"real", REAL},
|
||||
{"recheck", RECHECK},
|
||||
{"references", REFERENCES},
|
||||
{"reindex", REINDEX},
|
||||
{"relative", RELATIVE_P},
|
||||
{"rename", RENAME},
|
||||
{"repeatable", REPEATABLE},
|
||||
{"replace", REPLACE},
|
||||
{"reset", RESET},
|
||||
{"restart", RESTART},
|
||||
{"restrict", RESTRICT},
|
||||
{"returns", RETURNS},
|
||||
{"revoke", REVOKE},
|
||||
{"right", RIGHT},
|
||||
{"rollback", ROLLBACK},
|
||||
{"row", ROW},
|
||||
{"rows", ROWS},
|
||||
{"rule", RULE},
|
||||
{"schema", SCHEMA},
|
||||
{"scroll", SCROLL},
|
||||
{"second", SECOND_P},
|
||||
{"security", SECURITY},
|
||||
{"select", SELECT},
|
||||
{"sequence", SEQUENCE},
|
||||
{"serializable", SERIALIZABLE},
|
||||
{"session", SESSION},
|
||||
{"session_user", SESSION_USER},
|
||||
{"set", SET},
|
||||
{"setof", SETOF},
|
||||
{"share", SHARE},
|
||||
{"show", SHOW},
|
||||
{"similar", SIMILAR},
|
||||
{"simple", SIMPLE},
|
||||
{"smallint", SMALLINT},
|
||||
{"some", SOME},
|
||||
{"stable", STABLE},
|
||||
{"start", START},
|
||||
{"statement", STATEMENT},
|
||||
{"statistics", STATISTICS},
|
||||
{"stdin", STDIN},
|
||||
{"stdout", STDOUT},
|
||||
{"storage", STORAGE},
|
||||
{"strict", STRICT_P},
|
||||
{"substring", SUBSTRING},
|
||||
{"sysid", SYSID},
|
||||
{"table", TABLE},
|
||||
{"tablespace", TABLESPACE},
|
||||
{"temp", TEMP},
|
||||
{"template", TEMPLATE},
|
||||
{"temporary", TEMPORARY},
|
||||
{"then", THEN},
|
||||
{"time", TIME},
|
||||
{"timestamp", TIMESTAMP},
|
||||
{"to", TO},
|
||||
{"toast", TOAST},
|
||||
{"trailing", TRAILING},
|
||||
{"transaction", TRANSACTION},
|
||||
{"treat", TREAT},
|
||||
{"trigger", TRIGGER},
|
||||
{"trim", TRIM},
|
||||
{"true", TRUE_P},
|
||||
{"truncate", TRUNCATE},
|
||||
{"trusted", TRUSTED},
|
||||
{"type", TYPE_P},
|
||||
{"uncommitted", UNCOMMITTED},
|
||||
{"unencrypted", UNENCRYPTED},
|
||||
{"union", UNION},
|
||||
{"unique", UNIQUE},
|
||||
{"unknown", UNKNOWN},
|
||||
{"unlisten", UNLISTEN},
|
||||
{"until", UNTIL},
|
||||
{"update", UPDATE},
|
||||
{"usage", USAGE},
|
||||
{"user", USER},
|
||||
{"using", USING},
|
||||
{"vacuum", VACUUM},
|
||||
{"valid", VALID},
|
||||
{"values", VALUES},
|
||||
{"varchar", VARCHAR},
|
||||
{"varying", VARYING},
|
||||
{"verbose", VERBOSE},
|
||||
{"view", VIEW},
|
||||
{"volatile", VOLATILE},
|
||||
{"when", WHEN},
|
||||
{"where", WHERE},
|
||||
{"with", WITH},
|
||||
{"without", WITHOUT},
|
||||
{"work", WORK},
|
||||
{"write", WRITE},
|
||||
{"year", YEAR_P},
|
||||
{"zone", ZONE},
|
||||
};
|
||||
{"array", ARRAY},
|
||||
{"as", AS},
|
||||
{"asc", ASC},
|
||||
{"assertion", ASSERTION},
|
||||
{"assignment", ASSIGNMENT},
|
||||
{"at", AT},
|
||||
{"authorization", AUTHORIZATION},
|
||||
{"backward", BACKWARD},
|
||||
{"before", BEFORE},
|
||||
{"begin", BEGIN_P},
|
||||
{"between", BETWEEN},
|
||||
{"bigint", BIGINT},
|
||||
{"binary", BINARY},
|
||||
{"bit", BIT},
|
||||
{"boolean", BOOLEAN_P},
|
||||
{"both", BOTH},
|
||||
{"by", BY},
|
||||
{"cache", CACHE},
|
||||
{"called", CALLED},
|
||||
{"cascade", CASCADE},
|
||||
{"case", CASE},
|
||||
{"cast", CAST},
|
||||
{"chain", CHAIN},
|
||||
{"char", CHAR_P},
|
||||
{"character", CHARACTER},
|
||||
{"characteristics", CHARACTERISTICS},
|
||||
{"check", CHECK},
|
||||
{"checkpoint", CHECKPOINT},
|
||||
{"class", CLASS},
|
||||
{"close", CLOSE},
|
||||
{"cluster", CLUSTER},
|
||||
{"coalesce", COALESCE},
|
||||
{"collate", COLLATE},
|
||||
{"column", COLUMN},
|
||||
{"comment", COMMENT},
|
||||
{"commit", COMMIT},
|
||||
{"committed", COMMITTED},
|
||||
{"constraint", CONSTRAINT},
|
||||
{"constraints", CONSTRAINTS},
|
||||
{"conversion", CONVERSION_P},
|
||||
{"convert", CONVERT},
|
||||
{"copy", COPY},
|
||||
{"create", CREATE},
|
||||
{"createdb", CREATEDB},
|
||||
{"createuser", CREATEUSER},
|
||||
{"cross", CROSS},
|
||||
{"csv", CSV},
|
||||
{"current_date", CURRENT_DATE},
|
||||
{"current_time", CURRENT_TIME},
|
||||
{"current_timestamp", CURRENT_TIMESTAMP},
|
||||
{"current_user", CURRENT_USER},
|
||||
{"cursor", CURSOR},
|
||||
{"cycle", CYCLE},
|
||||
{"database", DATABASE},
|
||||
{"day", DAY_P},
|
||||
{"deallocate", DEALLOCATE},
|
||||
{"dec", DEC},
|
||||
{"decimal", DECIMAL_P},
|
||||
{"declare", DECLARE},
|
||||
{"default", DEFAULT},
|
||||
{"defaults", DEFAULTS},
|
||||
{"deferrable", DEFERRABLE},
|
||||
{"deferred", DEFERRED},
|
||||
{"definer", DEFINER},
|
||||
{"delete", DELETE_P},
|
||||
{"delimiter", DELIMITER},
|
||||
{"delimiters", DELIMITERS},
|
||||
{"desc", DESC},
|
||||
{"distinct", DISTINCT},
|
||||
{"do", DO},
|
||||
{"domain", DOMAIN_P},
|
||||
{"double", DOUBLE_P},
|
||||
{"drop", DROP},
|
||||
{"each", EACH},
|
||||
{"else", ELSE},
|
||||
{"encoding", ENCODING},
|
||||
{"encrypted", ENCRYPTED},
|
||||
{"end", END_P},
|
||||
{"escape", ESCAPE},
|
||||
{"except", EXCEPT},
|
||||
{"excluding", EXCLUDING},
|
||||
{"exclusive", EXCLUSIVE},
|
||||
{"execute", EXECUTE},
|
||||
{"exists", EXISTS},
|
||||
{"explain", EXPLAIN},
|
||||
{"external", EXTERNAL},
|
||||
{"extract", EXTRACT},
|
||||
{"false", FALSE_P},
|
||||
{"fetch", FETCH},
|
||||
{"first", FIRST_P},
|
||||
{"float", FLOAT_P},
|
||||
{"for", FOR},
|
||||
{"force", FORCE},
|
||||
{"foreign", FOREIGN},
|
||||
{"forward", FORWARD},
|
||||
{"freeze", FREEZE},
|
||||
{"from", FROM},
|
||||
{"full", FULL},
|
||||
{"function", FUNCTION},
|
||||
{"get", GET},
|
||||
{"global", GLOBAL},
|
||||
{"grant", GRANT},
|
||||
{"group", GROUP_P},
|
||||
{"handler", HANDLER},
|
||||
{"having", HAVING},
|
||||
{"hold", HOLD},
|
||||
{"hour", HOUR_P},
|
||||
{"ilike", ILIKE},
|
||||
{"immediate", IMMEDIATE},
|
||||
{"immutable", IMMUTABLE},
|
||||
{"implicit", IMPLICIT_P},
|
||||
{"in", IN_P},
|
||||
{"including", INCLUDING},
|
||||
{"increment", INCREMENT},
|
||||
{"index", INDEX},
|
||||
{"inherits", INHERITS},
|
||||
{"initially", INITIALLY},
|
||||
{"inner", INNER_P},
|
||||
{"inout", INOUT},
|
||||
{"input", INPUT_P},
|
||||
{"insensitive", INSENSITIVE},
|
||||
{"insert", INSERT},
|
||||
{"instead", INSTEAD},
|
||||
{"int", INT_P},
|
||||
{"integer", INTEGER},
|
||||
{"intersect", INTERSECT},
|
||||
{"interval", INTERVAL},
|
||||
{"into", INTO},
|
||||
{"invoker", INVOKER},
|
||||
{"is", IS},
|
||||
{"isnull", ISNULL},
|
||||
{"isolation", ISOLATION},
|
||||
{"join", JOIN},
|
||||
{"key", KEY},
|
||||
{"lancompiler", LANCOMPILER},
|
||||
{"language", LANGUAGE},
|
||||
{"large", LARGE_P},
|
||||
{"last", LAST_P},
|
||||
{"leading", LEADING},
|
||||
{"left", LEFT},
|
||||
{"level", LEVEL},
|
||||
{"like", LIKE},
|
||||
{"limit", LIMIT},
|
||||
{"listen", LISTEN},
|
||||
{"load", LOAD},
|
||||
{"local", LOCAL},
|
||||
{"location", LOCATION},
|
||||
{"lock", LOCK_P},
|
||||
{"match", MATCH},
|
||||
{"maxvalue", MAXVALUE},
|
||||
{"minute", MINUTE_P},
|
||||
{"minvalue", MINVALUE},
|
||||
{"mode", MODE},
|
||||
{"month", MONTH_P},
|
||||
{"move", MOVE},
|
||||
{"names", NAMES},
|
||||
{"national", NATIONAL},
|
||||
{"natural", NATURAL},
|
||||
{"nchar", NCHAR},
|
||||
{"new", NEW},
|
||||
{"next", NEXT},
|
||||
{"no", NO},
|
||||
{"nocreatedb", NOCREATEDB},
|
||||
{"nocreateuser", NOCREATEUSER},
|
||||
{"none", NONE},
|
||||
{"not", NOT},
|
||||
{"nothing", NOTHING},
|
||||
{"notify", NOTIFY},
|
||||
{"notnull", NOTNULL},
|
||||
{"nowait", NOWAIT},
|
||||
{"null", NULL_P},
|
||||
{"nullif", NULLIF},
|
||||
{"numeric", NUMERIC},
|
||||
{"object", OBJECT_P},
|
||||
{"of", OF},
|
||||
{"off", OFF},
|
||||
{"offset", OFFSET},
|
||||
{"oids", OIDS},
|
||||
{"old", OLD},
|
||||
{"on", ON},
|
||||
{"only", ONLY},
|
||||
{"operator", OPERATOR},
|
||||
{"option", OPTION},
|
||||
{"or", OR},
|
||||
{"order", ORDER},
|
||||
{"out", OUT_P},
|
||||
{"outer", OUTER_P},
|
||||
{"overlaps", OVERLAPS},
|
||||
{"owner", OWNER},
|
||||
{"partial", PARTIAL},
|
||||
{"password", PASSWORD},
|
||||
{"position", POSITION},
|
||||
{"precision", PRECISION},
|
||||
{"prepare", PREPARE},
|
||||
{"preserve", PRESERVE},
|
||||
{"primary", PRIMARY},
|
||||
{"prior", PRIOR},
|
||||
{"privileges", PRIVILEGES},
|
||||
{"procedural", PROCEDURAL},
|
||||
{"procedure", PROCEDURE},
|
||||
{"quote", QUOTE},
|
||||
{"read", READ},
|
||||
{"real", REAL},
|
||||
{"recheck", RECHECK},
|
||||
{"references", REFERENCES},
|
||||
{"reindex", REINDEX},
|
||||
{"relative", RELATIVE_P},
|
||||
{"rename", RENAME},
|
||||
{"repeatable", REPEATABLE},
|
||||
{"replace", REPLACE},
|
||||
{"reset", RESET},
|
||||
{"restart", RESTART},
|
||||
{"restrict", RESTRICT},
|
||||
{"returns", RETURNS},
|
||||
{"revoke", REVOKE},
|
||||
{"right", RIGHT},
|
||||
{"rollback", ROLLBACK},
|
||||
{"row", ROW},
|
||||
{"rows", ROWS},
|
||||
{"rule", RULE},
|
||||
{"schema", SCHEMA},
|
||||
{"scroll", SCROLL},
|
||||
{"second", SECOND_P},
|
||||
{"security", SECURITY},
|
||||
{"select", SELECT},
|
||||
{"sequence", SEQUENCE},
|
||||
{"serializable", SERIALIZABLE},
|
||||
{"session", SESSION},
|
||||
{"session_user", SESSION_USER},
|
||||
{"set", SET},
|
||||
{"setof", SETOF},
|
||||
{"share", SHARE},
|
||||
{"show", SHOW},
|
||||
{"similar", SIMILAR},
|
||||
{"simple", SIMPLE},
|
||||
{"smallint", SMALLINT},
|
||||
{"some", SOME},
|
||||
{"stable", STABLE},
|
||||
{"start", START},
|
||||
{"statement", STATEMENT},
|
||||
{"statistics", STATISTICS},
|
||||
{"stdin", STDIN},
|
||||
{"stdout", STDOUT},
|
||||
{"storage", STORAGE},
|
||||
{"strict", STRICT_P},
|
||||
{"substring", SUBSTRING},
|
||||
{"sysid", SYSID},
|
||||
{"table", TABLE},
|
||||
{"tablespace", TABLESPACE},
|
||||
{"temp", TEMP},
|
||||
{"template", TEMPLATE},
|
||||
{"temporary", TEMPORARY},
|
||||
{"then", THEN},
|
||||
{"time", TIME},
|
||||
{"timestamp", TIMESTAMP},
|
||||
{"to", TO},
|
||||
{"toast", TOAST},
|
||||
{"trailing", TRAILING},
|
||||
{"transaction", TRANSACTION},
|
||||
{"treat", TREAT},
|
||||
{"trigger", TRIGGER},
|
||||
{"trim", TRIM},
|
||||
{"true", TRUE_P},
|
||||
{"truncate", TRUNCATE},
|
||||
{"trusted", TRUSTED},
|
||||
{"type", TYPE_P},
|
||||
{"uncommitted", UNCOMMITTED},
|
||||
{"unencrypted", UNENCRYPTED},
|
||||
{"union", UNION},
|
||||
{"unique", UNIQUE},
|
||||
{"unknown", UNKNOWN},
|
||||
{"unlisten", UNLISTEN},
|
||||
{"until", UNTIL},
|
||||
{"update", UPDATE},
|
||||
{"usage", USAGE},
|
||||
{"user", USER},
|
||||
{"using", USING},
|
||||
{"vacuum", VACUUM},
|
||||
{"valid", VALID},
|
||||
{"values", VALUES},
|
||||
{"varchar", VARCHAR},
|
||||
{"varying", VARYING},
|
||||
{"verbose", VERBOSE},
|
||||
{"view", VIEW},
|
||||
{"volatile", VOLATILE},
|
||||
{"when", WHEN},
|
||||
{"where", WHERE},
|
||||
{"with", WITH},
|
||||
{"without", WITHOUT},
|
||||
{"work", WORK},
|
||||
{"write", WRITE},
|
||||
{"year", YEAR_P},
|
||||
{"zone", ZONE},
|
||||
};
|
||||
|
||||
/*
|
||||
* ScanKeywordLookup - see if a given word is a keyword
|
||||
@@ -349,53 +349,54 @@ static ScanKeyword ScanKeywords[] = {
|
||||
* keywords are to be matched in this way even though non-keyword identifiers
|
||||
* receive a different case-normalization mapping.
|
||||
*/
|
||||
ScanKeyword *
|
||||
ScanKeywordLookup(char *text)
|
||||
{
|
||||
int len,
|
||||
i;
|
||||
char word[NAMEDATALEN];
|
||||
ScanKeyword *low;
|
||||
ScanKeyword *high;
|
||||
ScanKeyword *
|
||||
ScanKeywordLookup(char *text)
|
||||
{
|
||||
int len,
|
||||
i;
|
||||
char word[NAMEDATALEN];
|
||||
ScanKeyword *low;
|
||||
ScanKeyword *high;
|
||||
|
||||
len = strlen(text);
|
||||
/* We assume all keywords are shorter than NAMEDATALEN. */
|
||||
if (len >= NAMEDATALEN)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Apply an ASCII-only downcasing. We must not use tolower()
|
||||
* since it may produce the wrong translation in some locales (eg,
|
||||
* Turkish).
|
||||
*/
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char ch = text[i];
|
||||
|
||||
if (ch >= 'A' && ch <= 'Z')
|
||||
ch += 'a' - 'A';
|
||||
word[i] = ch;
|
||||
}
|
||||
word[len] = '\0';
|
||||
|
||||
/*
|
||||
* Now do a binary search using plain strcmp() comparison.
|
||||
*/
|
||||
low = &ScanKeywords[0];
|
||||
high = endof(ScanKeywords) - 1;
|
||||
while (low <= high)
|
||||
{
|
||||
ScanKeyword *middle;
|
||||
int difference;
|
||||
|
||||
middle = low + (high - low) / 2;
|
||||
difference = strcmp(middle->name, word);
|
||||
if (difference == 0)
|
||||
return middle;
|
||||
else if (difference < 0)
|
||||
low = middle + 1;
|
||||
else
|
||||
high = middle - 1;
|
||||
}
|
||||
|
||||
len = strlen(text);
|
||||
/* We assume all keywords are shorter than NAMEDATALEN. */
|
||||
if (len >= NAMEDATALEN)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Apply an ASCII-only downcasing. We must not use tolower() since it
|
||||
* may produce the wrong translation in some locales (eg, Turkish).
|
||||
*/
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char ch = text[i];
|
||||
|
||||
if (ch >= 'A' && ch <= 'Z')
|
||||
ch += 'a' - 'A';
|
||||
word[i] = ch;
|
||||
}
|
||||
word[len] = '\0';
|
||||
|
||||
/*
|
||||
* Now do a binary search using plain strcmp() comparison.
|
||||
*/
|
||||
low = &ScanKeywords[0];
|
||||
high = endof(ScanKeywords) - 1;
|
||||
while (low <= high)
|
||||
{
|
||||
ScanKeyword *middle;
|
||||
int difference;
|
||||
|
||||
middle = low + (high - low) / 2;
|
||||
difference = strcmp(middle->name, word);
|
||||
if (difference == 0)
|
||||
return middle;
|
||||
else if (difference < 0)
|
||||
low = middle + 1;
|
||||
else
|
||||
high = middle - 1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.161 2004/08/29 05:07:00 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.162 2004/08/30 02:54:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -458,7 +458,7 @@ pqPrepareAsyncResult(PGconn *conn)
|
||||
* a trailing newline, and should not be more than one line).
|
||||
*/
|
||||
void
|
||||
pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
||||
pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
|
||||
{
|
||||
char msgBuf[1024];
|
||||
va_list args;
|
||||
@@ -503,7 +503,7 @@ pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
||||
* Returns TRUE if OK, FALSE if not enough memory to add the row
|
||||
*/
|
||||
int
|
||||
pqAddTuple(PGresult *res, PGresAttValue * tup)
|
||||
pqAddTuple(PGresult *res, PGresAttValue *tup)
|
||||
{
|
||||
if (res->ntups >= res->tupArrSize)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
|
||||
* Store new info as a single malloc block
|
||||
*/
|
||||
pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) +
|
||||
strlen(name) + strlen(value) + 2);
|
||||
strlen(name) +strlen(value) + 2);
|
||||
if (pstatus)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.13 2004/08/29 05:07:00 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.14 2004/08/30 02:54:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1395,7 +1395,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid,
|
||||
*/
|
||||
char *
|
||||
pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
||||
const PQEnvironmentOption * options)
|
||||
const PQEnvironmentOption *options)
|
||||
{
|
||||
StartupPacket *startpacket;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.15 2004/08/29 05:07:00 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.16 2004/08/30 02:54:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -52,7 +52,7 @@ static int getNotify(PGconn *conn);
|
||||
static int getCopyStart(PGconn *conn, ExecStatusType copytype);
|
||||
static int getReadyForQuery(PGconn *conn);
|
||||
static int build_startup_packet(const PGconn *conn, char *packet,
|
||||
const PQEnvironmentOption * options);
|
||||
const PQEnvironmentOption *options);
|
||||
|
||||
|
||||
/*
|
||||
@@ -1400,7 +1400,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
|
||||
*/
|
||||
char *
|
||||
pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||
const PQEnvironmentOption * options)
|
||||
const PQEnvironmentOption *options)
|
||||
{
|
||||
char *startpacket;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||
*/
|
||||
static int
|
||||
build_startup_packet(const PGconn *conn, char *packet,
|
||||
const PQEnvironmentOption * options)
|
||||
const PQEnvironmentOption *options)
|
||||
{
|
||||
int packet_len = 0;
|
||||
const PQEnvironmentOption *next_eo;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.91 2004/08/29 05:07:00 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.92 2004/08/30 02:54:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ typedef struct pgresAttDesc
|
||||
Oid typid; /* type id */
|
||||
int typlen; /* type size */
|
||||
int atttypmod; /* type-specific modifier info */
|
||||
} PGresAttDesc;
|
||||
} PGresAttDesc;
|
||||
|
||||
/*
|
||||
* Data for a single attribute of a single tuple
|
||||
@@ -115,7 +115,7 @@ typedef struct pgresAttValue
|
||||
int len; /* length in bytes of the value */
|
||||
char *value; /* actual value, plus terminating zero
|
||||
* byte */
|
||||
} PGresAttValue;
|
||||
} PGresAttValue;
|
||||
|
||||
/* Typedef for message-field list entries */
|
||||
typedef struct pgMessageField
|
||||
@@ -123,7 +123,7 @@ typedef struct pgMessageField
|
||||
struct pgMessageField *next; /* list link */
|
||||
char code; /* field code */
|
||||
char contents[1]; /* field value (VARIABLE LENGTH) */
|
||||
} PGMessageField;
|
||||
} PGMessageField;
|
||||
|
||||
/* Fields needed for notice handling */
|
||||
typedef struct
|
||||
@@ -132,7 +132,7 @@ typedef struct
|
||||
void *noticeRecArg;
|
||||
PQnoticeProcessor noticeProc; /* notice message processor */
|
||||
void *noticeProcArg;
|
||||
} PGNoticeHooks;
|
||||
} PGNoticeHooks;
|
||||
|
||||
struct pg_result
|
||||
{
|
||||
@@ -184,7 +184,7 @@ typedef enum
|
||||
PGASYNC_READY, /* result ready for PQgetResult */
|
||||
PGASYNC_COPY_IN, /* Copy In data transfer in progress */
|
||||
PGASYNC_COPY_OUT /* Copy Out data transfer in progress */
|
||||
} PGAsyncStatusType;
|
||||
} PGAsyncStatusType;
|
||||
|
||||
/* PGSetenvStatusType defines the state of the PQSetenv state machine */
|
||||
/* (this is used only for 2.0-protocol connections) */
|
||||
@@ -197,14 +197,14 @@ typedef enum
|
||||
SETENV_STATE_QUERY2_SEND, /* About to send a status query */
|
||||
SETENV_STATE_QUERY2_WAIT, /* Waiting for query to complete */
|
||||
SETENV_STATE_IDLE
|
||||
} PGSetenvStatusType;
|
||||
} PGSetenvStatusType;
|
||||
|
||||
/* Typedef for the EnvironmentOptions[] array */
|
||||
typedef struct PQEnvironmentOption
|
||||
{
|
||||
const char *envName, /* name of an environment variable */
|
||||
*pgName; /* name of corresponding SET variable */
|
||||
} PQEnvironmentOption;
|
||||
} PQEnvironmentOption;
|
||||
|
||||
/* Typedef for parameter-status list entries */
|
||||
typedef struct pgParameterStatus
|
||||
@@ -213,7 +213,7 @@ typedef struct pgParameterStatus
|
||||
char *name; /* parameter name */
|
||||
char *value; /* parameter value */
|
||||
/* Note: name and value are stored in same malloc block as struct is */
|
||||
} pgParameterStatus;
|
||||
} pgParameterStatus;
|
||||
|
||||
/* large-object-access data ... allocated only if large-object code is used. */
|
||||
typedef struct pgLobjfuncs
|
||||
@@ -226,7 +226,7 @@ typedef struct pgLobjfuncs
|
||||
Oid fn_lo_tell; /* OID of backend function lo_tell */
|
||||
Oid fn_lo_read; /* OID of backend function LOread */
|
||||
Oid fn_lo_write; /* OID of backend function LOwrite */
|
||||
} PGlobjfuncs;
|
||||
} PGlobjfuncs;
|
||||
|
||||
/*
|
||||
* PGconn stores all the state data associated with a single connection
|
||||
@@ -380,10 +380,10 @@ extern void pqClearAsyncResult(PGconn *conn);
|
||||
extern void pqSaveErrorResult(PGconn *conn);
|
||||
extern PGresult *pqPrepareAsyncResult(PGconn *conn);
|
||||
extern void
|
||||
pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)
|
||||
pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
|
||||
/* This lets gcc check the format string for consistency. */
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
extern int pqAddTuple(PGresult *res, PGresAttValue * tup);
|
||||
extern int pqAddTuple(PGresult *res, PGresAttValue *tup);
|
||||
extern void pqSaveMessageField(PGresult *res, char code,
|
||||
const char *value);
|
||||
extern void pqSaveParameterStatus(PGconn *conn, const char *name,
|
||||
@@ -395,7 +395,7 @@ extern void pqHandleSendFailure(PGconn *conn);
|
||||
extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);
|
||||
|
||||
extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
||||
const PQEnvironmentOption * options);
|
||||
const PQEnvironmentOption *options);
|
||||
extern void pqParseInput2(PGconn *conn);
|
||||
extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);
|
||||
extern int pqGetline2(PGconn *conn, char *s, int maxlen);
|
||||
@@ -409,7 +409,7 @@ extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid,
|
||||
/* === in fe-protocol3.c === */
|
||||
|
||||
extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||
const PQEnvironmentOption * options);
|
||||
const PQEnvironmentOption *options);
|
||||
extern void pqParseInput3(PGconn *conn);
|
||||
extern int pqGetErrorNotice3(PGconn *conn, bool isError);
|
||||
extern int pqGetCopyData3(PGconn *conn, char **buffer, int async);
|
||||
|
||||
Reference in New Issue
Block a user