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
9fb20f10
Commit
9fb20f10
authored
Apr 05, 2000
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
5f39ba81
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
41 deletions
+64
-41
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+8
-0
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpglib.h
+1
-1
src/interfaces/ecpg/lib/error.c
src/interfaces/ecpg/lib/error.c
+10
-5
src/interfaces/ecpg/lib/execute.c
src/interfaces/ecpg/lib/execute.c
+4
-4
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/pgc.l
+2
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+4
-4
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.c
+18
-13
src/interfaces/ecpg/test/Makefile
src/interfaces/ecpg/test/Makefile
+2
-2
src/interfaces/ecpg/test/test4.pgc
src/interfaces/ecpg/test/test4.pgc
+15
-11
No files found.
src/interfaces/ecpg/ChangeLog
View file @
9fb20f10
...
...
@@ -894,5 +894,13 @@ Mon Apr 3 21:20:27 CEST 2000
- Made sure pointers are correctly inserted by libecpg. My thanks go
to Jan Urbanek <jan@urbanek.cz> for findin many bugs before the
release.
Wed Apr 5 07:54:56 CEST 2000
- Added patch by Peter Eisentraut <e99re41@DoCS.UU.SE> to fix some
duplicate definittions in preproc.y.
- Removed duplicate ',' in execute.c.
- Changed error message for backend errors so it fits into sqlca.
- Fixed array handling.
- Set library version to 3.1.0.
- Set ecpg version to 2.7.0.
src/interfaces/ecpg/include/ecpglib.h
View file @
9fb20f10
...
...
@@ -34,7 +34,7 @@ extern "C"
const
char
*
descriptor
,
const
char
*
query
);
bool
ECPGdeallocate_desc
(
int
line
,
const
char
*
name
);
bool
ECPGallocate_desc
(
int
line
,
const
char
*
name
);
void
ECPGraise
(
int
line
,
int
code
,
c
onst
c
har
*
str
);
void
ECPGraise
(
int
line
,
int
code
,
char
*
str
);
bool
ECPGget_desc_header
(
int
,
char
*
,
int
*
);
bool
ECPGget_desc
(
int
,
char
*
,
int
,
...);
...
...
src/interfaces/ecpg/lib/error.c
View file @
9fb20f10
...
...
@@ -7,9 +7,10 @@
#include <sqlca.h>
void
ECPGraise
(
int
line
,
int
code
,
c
onst
c
har
*
str
)
ECPGraise
(
int
line
,
int
code
,
char
*
str
)
{
sqlca
.
sqlcode
=
code
;
switch
(
code
)
{
case
ECPG_NOT_FOUND
:
...
...
@@ -117,9 +118,13 @@ ECPGraise(int line, int code, const char *str)
"Variable is not a character type in line %d."
,
line
);
break
;
case
ECPG_PGSQL
:
case
ECPG_PGSQL
:
/* strip trailing newline */
if
(
str
[
strlen
(
str
)
-
1
]
==
'\n'
)
str
[
strlen
(
str
)
-
1
]
=
'\0'
;
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
"
Postgres error
'%s' in line %d."
,
str
,
line
);
"'%s' in line %d."
,
str
,
line
);
break
;
case
ECPG_TRANS
:
...
...
@@ -134,12 +139,12 @@ ECPGraise(int line, int code, const char *str)
default:
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
"SQL error #%d in line %d."
,
code
,
line
);
"SQL error #%d in line %d."
,
code
,
line
);
break
;
}
sqlca
.
sqlerrm
.
sqlerrml
=
strlen
(
sqlca
.
sqlerrm
.
sqlerrmc
);
/* free all memory we have allocated for the user */
free_auto_mem
();
}
...
...
src/interfaces/ecpg/lib/execute.c
View file @
9fb20f10
...
...
@@ -479,7 +479,7 @@ ECPGexecute(struct statement * stmt)
strncpy
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"}'"
,
sizeof
(
"}'"
));
}
else
sprintf
(
mallocedval
,
"%c
,
"
,
(
*
((
char
*
)
var
->
value
))
?
't'
:
'f'
);
sprintf
(
mallocedval
,
"%c"
,
(
*
((
char
*
)
var
->
value
))
?
't'
:
'f'
);
tobeinserted
=
mallocedval
;
break
;
...
...
@@ -541,7 +541,7 @@ ECPGexecute(struct statement * stmt)
default:
/* Not implemented yet */
ECPGraise
(
stmt
->
lineno
,
ECPG_UNSUPPORTED
,
ECPGtype_name
(
var
->
type
));
ECPGraise
(
stmt
->
lineno
,
ECPG_UNSUPPORTED
,
(
char
*
)
ECPGtype_name
(
var
->
type
));
return
false
;
break
;
}
...
...
@@ -859,7 +859,7 @@ ECPGdo(int lineno, const char *connection_name, char *query, ...)
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.
3 2000/04/03 19:34:25
meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.
4 2000/04/05 09:05:28
meskes Exp $
*/
PGconn
*
ECPG_internal_get_connection
(
char
*
name
);
...
...
@@ -1024,6 +1024,6 @@ bool ECPGdo_descriptor(int line,const char *connection,
}
}
ECPGraise
(
line
,
ECPG_UNKNOWN_DESCRIPTOR
,
descriptor
);
ECPGraise
(
line
,
ECPG_UNKNOWN_DESCRIPTOR
,
(
char
*
)
descriptor
);
return
false
;
}
src/interfaces/ecpg/preproc/pgc.l
View file @
9fb20f10
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.5
7 2000/03/30 11:41:40
meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.5
8 2000/04/05 09:05:34
meskes Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -827,6 +827,7 @@ lex_init(void)
braces_open = 0;
preproc_tos = 0;
yylineno = 0;
ifcond = TRUE;
stacked_if_value[preproc_tos].condition = ifcond;
stacked_if_value[preproc_tos].else_branch = FALSE;
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
9fb20f10
...
...
@@ -325,7 +325,7 @@ make_name(void)
%type <str> TriggerActionTime CreateTrigStmt DropPLangStmt PLangTrusted
%type <str> CreatePLangStmt IntegerOnly TriggerFuncArgs TriggerFuncArg
%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_encoding
%type <str> createdb_opt_location opt_encoding
AlterTableStmt
%type <str> createdb_opt_location opt_encoding
%type <str> DropdbStmt ClusterStmt grantee RevokeStmt table_expr Bit bit
%type <str> GrantStmt privileges operation_commalist operation
%type <str> opt_cursor opt_lmode ConstraintsSetStmt comment_tg
...
...
@@ -333,7 +333,7 @@ make_name(void)
%type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec
%type <str> select_offset_value using_expr join_expr ReindexStmt
%type <str> using_list from_expr join_clause join_type
%type <str> join_qual update_list join_clause
join_clause
_with_union
%type <str> join_qual update_list join_clause_with_union
%type <str> opt_level opt_lock lock_type users_in_new_group_clause
%type <str> OptConstrFromTable comment_op OptTempTableName
%type <str> constraints_set_list constraints_set_namelist comment_fn
...
...
@@ -359,7 +359,7 @@ make_name(void)
%type <str> enum_type civariableonly ECPGCursorStmt ECPGDeallocate
%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
%type <str> struct_type s_struct declaration declarations variable_declarations
%type <str> s_
struct s_
union union_type ECPGSetAutocommit on_off
%type <str> s_union union_type ECPGSetAutocommit on_off
%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol
%type <str> ECPGGetDescriptorHeader ECPGColId ECPGColLabel ECPGTypeName
%type <str> ECPGLabelTypeName
...
...
@@ -4349,7 +4349,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_initializer
$$ = cat_str(4, $1, mm_strdup($2), $3.str, $4);
break;
case ECPGt_varchar:
if (dimension
== -1
)
if (dimension
< 0
)
type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length);
else
type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension);
...
...
src/interfaces/ecpg/preproc/type.c
View file @
9fb20f10
...
...
@@ -198,13 +198,6 @@ static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, l
void
ECPGdump_a_type
(
FILE
*
o
,
const
char
*
name
,
struct
ECPGtype
*
typ
,
const
char
*
ind_name
,
struct
ECPGtype
*
ind_typ
,
const
char
*
prefix
,
const
char
*
ind_prefix
)
{
#if 0
if (ind_typ == NULL)
{
ind_typ = &ecpg_no_indicator;
ind_name = "no_indicator";
}
#endif
switch
(
typ
->
typ
)
{
case
ECPGt_array
:
...
...
@@ -273,23 +266,35 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
char
*
variable
=
(
char
*
)
mm_alloc
(
strlen
(
name
)
+
((
prefix
==
NULL
)
?
0
:
strlen
(
prefix
))
+
4
);
char
*
offset
=
(
char
*
)
mm_alloc
(
strlen
(
name
)
+
strlen
(
"sizeof(struct varchar_)"
)
+
1
);
/* we have to use the pointer except for arrays with given bounds */
if
(
arrsize
>
0
)
sprintf
(
variable
,
"(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
else
sprintf
(
variable
,
"&(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
switch
(
typ
)
{
case
ECPGt_varchar
:
/* we have to use the pointer except for arrays with given bounds */
if
(
arrsize
>
0
)
sprintf
(
variable
,
"(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
else
sprintf
(
variable
,
"&(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
sprintf
(
offset
,
"sizeof(struct varchar_%s)"
,
name
);
break
;
case
ECPGt_char
:
case
ECPGt_unsigned_char
:
case
ECPGt_char_variable
:
/* we have to use the pointer except for arrays with given bounds */
if
(
varcharsize
>
1
||
arrsize
>
0
)
sprintf
(
variable
,
"(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
else
sprintf
(
variable
,
"&(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
sprintf
(
offset
,
"%ld*sizeof(char)"
,
varcharsize
==
0
?
1
:
varcharsize
);
break
;
default:
/* we have to use the pointer except for arrays with given bounds */
if
(
arrsize
>
0
)
sprintf
(
variable
,
"(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
else
sprintf
(
variable
,
"&(%s%s)"
,
prefix
?
prefix
:
""
,
name
);
sprintf
(
offset
,
"sizeof(%s)"
,
ECPGtype_name
(
typ
));
break
;
}
...
...
src/interfaces/ecpg/test/Makefile
View file @
9fb20f10
all
:
test1 test2 test3 test4 perftest dyntest dyntest2
#
LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt
LDFLAGS
=
-g
-I
../include
-I
/usr/include/postgresql
-L
../lib
-L
/usr/lib/postgresql
-lecpg
-lpq
-lcrypt
LDFLAGS
=
-g
-I
/usr/local/pgsql/include
-L
/usr/local/pgsql/lib
-lecpg
-lpq
-lcrypt
#
LDFLAGS=-g -I../include -I/usr/include/postgresql -L../lib -L/usr/lib/postgresql -lecpg -lpq -lcrypt
#LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
#ECPG=/usr/local/pgsql/bin/ecpg
...
...
src/interfaces/ecpg/test/test4.pgc
View file @
9fb20f10
...
...
@@ -11,6 +11,8 @@ EXEC SQL BEGIN DECLARE SECTION;
int i = 3;
int *did = &i;
int a[10] = {9,8,7,6,5,4,3,2,1,0};
char text[10] = "klmnopqrst";
char *t = "uvwxyz1234";
double f;
EXEC SQL END DECLARE SECTION;
FILE *dbgs;
...
...
@@ -26,34 +28,36 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL BEGIN WORK;
/* EXEC SQL CREATE TABLE test (f decimal(8,2), i int, a int[10]);*/
EXEC SQL CREATE TABLE test (f float, i int, a int[10]);
EXEC SQL CREATE TABLE test (f float, i int, a int[10], text char(10));
EXEC SQL INSERT INTO test(f,i,a
) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}
');
EXEC SQL INSERT INTO test(f,i,a
,text) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij
');
EXEC SQL INSERT INTO test(f,i,a
) VALUES(140787.0,2,:a
);
EXEC SQL INSERT INTO test(f,i,a
,text) VALUES(140787.0,2,:a,:text
);
EXEC SQL INSERT INTO test(f,i,a
) VALUES(14.07,:did,:a
);
EXEC SQL INSERT INTO test(f,i,a
,text) VALUES(14.07,:did,:a,:t
);
EXEC SQL COMMIT;
EXEC SQL BEGIN WORK;
EXEC SQL SELECT f
INTO :f
EXEC SQL SELECT f
,text
INTO :f
,:text
FROM test
WHERE i =
:i
;
WHERE i =
1
;
printf("Found f=%f
\n", f
);
printf("Found f=%f
text=%10.10s\n", f, text
);
EXEC SQL SELECT a
INTO :a
f=14.07;
EXEC SQL SELECT a,text
INTO :a,:t
FROM test
WHERE f = :f;
for (i = 0; i < 10; i++)
printf("Found a[%d] = %d\n", i, a[i]);
printf("Found text=%10.10s\n", t);
EXEC SQL DROP TABLE test;
EXEC SQL COMMIT;
...
...
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