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
df6e5044
Commit
df6e5044
authored
Apr 13, 1999
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
adf5422d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
49 deletions
+107
-49
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+12
-0
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpglib.h
+1
-0
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/lib/ecpglib.c
+85
-8
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/pgc.l
+9
-41
No files found.
src/interfaces/ecpg/ChangeLog
View file @
df6e5044
...
...
@@ -544,5 +544,17 @@ Mon Mar 22 19:22:38 CET 1999
- Fixed incorrect password entry in parser.
- Made no_auto_trans available for each connection seperately.
Sat Apr 10 20:10:50 CEST 1999
- Allow ecpg handle a floating point constants.
- Fix ecpg runtime library memory leak (patch by Masaaki Sakaida).
Mon Apr 12 17:56:14 CEST 1999
- Fixed ECPG variable handling.
- Make no_auto_trans be accessible via SET command.
- Do not eat comments so line numbering should be correct.
- Set library version to 3.0.0
- Set ecpg version to 2.6.0
src/interfaces/ecpg/include/ecpglib.h
View file @
df6e5044
...
...
@@ -7,6 +7,7 @@ extern "C"
void
ECPGdebug
(
int
,
FILE
*
);
bool
ECPGstatus
(
int
,
const
char
*
);
bool
ECPGsetcommit
(
int
,
const
char
*
,
const
char
*
);
bool
ECPGsetconn
(
int
,
const
char
*
);
bool
ECPGconnect
(
int
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
int
);
bool
ECPGdo
(
int
,
const
char
*
,
char
*
,...);
...
...
src/interfaces/ecpg/lib/ecpglib.c
View file @
df6e5044
...
...
@@ -370,6 +370,34 @@ create_statement(int lineno, struct connection *connection, struct statement **
return
(
true
);
}
static
void
free_variable
(
struct
variable
*
var
)
{
struct
variable
*
var_next
;
if
(
var
==
(
struct
variable
*
)
NULL
)
return
;
var_next
=
var
->
next
;
free
(
var
);
while
(
var_next
)
{
var
=
var_next
;
var_next
=
var
->
next
;
free
(
var
);
}
}
static
void
free_statement
(
struct
statement
*
stmt
)
{
if
(
stmt
==
(
struct
statement
*
)
NULL
)
return
;
free_variable
(
stmt
->
inlist
);
free_variable
(
stmt
->
outlist
);
free
(
stmt
);
}
static
char
*
next_insert
(
char
*
text
)
{
...
...
@@ -981,7 +1009,6 @@ ECPGexecute(struct statement * stmt)
status
=
false
;
}
PQclear
(
results
);
break
;
case
PGRES_EMPTY_QUERY
:
/* do nothing */
...
...
@@ -1017,6 +1044,7 @@ ECPGexecute(struct statement * stmt)
status
=
false
;
break
;
}
PQclear
(
results
);
}
/* check for asynchronous returns */
...
...
@@ -1037,10 +1065,11 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
va_list
args
;
struct
statement
*
stmt
;
struct
connection
*
con
=
get_connection
(
connection_name
);
bool
status
;
if
(
con
==
NULL
)
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d."
,
connection_name
,
lineno
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d."
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
...
...
@@ -1057,7 +1086,9 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
return
false
;
}
return
(
ECPGexecute
(
stmt
));
status
=
ECPGexecute
(
stmt
);
free_statement
(
stmt
);
return
(
status
);
}
bool
...
...
@@ -1067,7 +1098,7 @@ ECPGstatus(int lineno, const char *connection_name)
if
(
con
==
NULL
)
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
,
lineno
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
...
...
@@ -1090,7 +1121,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
if
(
con
==
NULL
)
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
,
lineno
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
...
...
@@ -1125,6 +1156,52 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
return
true
;
}
bool
ECPGsetcommit
(
int
lineno
,
const
char
*
mode
,
const
char
*
connection_name
)
{
struct
connection
*
con
=
get_connection
(
connection_name
);
PGresult
*
results
;
if
(
con
)
{
if
(
con
->
no_auto_trans
==
true
&&
strncmp
(
mode
,
"ON"
,
strlen
(
"ON"
))
==
0
)
{
if
(
con
->
committed
)
{
if
((
results
=
PQexec
(
con
->
connection
,
"begin transaction"
))
==
NULL
)
{
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
return
false
;
}
PQclear
(
results
);
con
->
committed
=
false
;
}
con
->
no_auto_trans
=
false
;
}
else
if
(
con
->
no_auto_trans
==
false
&&
strncmp
(
mode
,
"OFF"
,
strlen
(
"OFF"
))
==
0
)
{
if
(
!
con
->
committed
)
{
if
((
results
=
PQexec
(
con
->
connection
,
"commit"
))
==
NULL
)
{
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
return
false
;
}
PQclear
(
results
);
con
->
committed
=
true
;
}
con
->
no_auto_trans
=
true
;
}
}
else
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
false
;
}
return
true
;
}
bool
ECPGsetconn
(
int
lineno
,
const
char
*
connection_name
)
{
...
...
@@ -1137,7 +1214,7 @@ ECPGsetconn(int lineno, const char *connection_name)
}
else
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
,
lineno
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
false
;
}
}
...
...
@@ -1207,8 +1284,8 @@ ECPGdisconnect(int lineno, const char *connection_name)
if
(
con
==
NULL
)
{
ECPGlog
(
"disconnect: not connected to connection %s
\n
"
,
connection_name
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
,
lineno
);
ECPGlog
(
"disconnect: not connected to connection %s
\n
"
,
connection_name
?
connection_name
:
"NULL"
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
false
;
}
else
...
...
src/interfaces/ecpg/preproc/pgc.l
View file @
df6e5044
...
...
@@ -178,17 +178,18 @@ cppline {space}*#.*(\\{space}*\n)*\n*
%%
<SQL>{comment} { /* ignore */ }
{xcline} {
/* ignore */
}
{xcline} {
ECHO;
}
<xc>{xcstar} {
/* ignore */
}
<xc>{xcstar} {
ECHO;
}
{xcstart} {
before_comment = YYSTATE;
ECHO;
BEGIN(xc);
}
<xc>{xcstop} { BEGIN(before_comment); }
<xc>{xcstop} {
ECHO;
BEGIN(before_comment); }
<xc>{xcinside} {
/* ignore */
}
<xc>{xcinside} {
ECHO;
}
<SQL>{xbstart} {
BEGIN(xb);
...
...
@@ -376,7 +377,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
}
}
}
<SQL>{integer}/{space}*-{number} {
<
C,
SQL>{integer}/{space}*-{number} {
char* endptr;
BEGIN(xm);
...
...
@@ -393,7 +394,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
}
return ICONST;
}
<SQL>{real}/{space}*-{number} {
<
C,
SQL>{real}/{space}*-{number} {
char* endptr;
BEGIN(xm);
...
...
@@ -403,7 +404,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
yyerror("ERROR: Bad float8 input");
return FCONST;
}
<SQL>{integer} {
<
C,
SQL>{integer} {
char* endptr;
errno = 0;
...
...
@@ -419,7 +420,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
}
return ICONST;
}
<SQL>{real} {
<
C,
SQL>{real} {
char* endptr;
errno = 0;
...
...
@@ -428,39 +429,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
yyerror("ERROR: Bad float input");
return FCONST;
}
<C>{integer}/{space}*-{number} {
char* endptr;
BEGIN(xm);
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
{
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
return FCONST;
}
return ICONST;
}
<C>{integer} {
char* endptr;
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
{
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
return FCONST;
}
return ICONST;
}
<SQL>:{identifier}(("->"|\.){identifier})* {
yylval.str = mm_strdup((char*)yytext+1);
return(CVARIABLE);
...
...
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