Removed some unneeded variables and comparisons
This commit is contained in:
parent
7340793f31
commit
0754b391f3
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.82 2009/02/03 08:55:45 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.83 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@ -1501,7 +1501,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
|
|||||||
*/
|
*/
|
||||||
if (statement_type == ECPGst_prepnormal)
|
if (statement_type == ECPGst_prepnormal)
|
||||||
{
|
{
|
||||||
if (!ecpg_auto_prepare(lineno, connection_name, compat, questionmarks, &prepname, query))
|
if (!ecpg_auto_prepare(lineno, connection_name, compat, &prepname, query))
|
||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1519,7 +1519,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
|
|||||||
if (statement_type == ECPGst_execute)
|
if (statement_type == ECPGst_execute)
|
||||||
{
|
{
|
||||||
/* if we have an EXECUTE command, only the name is send */
|
/* if we have an EXECUTE command, only the name is send */
|
||||||
char *command = ecpg_prepared(stmt->command, con, lineno);
|
char *command = ecpg_prepared(stmt->command, con);
|
||||||
|
|
||||||
if (command)
|
if (command)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.34 2008/02/07 11:09:12 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.35 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#ifndef _ECPG_LIB_EXTERN_H
|
#ifndef _ECPG_LIB_EXTERN_H
|
||||||
#define _ECPG_LIB_EXTERN_H
|
#define _ECPG_LIB_EXTERN_H
|
||||||
@ -143,10 +143,10 @@ bool ecpg_store_input(const int, const bool, const struct variable *, char **,
|
|||||||
bool ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE);
|
bool ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE);
|
||||||
void ecpg_raise(int line, int code, const char *sqlstate, const char *str);
|
void ecpg_raise(int line, int code, const char *sqlstate, const char *str);
|
||||||
void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat);
|
void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat);
|
||||||
char *ecpg_prepared(const char *, struct connection *, int);
|
char *ecpg_prepared(const char *, struct connection *);
|
||||||
bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection * conn);
|
bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection * conn);
|
||||||
void ecpg_log(const char *format,...);
|
void ecpg_log(const char *format,...);
|
||||||
bool ecpg_auto_prepare(int, const char *, int, const int, char **, const char *);
|
bool ecpg_auto_prepare(int, const char *, const int, char **, const char *);
|
||||||
void ecpg_init_sqlca(struct sqlca_t * sqlca);
|
void ecpg_init_sqlca(struct sqlca_t * sqlca);
|
||||||
|
|
||||||
/* SQLSTATE values generated or processed by ecpglib (intentionally
|
/* SQLSTATE values generated or processed by ecpglib (intentionally
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.29 2008/05/16 15:20:03 petere Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.30 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -56,7 +56,7 @@ isvarchar(unsigned char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
replace_variables(char **text, int lineno, bool questionmarks)
|
replace_variables(char **text, int lineno)
|
||||||
{
|
{
|
||||||
bool string = false;
|
bool string = false;
|
||||||
int counter = 1,
|
int counter = 1,
|
||||||
@ -110,8 +110,9 @@ replace_variables(char **text, int lineno, bool questionmarks)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* handle the EXEC SQL PREPARE statement */
|
/* handle the EXEC SQL PREPARE statement */
|
||||||
|
/* questionmarks is not needed but remians in there for the time being to not change the API */
|
||||||
bool
|
bool
|
||||||
ECPGprepare(int lineno, const char *connection_name, const int questionmarks, const char *name, const char *variable)
|
ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
|
||||||
{
|
{
|
||||||
struct connection *con;
|
struct connection *con;
|
||||||
struct statement *stmt;
|
struct statement *stmt;
|
||||||
@ -148,7 +149,7 @@ ECPGprepare(int lineno, const char *connection_name, const int questionmarks, co
|
|||||||
stmt->inlist = stmt->outlist = NULL;
|
stmt->inlist = stmt->outlist = NULL;
|
||||||
|
|
||||||
/* if we have C variables in our statment replace them with '?' */
|
/* if we have C variables in our statment replace them with '?' */
|
||||||
replace_variables(&(stmt->command), lineno, questionmarks);
|
replace_variables(&(stmt->command), lineno);
|
||||||
|
|
||||||
/* add prepared statement to our list */
|
/* add prepared statement to our list */
|
||||||
this->name = (char *) name;
|
this->name = (char *) name;
|
||||||
@ -290,7 +291,7 @@ ECPGdeallocate_all(int lineno, int compat, const char *connection_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
ecpg_prepared(const char *name, struct connection * con, int lineno)
|
ecpg_prepared(const char *name, struct connection * con)
|
||||||
{
|
{
|
||||||
struct prepared_statement *this;
|
struct prepared_statement *this;
|
||||||
|
|
||||||
@ -299,10 +300,11 @@ ecpg_prepared(const char *name, struct connection * con, int lineno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return the prepared statement */
|
/* return the prepared statement */
|
||||||
|
/* lineno is not used here, but kept in to not break API */
|
||||||
char *
|
char *
|
||||||
ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
|
ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
|
||||||
{
|
{
|
||||||
return ecpg_prepared(name, ecpg_get_connection(connection_name), lineno);
|
return ecpg_prepared(name, ecpg_get_connection(connection_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -460,7 +462,7 @@ AddStmtToCache(int lineno, /* line # of statement */
|
|||||||
|
|
||||||
/* handle cache and preparation of statments in auto-prepare mode */
|
/* handle cache and preparation of statments in auto-prepare mode */
|
||||||
bool
|
bool
|
||||||
ecpg_auto_prepare(int lineno, const char *connection_name, int compat, const int questionmarks, char **name, const char *query)
|
ecpg_auto_prepare(int lineno, const char *connection_name, int compat, char **name, const char *query)
|
||||||
{
|
{
|
||||||
int entNo;
|
int entNo;
|
||||||
|
|
||||||
@ -481,7 +483,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, int compat, const int
|
|||||||
*name = (char *) ecpg_alloc(STMTID_SIZE, lineno);
|
*name = (char *) ecpg_alloc(STMTID_SIZE, lineno);
|
||||||
sprintf(*name, "ecpg%d", nextStmtID++);
|
sprintf(*name, "ecpg%d", nextStmtID++);
|
||||||
|
|
||||||
if (!ECPGprepare(lineno, connection_name, questionmarks, ecpg_strdup(*name, lineno), query))
|
if (!ECPGprepare(lineno, connection_name, 0, ecpg_strdup(*name, lineno), query))
|
||||||
return (false);
|
return (false);
|
||||||
if (AddStmtToCache(lineno, *name, connection_name, compat, query) < 0)
|
if (AddStmtToCache(lineno, *name, connection_name, compat, query) < 0)
|
||||||
return (false);
|
return (false);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* this is a small part of c.h since we don't want to leak all postgres
|
* this is a small part of c.h since we don't want to leak all postgres
|
||||||
* definitions into ecpg programs
|
* definitions into ecpg programs
|
||||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.77 2008/05/16 15:20:04 petere Exp $
|
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.78 2009/05/20 16:13:18 meskes Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ECPGLIB_H
|
#ifndef _ECPGLIB_H
|
||||||
@ -54,7 +54,7 @@ bool ECPGconnect(int, int, const char *, const char *, const char *, const char
|
|||||||
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
|
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
|
||||||
bool ECPGtrans(int, const char *, const char *);
|
bool ECPGtrans(int, const char *, const char *);
|
||||||
bool ECPGdisconnect(int, const char *);
|
bool ECPGdisconnect(int, const char *);
|
||||||
bool ECPGprepare(int, const char *, const int, const char *, const char *);
|
bool ECPGprepare(int, const char *, const bool, const char *, const char *);
|
||||||
bool ECPGdeallocate(int, int, const char *, const char *);
|
bool ECPGdeallocate(int, int, const char *, const char *);
|
||||||
bool ECPGdeallocate_all(int, int, const char *);
|
bool ECPGdeallocate_all(int, int, const char *);
|
||||||
char *ECPGprepared_statement(const char *, const char *, int);
|
char *ECPGprepared_statement(const char *, const char *, int);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.35 2009/02/04 08:51:09 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.36 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ PGTYPESdate_from_asc(char *str, char **endptr)
|
|||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0 ||
|
if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 ||
|
||||||
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, EuroDates) != 0)
|
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, EuroDates) != 0)
|
||||||
{
|
{
|
||||||
errno = PGTYPES_DATE_BAD_DATE;
|
errno = PGTYPES_DATE_BAD_DATE;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.41 2009/02/04 08:51:09 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.42 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#ifndef DT_H
|
#ifndef DT_H
|
||||||
#define DT_H
|
#define DT_H
|
||||||
@ -334,7 +334,7 @@ do { \
|
|||||||
|
|
||||||
int DecodeTimeOnly(char **, int *, int, int *, struct tm *, fsec_t *, int *);
|
int DecodeTimeOnly(char **, int *, int, int *, struct tm *, fsec_t *, int *);
|
||||||
int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *);
|
int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *);
|
||||||
int DecodeTime(char *, int, int *, struct tm *, fsec_t *);
|
int DecodeTime(char *, int *, struct tm *, fsec_t *);
|
||||||
int EncodeTimeOnly(struct tm *, fsec_t, int *, int, char *);
|
int EncodeTimeOnly(struct tm *, fsec_t, int *, int, char *);
|
||||||
int EncodeDateTime(struct tm *, fsec_t, int *, char **, int, char *, bool);
|
int EncodeDateTime(struct tm *, fsec_t, int *, char **, int, char *, bool);
|
||||||
int EncodeInterval(struct tm *, fsec_t, int, char *);
|
int EncodeInterval(struct tm *, fsec_t, int, char *);
|
||||||
@ -343,7 +343,7 @@ int DecodeUnits(int field, char *lowtoken, int *val);
|
|||||||
bool CheckDateTokenTables(void);
|
bool CheckDateTokenTables(void);
|
||||||
int EncodeDateOnly(struct tm *, int, char *, bool);
|
int EncodeDateOnly(struct tm *, int, char *, bool);
|
||||||
int GetEpochTime(struct tm *);
|
int GetEpochTime(struct tm *);
|
||||||
int ParseDateTime(char *, char *, char **, int *, int, int *, char **);
|
int ParseDateTime(char *, char *, char **, int *, int *, char **);
|
||||||
int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool);
|
int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool);
|
||||||
void j2date(int, int *, int *, int *);
|
void j2date(int, int *, int *, int *);
|
||||||
void GetCurrentDateTime(struct tm *);
|
void GetCurrentDateTime(struct tm *);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.48 2009/03/22 01:12:32 tgl Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.49 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -1132,7 +1132,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DecodeNumberField(int len, char *str, int fmask,
|
DecodeNumberField(int len, char *str, int fmask,
|
||||||
int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates)
|
int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -1258,7 +1258,7 @@ DecodeNumber(int flen, char *str, int fmask,
|
|||||||
*/
|
*/
|
||||||
if (cp - str > 2)
|
if (cp - str > 2)
|
||||||
return DecodeNumberField(flen, str, (fmask | DTK_DATE_M),
|
return DecodeNumberField(flen, str, (fmask | DTK_DATE_M),
|
||||||
tmask, tm, fsec, is2digits, EuroDates);
|
tmask, tm, fsec, is2digits);
|
||||||
|
|
||||||
*fsec = strtod(cp, &cp);
|
*fsec = strtod(cp, &cp);
|
||||||
if (*cp != '\0')
|
if (*cp != '\0')
|
||||||
@ -1476,7 +1476,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates)
|
|||||||
* can be used to represent time spans.
|
* can be used to represent time spans.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
|
DecodeTime(char *str, int *tmask, struct tm * tm, fsec_t *fsec)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@ -1640,7 +1640,7 @@ DecodePosixTimezone(char *str, int *tzp)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ParseDateTime(char *timestr, char *lowstr,
|
ParseDateTime(char *timestr, char *lowstr,
|
||||||
char **field, int *ftype, int maxfields, int *numfields, char **endstr)
|
char **field, int *ftype, int *numfields, char **endstr)
|
||||||
{
|
{
|
||||||
int nf = 0;
|
int nf = 0;
|
||||||
char *lp = lowstr;
|
char *lp = lowstr;
|
||||||
@ -1928,7 +1928,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
* time
|
* time
|
||||||
*/
|
*/
|
||||||
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask,
|
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask,
|
||||||
&tmask, tm, fsec, &is2digits, EuroDates)) < 0)
|
&tmask, tm, fsec, &is2digits)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1951,7 +1951,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DTK_TIME:
|
case DTK_TIME:
|
||||||
if (DecodeTime(field[i], fmask, &tmask, tm, fsec) != 0)
|
if (DecodeTime(field[i], &tmask, tm, fsec) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2116,7 +2116,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
case DTK_TIME:
|
case DTK_TIME:
|
||||||
/* previous field was "t" for ISO time */
|
/* previous field was "t" for ISO time */
|
||||||
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
|
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
|
||||||
&tmask, tm, fsec, &is2digits, EuroDates)) < 0)
|
&tmask, tm, fsec, &is2digits)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (tmask != DTK_TIME_M)
|
if (tmask != DTK_TIME_M)
|
||||||
@ -2154,13 +2154,13 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||||||
* Example: 20011223 or 040506
|
* Example: 20011223 or 040506
|
||||||
*/
|
*/
|
||||||
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
|
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
|
||||||
&tmask, tm, fsec, &is2digits, EuroDates)) < 0)
|
&tmask, tm, fsec, &is2digits)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (flen > 4)
|
else if (flen > 4)
|
||||||
{
|
{
|
||||||
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
|
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
|
||||||
&tmask, tm, fsec, &is2digits, EuroDates)) < 0)
|
&tmask, tm, fsec, &is2digits)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* otherwise it is a single date/time field... */
|
/* otherwise it is a single date/time field... */
|
||||||
@ -2580,10 +2580,10 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
|
|||||||
int scan_type;
|
int scan_type;
|
||||||
|
|
||||||
char *pstr,
|
char *pstr,
|
||||||
*pfmt,
|
*pfmt,
|
||||||
*tmp;
|
*tmp;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
int j;
|
int j;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
|
||||||
pfmt = fmt;
|
pfmt = fmt;
|
||||||
@ -2908,7 +2908,7 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
|
|||||||
pfmt++;
|
pfmt++;
|
||||||
scan_type = PGTYPES_TYPE_UINT;
|
scan_type = PGTYPES_TYPE_UINT;
|
||||||
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
||||||
if (scan_val.uint_val < 0 || scan_val.uint_val > 53)
|
if (scan_val.uint_val > 53)
|
||||||
err = 1;
|
err = 1;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
@ -2922,14 +2922,14 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
|
|||||||
pfmt++;
|
pfmt++;
|
||||||
scan_type = PGTYPES_TYPE_UINT;
|
scan_type = PGTYPES_TYPE_UINT;
|
||||||
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
||||||
if (scan_val.uint_val < 0 || scan_val.uint_val > 6)
|
if (scan_val.uint_val > 6)
|
||||||
err = 1;
|
err = 1;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
pfmt++;
|
pfmt++;
|
||||||
scan_type = PGTYPES_TYPE_UINT;
|
scan_type = PGTYPES_TYPE_UINT;
|
||||||
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
err = pgtypes_defmt_scan(&scan_val, scan_type, &pstr, pfmt);
|
||||||
if (scan_val.uint_val < 0 || scan_val.uint_val > 53)
|
if (scan_val.uint_val > 53)
|
||||||
err = 1;
|
err = 1;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.39 2008/11/26 16:47:08 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.40 2009/05/20 16:13:18 meskes Exp $ */
|
||||||
|
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -362,7 +362,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/
|
|||||||
switch (ftype[i])
|
switch (ftype[i])
|
||||||
{
|
{
|
||||||
case DTK_TIME:
|
case DTK_TIME:
|
||||||
dterr = DecodeTime(field[i], fmask, /* range, */
|
dterr = DecodeTime(field[i], /* range, */
|
||||||
&tmask, tm, fsec);
|
&tmask, tm, fsec);
|
||||||
if (dterr)
|
if (dterr)
|
||||||
return dterr;
|
return dterr;
|
||||||
@ -384,7 +384,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/
|
|||||||
* and signed year-month values.
|
* and signed year-month values.
|
||||||
*/
|
*/
|
||||||
if (strchr(field[i] + 1, ':') != NULL &&
|
if (strchr(field[i] + 1, ':') != NULL &&
|
||||||
DecodeTime(field[i] + 1, fmask, /* INTERVAL_FULL_RANGE, */
|
DecodeTime(field[i] + 1, /* INTERVAL_FULL_RANGE, */
|
||||||
&tmask, tm, fsec) == 0)
|
&tmask, tm, fsec) == 0)
|
||||||
{
|
{
|
||||||
if (*field[i] == '-')
|
if (*field[i] == '-')
|
||||||
@ -1096,7 +1096,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0 ||
|
if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 ||
|
||||||
(DecodeInterval(field, ftype, nf, &dtype, tm, &fsec) != 0 &&
|
(DecodeInterval(field, ftype, nf, &dtype, tm, &fsec) != 0 &&
|
||||||
DecodeISO8601Interval(str, &dtype, tm, &fsec) != 0))
|
DecodeISO8601Interval(str, &dtype, tm, &fsec) != 0))
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.43 2009/02/04 08:51:10 meskes Exp $
|
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.44 2009/05/20 16:13:18 meskes Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
|
|||||||
return (noresult);
|
return (noresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf, ptr) != 0 ||
|
if (ParseDateTime(str, lowstr, field, ftype, &nf, ptr) != 0 ||
|
||||||
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0)
|
DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, 0) != 0)
|
||||||
{
|
{
|
||||||
errno = PGTYPES_TS_BAD_TIMESTAMP;
|
errno = PGTYPES_TS_BAD_TIMESTAMP;
|
||||||
|
@ -92,7 +92,7 @@ struct sqlca_t *ECPGget_sqlca(void);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main()
|
||||||
{ /* exec sql begin declare section */
|
{ /* exec sql begin declare section */
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main ()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -126,7 +126,7 @@ if (sqlca.sqlcode < 0) sqlprint();
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main ()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_THREAD_SAFETY
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
int i;
|
int i;
|
||||||
|
@ -4,7 +4,7 @@ exec sql include sqlca;
|
|||||||
exec sql include ../regression;
|
exec sql include ../regression;
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main()
|
||||||
{ exec sql begin declare section;
|
{ exec sql begin declare section;
|
||||||
int index;
|
int index;
|
||||||
exec sql end declare section;
|
exec sql end declare section;
|
||||||
|
@ -57,7 +57,7 @@ static void* fn(void* arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main ()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -33,7 +33,7 @@ static void* fn(void* arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main ()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_THREAD_SAFETY
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user