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
231c5935
Commit
231c5935
authored
Sep 17, 1999
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
9995ba36
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
71 deletions
+67
-71
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/lib/Makefile.in
src/interfaces/ecpg/lib/Makefile.in
+2
-2
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/lib/ecpglib.c
+58
-67
src/interfaces/ecpg/test/test2.pgc
src/interfaces/ecpg/test/test2.pgc
+1
-1
src/interfaces/ecpg/test/test3.pgc
src/interfaces/ecpg/test/test3.pgc
+1
-1
No files found.
src/interfaces/ecpg/ChangeLog
View file @
231c5935
...
@@ -638,3 +638,8 @@ Fri Sep 17 07:43:55 CEST 1999
...
@@ -638,3 +638,8 @@ Fri Sep 17 07:43:55 CEST 1999
- Fixed bug in parsing operators.
- Fixed bug in parsing operators.
- Set ecpg version to 2.6.4
- Set ecpg version to 2.6.4
Fri Sep 17 18:16:34 CEST 1999
- Made sure sqlca is initialized everytime.
- Set library version to 3.0.3
src/interfaces/ecpg/lib/Makefile.in
View file @
231c5935
...
@@ -6,13 +6,13 @@
...
@@ -6,13 +6,13 @@
# Copyright (c) 1994, Regents of the University of California
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.4
6 1999/09/15 08:29:14
meskes Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.4
7 1999/09/17 18:28:10
meskes Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
NAME
=
ecpg
NAME
=
ecpg
SO_MAJOR_VERSION
=
3
SO_MAJOR_VERSION
=
3
SO_MINOR_VERSION
=
0.
2
SO_MINOR_VERSION
=
0.
3
SRCDIR
=
@top_srcdir@
SRCDIR
=
@top_srcdir@
include
$(SRCDIR)/Makefile.global
include
$(SRCDIR)/Makefile.global
...
...
src/interfaces/ecpg/lib/ecpglib.c
View file @
231c5935
...
@@ -140,12 +140,25 @@ get_connection(const char *connection_name)
...
@@ -140,12 +140,25 @@ get_connection(const char *connection_name)
return
NULL
;
return
NULL
;
}
}
static
bool
ecpg_init
(
const
struct
connection
*
con
,
const
char
*
connection_name
,
const
int
lineno
)
{
memcpy
((
char
*
)
&
sqlca
,
(
char
*
)
&
sqlca_init
,
sizeof
(
sqlca
));
if
(
con
==
NULL
)
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d."
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
return
(
true
);
}
static
void
static
void
ECPG
finish
(
struct
connection
*
act
)
ecpg_
finish
(
struct
connection
*
act
)
{
{
if
(
act
!=
NULL
)
if
(
act
!=
NULL
)
{
{
ECPGlog
(
"
ECPG
finish: finishing %s.
\n
"
,
act
->
name
);
ECPGlog
(
"
ecpg_
finish: finishing %s.
\n
"
,
act
->
name
);
PQfinish
(
act
->
connection
);
PQfinish
(
act
->
connection
);
/* remove act from the list */
/* remove act from the list */
if
(
act
==
all_connections
)
if
(
act
==
all_connections
)
...
@@ -166,7 +179,7 @@ ECPGfinish(struct connection * act)
...
@@ -166,7 +179,7 @@ ECPGfinish(struct connection * act)
free
(
act
);
free
(
act
);
}
}
else
else
ECPGlog
(
"
ECPG
finish: called an extra time.
\n
"
);
ECPGlog
(
"
ecpg_
finish: called an extra time.
\n
"
);
}
}
static
char
*
static
char
*
...
@@ -383,8 +396,6 @@ ECPGexecute(struct statement * stmt)
...
@@ -383,8 +396,6 @@ ECPGexecute(struct statement * stmt)
PGnotify
*
notify
;
PGnotify
*
notify
;
struct
variable
*
var
;
struct
variable
*
var
;
memcpy
((
char
*
)
&
sqlca
,
(
char
*
)
&
sqlca_init
,
sizeof
(
sqlca
));
copiedquery
=
ecpg_strdup
(
stmt
->
command
,
stmt
->
lineno
);
copiedquery
=
ecpg_strdup
(
stmt
->
command
,
stmt
->
lineno
);
/*
/*
...
@@ -1029,11 +1040,8 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
...
@@ -1029,11 +1040,8 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
struct
connection
*
con
=
get_connection
(
connection_name
);
struct
connection
*
con
=
get_connection
(
connection_name
);
bool
status
;
bool
status
;
if
(
con
==
NULL
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
{
return
(
false
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d."
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
va_start
(
args
,
query
);
va_start
(
args
,
query
);
if
(
create_statement
(
lineno
,
con
,
&
stmt
,
query
,
args
)
==
false
)
if
(
create_statement
(
lineno
,
con
,
&
stmt
,
query
,
args
)
==
false
)
...
@@ -1058,11 +1066,8 @@ ECPGstatus(int lineno, const char *connection_name)
...
@@ -1058,11 +1066,8 @@ ECPGstatus(int lineno, const char *connection_name)
{
{
struct
connection
*
con
=
get_connection
(
connection_name
);
struct
connection
*
con
=
get_connection
(
connection_name
);
if
(
con
==
NULL
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
{
return
(
false
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
/* are we connected? */
/* are we connected? */
if
(
con
->
connection
==
NULL
)
if
(
con
->
connection
==
NULL
)
...
@@ -1081,11 +1086,8 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
...
@@ -1081,11 +1086,8 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
PGresult
*
res
;
PGresult
*
res
;
struct
connection
*
con
=
get_connection
(
connection_name
);
struct
connection
*
con
=
get_connection
(
connection_name
);
if
(
con
==
NULL
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
{
return
(
false
);
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
(
false
);
}
ECPGlog
(
"ECPGtrans line %d action = %s connection = %s
\n
"
,
lineno
,
transaction
,
con
->
name
);
ECPGlog
(
"ECPGtrans line %d action = %s connection = %s
\n
"
,
lineno
,
transaction
,
con
->
name
);
...
@@ -1124,41 +1126,36 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
...
@@ -1124,41 +1126,36 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
struct
connection
*
con
=
get_connection
(
connection_name
);
struct
connection
*
con
=
get_connection
(
connection_name
);
PGresult
*
results
;
PGresult
*
results
;
if
(
con
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
return
(
false
);
if
(
con
->
autocommit
==
true
&&
strncmp
(
mode
,
"OFF"
,
strlen
(
"OFF"
))
==
0
)
{
{
if
(
con
->
autocommit
==
true
&&
strncmp
(
mode
,
"OFF"
,
strlen
(
"OFF"
))
==
0
)
if
(
con
->
committed
)
{
{
if
(
con
->
committed
)
if
(
(
results
=
PQexec
(
con
->
connection
,
"begin transaction"
))
==
NULL
)
{
{
if
((
results
=
PQexec
(
con
->
connection
,
"begin transaction"
))
==
NULL
)
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
{
return
false
;
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
return
false
;
}
PQclear
(
results
);
con
->
committed
=
false
;
}
}
con
->
autocommit
=
false
;
PQclear
(
results
);
con
->
committed
=
false
;
}
}
else
if
(
con
->
autocommit
==
false
&&
strncmp
(
mode
,
"ON"
,
strlen
(
"ON"
))
==
0
)
con
->
autocommit
=
false
;
}
else
if
(
con
->
autocommit
==
false
&&
strncmp
(
mode
,
"ON"
,
strlen
(
"ON"
))
==
0
)
{
if
(
!
con
->
committed
)
{
{
if
(
!
con
->
committed
)
if
(
(
results
=
PQexec
(
con
->
connection
,
"commit"
))
==
NULL
)
{
{
if
((
results
=
PQexec
(
con
->
connection
,
"commit"
))
==
NULL
)
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
{
return
false
;
register_error
(
ECPG_TRANS
,
"Error in transaction processing line %d."
,
lineno
);
return
false
;
}
PQclear
(
results
);
con
->
committed
=
true
;
}
}
con
->
autocommit
=
true
;
PQclear
(
results
);
con
->
committed
=
true
;
}
}
}
con
->
autocommit
=
true
;
else
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
false
;
}
}
return
true
;
return
true
;
...
@@ -1169,24 +1166,22 @@ ECPGsetconn(int lineno, const char *connection_name)
...
@@ -1169,24 +1166,22 @@ ECPGsetconn(int lineno, const char *connection_name)
{
{
struct
connection
*
con
=
get_connection
(
connection_name
);
struct
connection
*
con
=
get_connection
(
connection_name
);
if
(
con
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
{
return
(
false
);
actual_connection
=
con
;
return
true
;
actual_connection
=
con
;
}
return
true
;
else
{
register_error
(
ECPG_NO_CONN
,
"No such connection %s in line %d"
,
connection_name
?
connection_name
:
"NULL"
,
lineno
);
return
false
;
}
}
}
bool
bool
ECPGconnect
(
int
lineno
,
const
char
*
dbname
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
connection_name
,
int
autocommit
)
ECPGconnect
(
int
lineno
,
const
char
*
dbname
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
connection_name
,
int
autocommit
)
{
{
struct
connection
*
this
=
(
struct
connection
*
)
ecpg_alloc
(
sizeof
(
struct
connection
),
lineno
)
;
struct
connection
*
this
;
if
(
!
this
)
memcpy
((
char
*
)
&
sqlca
,
(
char
*
)
&
sqlca_init
,
sizeof
(
sqlca
));
if
((
this
=
(
struct
connection
*
)
ecpg_alloc
(
sizeof
(
struct
connection
),
lineno
))
==
NULL
)
return
false
;
return
false
;
if
(
dbname
==
NULL
&&
connection_name
==
NULL
)
if
(
dbname
==
NULL
&&
connection_name
==
NULL
)
...
@@ -1213,7 +1208,7 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
...
@@ -1213,7 +1208,7 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
if
(
PQstatus
(
this
->
connection
)
==
CONNECTION_BAD
)
if
(
PQstatus
(
this
->
connection
)
==
CONNECTION_BAD
)
{
{
ECPG
finish
(
this
);
ecpg_
finish
(
this
);
ECPGlog
(
"connect: could not open database %s %s%s in line %d
\n
"
,
dbname
?
dbname
:
"<DEFAULT>"
,
user
?
"for user "
:
""
,
user
?
user
:
""
,
lineno
);
ECPGlog
(
"connect: could not open database %s %s%s in line %d
\n
"
,
dbname
?
dbname
:
"<DEFAULT>"
,
user
?
"for user "
:
""
,
user
?
user
:
""
,
lineno
);
register_error
(
ECPG_CONNECT
,
"connect: could not open database %s."
,
dbname
?
dbname
:
"<DEFAULT>"
);
register_error
(
ECPG_CONNECT
,
"connect: could not open database %s."
,
dbname
?
dbname
:
"<DEFAULT>"
);
return
false
;
return
false
;
...
@@ -1237,21 +1232,17 @@ ECPGdisconnect(int lineno, const char *connection_name)
...
@@ -1237,21 +1232,17 @@ ECPGdisconnect(int lineno, const char *connection_name)
struct
connection
*
f
=
con
;
struct
connection
*
f
=
con
;
con
=
con
->
next
;
con
=
con
->
next
;
ECPG
finish
(
f
);
ecpg_
finish
(
f
);
}
}
}
}
else
else
{
{
con
=
get_connection
(
connection_name
);
con
=
get_connection
(
connection_name
);
if
(
con
==
NULL
)
if
(
!
ecpg_init
(
con
,
connection_name
,
lineno
))
{
return
(
false
);
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
else
ECPG
finish
(
con
);
ecpg_
finish
(
con
);
}
}
return
true
;
return
true
;
...
...
src/interfaces/ecpg/test/test2.pgc
View file @
231c5935
...
@@ -117,8 +117,8 @@ exec sql end declare section;
...
@@ -117,8 +117,8 @@ exec sql end declare section;
exec sql commit;
exec sql commit;
strcpy(msg, "disconnect");
strcpy(msg, "disconnect");
exec sql disconnect;
exec sql disconnect;
if (dbgs != NULL)
if (dbgs != NULL)
fclose(dbgs);
fclose(dbgs);
...
...
src/interfaces/ecpg/test/test3.pgc
View file @
231c5935
...
@@ -109,8 +109,8 @@ exec sql end declare section;
...
@@ -109,8 +109,8 @@ exec sql end declare section;
exec sql commit;
exec sql commit;
strcpy(msg, "disconnect");
strcpy(msg, "disconnect");
exec sql disconnect;
exec sql disconnect;
if (dbgs != NULL)
if (dbgs != NULL)
fclose(dbgs);
fclose(dbgs);
...
...
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