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
42df5e31
Commit
42df5e31
authored
Jul 15, 2003
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started to create different error codes for different backend messages.
parent
9117e554
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
43 deletions
+34
-43
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+10
-0
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/connect.c
+5
-5
src/interfaces/ecpg/ecpglib/error.c
src/interfaces/ecpg/ecpglib/error.c
+6
-28
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+1
-3
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/ecpglib/extern.h
+0
-7
src/interfaces/ecpg/include/ecpgerrno.h
src/interfaces/ecpg/include/ecpgerrno.h
+2
-0
src/interfaces/ecpg/test/test_informix.pgc
src/interfaces/ecpg/test/test_informix.pgc
+10
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
42df5e31
...
...
@@ -1569,6 +1569,16 @@ Wed Jul 9 11:45:02 CEST 2003
- Made all Informix functions honor Informix NULLs.
- Extended compatibility functions for INFORMIX handling of DECLARE
statement to work with indicators.
Mon Jul 14 09:34:04 CEST 2003
- Synced preproc.y with gram.y
- Init sqlca in ECPGprepare().
- Added CLOSE DATABASE for Informix compatibility.
Tue Jul 15 14:28:53 CEST 2003
_ Started to add error codes for backend error messages.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
...
...
src/interfaces/ecpg/ecpglib/connect.c
View file @
42df5e31
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.1
1 2003/07/08 07:13:4
8 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.1
2 2003/07/15 12:38:3
8 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -68,7 +68,6 @@ ecpg_finish(struct connection * act)
struct
ECPGtype_information_cache
*
cache
,
*
ptr
;
ECPGlog
(
"ecpg_finish: finishing %s.
\n
"
,
act
->
name
);
PQfinish
(
act
->
connection
);
/* no need to lock connections_mutex - we're always called
...
...
@@ -90,6 +89,8 @@ ecpg_finish(struct connection * act)
if
(
actual_connection
==
act
)
actual_connection
=
all_connections
;
ECPGlog
(
"ecpg_finish: Connection %s closed.
\n
"
,
act
->
name
);
for
(
cache
=
act
->
cache_head
;
cache
;
ptr
=
cache
,
cache
=
cache
->
next
,
ECPGfree
(
ptr
));
ECPGfree
(
act
->
name
);
ECPGfree
(
act
);
...
...
@@ -484,7 +485,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
const
char
*
errmsg
=
PQerrorMessage
(
this
->
connection
);
char
*
db
=
realname
?
realname
:
"<DEFAULT>"
;
set_backend_err
(
errmsg
,
lineno
);
ecpg_finish
(
this
);
#ifdef USE_THREADS
pthread_mutex_unlock
(
&
connections_mutex
);
...
...
src/interfaces/ecpg/ecpglib/error.c
View file @
42df5e31
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.
2 2003/06/15 04:07:58 momjian
Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.
3 2003/07/15 12:38:38 meskes
Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -11,10 +11,6 @@
#include "extern.h"
#include "sqlca.h"
/* This should hold the back-end error message from
* the last back-end operation. */
static
char
*
ECPGerr
;
void
ECPGraise
(
int
line
,
int
code
,
const
char
*
str
)
{
...
...
@@ -142,6 +138,11 @@ ECPGraise(int line, int code, const char *str)
slen
--
;
snprintf
(
sqlca
->
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
->
sqlerrm
.
sqlerrmc
),
"'%.*s' in line %d."
,
slen
,
str
,
line
);
if
(
strncmp
(
str
,
"ERROR: Cannot insert a duplicate key"
,
strlen
(
"ERROR: Cannot insert a duplicate key"
))
==
0
)
sqlca
->
sqlcode
=
ECPG_DUPLICATE_KEY
;
else
if
(
strncmp
(
str
,
"ERROR: More than one tuple returned by a subselect"
,
strlen
(
"ERROR: More than one tuple returned by a subselect"
))
==
0
)
sqlca
->
sqlcode
=
ECPG_SUBSELECT_NOT_ONE
;
break
;
}
...
...
@@ -168,29 +169,6 @@ ECPGraise(int line, int code, const char *str)
ECPGfree_auto_mem
();
}
/* Set the error message string from the backend */
void
set_backend_err
(
const
char
*
err
,
int
lineno
)
{
if
(
ECPGerr
)
ECPGfree
(
ECPGerr
);
if
(
!
err
)
{
ECPGerr
=
NULL
;
return
;
}
ECPGerr
=
ECPGstrdup
(
err
,
lineno
);
}
/* Retrieve the error message from the backend. */
char
*
ECPGerrmsg
(
void
)
{
return
ECPGerr
;
}
/* print out an error message */
void
sqlprint
(
void
)
...
...
src/interfaces/ecpg/ecpglib/execute.c
View file @
42df5e31
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
8 2003/07/08 12:11:29
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
9 2003/07/15 12:38:38
meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
...
...
@@ -1131,7 +1131,6 @@ ECPGexecute(struct statement * stmt)
errmsg
=
PQerrorMessage
(
stmt
->
connection
->
connection
);
ECPGlog
(
"ECPGexecute line %d: error: %s"
,
stmt
->
lineno
,
errmsg
);
ECPGraise
(
stmt
->
lineno
,
ECPG_PGSQL
,
errmsg
);
set_backend_err
(
errmsg
,
stmt
->
lineno
);
}
else
...
...
@@ -1144,7 +1143,6 @@ ECPGexecute(struct statement * stmt)
struct
sqlca_t
*
sqlca
=
ECPGget_sqlca
();
errmsg
=
PQresultErrorMessage
(
results
);
set_backend_err
(
errmsg
,
stmt
->
lineno
);
var
=
stmt
->
outlist
;
switch
(
PQresultStatus
(
results
))
...
...
src/interfaces/ecpg/ecpglib/extern.h
View file @
42df5e31
...
...
@@ -10,13 +10,6 @@ enum COMPAT_MODE { ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFO
/* Here are some methods used by the lib. */
/* Stores the backend error message for client access */
void
set_backend_err
(
const
char
*
err
,
int
lineon
);
/* Store and retrieve the backend error message for client access */
void
set_backend_err
(
const
char
*
err
,
int
lineon
);
char
*
ECPGerrmsg
(
void
);
/* Returns a pointer to a string containing a simple type name. */
void
ECPGadd_mem
(
void
*
ptr
,
int
lineno
);
...
...
src/interfaces/ecpg/include/ecpgerrno.h
View file @
42df5e31
...
...
@@ -47,6 +47,8 @@
#define ECPG_PGSQL -400
#define ECPG_TRANS -401
#define ECPG_CONNECT -402
#define ECPG_DUPLICATE_KEY -403
#define ECPG_SUBSELECT_NOT_ONE -404
/* backend WARNINGs, starting at 600 */
#define ECPG_WARNING_UNRECOGNIZED -600
...
...
src/interfaces/ecpg/test/test_informix.pgc
View file @
42df5e31
...
...
@@ -17,8 +17,18 @@ int main()
rsetnull(CDECIMALTYPE, (char *)&j);
$insert into test (i, j) values (7, :j);
$commit;
$insert into test (i, j) values (7, 2);
printf("%ld: %s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) $rollback;
$insert into test (i, j) values (:i, 1);
$select i from test where j=(select j from test);
printf("%ld: %s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) $rollback;
$declare c cursor for select * from test where i <= :i;
openit();
...
...
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