Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0754b391
Commit
0754b391
authored
May 20, 2009
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some unneeded variables and comparisons
parent
7340793f
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
52 additions
and
50 deletions
+52
-50
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+3
-3
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/ecpglib/extern.h
+3
-3
src/interfaces/ecpg/ecpglib/prepare.c
src/interfaces/ecpg/ecpglib/prepare.c
+10
-8
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpglib.h
+2
-2
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/datetime.c
+2
-2
src/interfaces/ecpg/pgtypeslib/dt.h
src/interfaces/ecpg/pgtypeslib/dt.h
+3
-3
src/interfaces/ecpg/pgtypeslib/dt_common.c
src/interfaces/ecpg/pgtypeslib/dt_common.c
+17
-17
src/interfaces/ecpg/pgtypeslib/interval.c
src/interfaces/ecpg/pgtypeslib/interval.c
+4
-4
src/interfaces/ecpg/pgtypeslib/timestamp.c
src/interfaces/ecpg/pgtypeslib/timestamp.c
+2
-2
src/interfaces/ecpg/test/expected/sql-code100.c
src/interfaces/ecpg/test/expected/sql-code100.c
+1
-1
src/interfaces/ecpg/test/expected/thread-alloc.c
src/interfaces/ecpg/test/expected/thread-alloc.c
+1
-1
src/interfaces/ecpg/test/expected/thread-descriptor.c
src/interfaces/ecpg/test/expected/thread-descriptor.c
+1
-1
src/interfaces/ecpg/test/sql/code100.pgc
src/interfaces/ecpg/test/sql/code100.pgc
+1
-1
src/interfaces/ecpg/test/thread/alloc.pgc
src/interfaces/ecpg/test/thread/alloc.pgc
+1
-1
src/interfaces/ecpg/test/thread/descriptor.pgc
src/interfaces/ecpg/test/thread/descriptor.pgc
+1
-1
No files found.
src/interfaces/ecpg/ecpglib/execute.c
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
2 2009/02/03 08:55:45
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
3 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
...
@@ -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
...
@@ -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
)
{
{
...
...
src/interfaces/ecpg/ecpglib/extern.h
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.3
4 2008/02/07 11:09:12
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.3
5 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 **,
...
@@ -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
...
...
src/interfaces/ecpg/ecpglib/prepare.c
View file @
0754b391
/* $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)
...
@@ -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)
...
@@ -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
...
@@ -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)
...
@@ -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)
...
@@ -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 */
...
@@ -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
,
c
onst
int
questionmarks
,
c
har
**
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
...
@@ -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
);
...
...
src/interfaces/ecpg/include/ecpglib.h
View file @
0754b391
/*
/*
* 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.7
7 2008/05/16 15:20:04 petere
Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.7
8 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
...
@@ -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
);
...
...
src/interfaces/ecpg/pgtypeslib/datetime.c
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.3
5 2009/02/04 08:51:09
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.3
6 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)
...
@@ -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
;
...
...
src/interfaces/ecpg/pgtypeslib/dt.h
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.4
1 2009/02/04 08:51:09
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.4
2 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 { \
...
@@ -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);
...
@@ -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
*
);
...
...
src/interfaces/ecpg/pgtypeslib/dt_common.c
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.4
8 2009/03/22 01:12:32 tgl
Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.4
9 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)
...
@@ -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,
...
@@ -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)
...
@@ -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)
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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,
...
@@ -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... */
...
@@ -2908,7 +2908,7 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
...
@@ -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,
...
@@ -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'
:
...
...
src/interfaces/ecpg/pgtypeslib/interval.c
View file @
0754b391
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.
39 2008/11/26 16:47:0
8 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.
40 2009/05/20 16:13:1
8 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,*/
...
@@ -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,*/
...
@@ -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)
...
@@ -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
))
{
{
...
...
src/interfaces/ecpg/pgtypeslib/timestamp.c
View file @
0754b391
/*
/*
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.4
3 2009/02/04 08:51:10
meskes Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.4
4 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)
...
@@ -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
;
...
...
src/interfaces/ecpg/test/expected/sql-code100.c
View file @
0754b391
...
@@ -92,7 +92,7 @@ struct sqlca_t *ECPGget_sqlca(void);
...
@@ -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 */
...
...
src/interfaces/ecpg/test/expected/thread-alloc.c
View file @
0754b391
...
@@ -185,7 +185,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
...
@@ -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
...
...
src/interfaces/ecpg/test/expected/thread-descriptor.c
View file @
0754b391
...
@@ -126,7 +126,7 @@ if (sqlca.sqlcode < 0) sqlprint();
...
@@ -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
;
...
...
src/interfaces/ecpg/test/sql/code100.pgc
View file @
0754b391
...
@@ -4,7 +4,7 @@ exec sql include sqlca;
...
@@ -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;
...
...
src/interfaces/ecpg/test/thread/alloc.pgc
View file @
0754b391
...
@@ -57,7 +57,7 @@ static void* fn(void* arg)
...
@@ -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
...
...
src/interfaces/ecpg/test/thread/descriptor.pgc
View file @
0754b391
...
@@ -33,7 +33,7 @@ static void* fn(void* arg)
...
@@ -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;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment