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
5933f185
Commit
5933f185
authored
Feb 16, 2000
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
68be513f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
130 additions
and
30 deletions
+130
-30
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+10
-0
src/interfaces/ecpg/TODO
src/interfaces/ecpg/TODO
+2
-1
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
+102
-19
src/interfaces/ecpg/test/Makefile
src/interfaces/ecpg/test/Makefile
+2
-2
src/interfaces/ecpg/test/test1.pgc
src/interfaces/ecpg/test/test1.pgc
+11
-5
src/interfaces/ecpg/test/test4.pgc
src/interfaces/ecpg/test/test4.pgc
+1
-1
No files found.
src/interfaces/ecpg/ChangeLog
View file @
5933f185
...
...
@@ -799,5 +799,15 @@ Tue Feb 15 11:14:07 CET 2000
- Synced keyword.c.
- Synced preproc.y with gram.y.
Tue Feb 15 17:39:19 CET 2000
- Do only write the first 70 bytes of the error message to the
sqlca structure since there are only 70 bytes free space.
- Set library version to 3.0.10.
Wed Feb 16 11:57:02 CET 2000
- Fixed library to be able to input complete arrays.
- Set library version to 3.1.0.
- Set ecpg version to 2.7.0.
src/interfaces/ecpg/TODO
View file @
5933f185
...
...
@@ -13,7 +13,8 @@ stderr. Instead it should be listed as a warning.
The error handling has to be improved by adding additional error-rules to
the parser.
it would be nice to be able to use :var[:index] as cvariable for an array var
it would be nice to be able to use :var[:index] or :var[<integer>] as
cvariable for an array var
How can one insert arrays from c variables?
...
...
src/interfaces/ecpg/lib/Makefile.in
View file @
5933f185
...
...
@@ -6,13 +6,13 @@
# Copyright (c) 1994, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.5
6 2000/01/18 13:03:47
meskes Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.5
7 2000/02/16 11:52:24
meskes Exp $
#
#-------------------------------------------------------------------------
NAME
=
ecpg
SO_MAJOR_VERSION
=
3
SO_MINOR_VERSION
=
0.1
0
SO_MINOR_VERSION
=
1.
0
SRCDIR
=
@top_srcdir@
include
$(SRCDIR)/Makefile.global
...
...
src/interfaces/ecpg/lib/ecpglib.c
View file @
5933f185
...
...
@@ -414,7 +414,7 @@ ECPGexecute(struct statement * stmt)
char
*
mallocedval
=
NULL
;
char
*
tobeinserted
=
NULL
;
char
*
p
;
char
buff
[
20
];
char
buff
[
20
];
/*
* Some special treatment is needed for records since we want
...
...
@@ -450,49 +450,132 @@ ECPGexecute(struct statement * stmt)
{
switch
(
var
->
type
)
{
int
element
;
case
ECPGt_short
:
sprintf
(
buff
,
"%d"
,
*
(
short
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%d,"
,
((
short
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_int
:
sprintf
(
buff
,
"%d"
,
*
(
int
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%d,"
,
((
int
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_unsigned_short
:
sprintf
(
buff
,
"%d"
,
*
(
unsigned
short
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%d,"
,
((
unsigned
short
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_unsigned_int
:
sprintf
(
buff
,
"%d"
,
*
(
unsigned
int
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%d,"
,
((
unsigned
int
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_long
:
sprintf
(
buff
,
"%ld"
,
*
(
long
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%ld,"
,
((
long
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_unsigned_long
:
sprintf
(
buff
,
"%ld"
,
*
(
unsigned
long
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%ld,"
,
((
unsigned
long
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_float
:
sprintf
(
buff
,
"%.14g"
,
*
(
float
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%.14g,"
,
((
float
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_double
:
sprintf
(
buff
,
"%.14g"
,
*
(
double
*
)
var
->
value
);
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%.14g,"
,
((
double
*
)
var
->
value
)[
element
]);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_bool
:
sprintf
(
buff
,
"'%c'"
,
(
*
(
char
*
)
var
->
value
?
't'
:
'f'
));
tobeinserted
=
buff
;
if
(
!
(
mallocedval
=
ecpg_alloc
(
var
->
arrsize
*
20
,
stmt
->
lineno
)))
return
false
;
sprintf
(
mallocedval
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"'{"
:
""
);
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%c,"
,
(((
char
*
)
var
->
value
)[
element
])
?
't'
:
'f'
);
sprintf
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"%s"
,
(
var
->
arrsize
>
1
)
?
"}'"
:
""
);
tobeinserted
=
mallocedval
;
break
;
case
ECPGt_char
:
...
...
src/interfaces/ecpg/test/Makefile
View file @
5933f185
all
:
stp.so test1 test2 test3 test4 test5 perftest
#LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt
LDFLAGS
=
-g
-I
../include
-I
/usr/include/postgresql
-L
/usr/lib/postgresql
-L
../lib
-lecpg
-lpq
-lcrypt
#
LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
#
LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
LDFLAGS
=
-g
-I
/usr/include/postgresql
-lecpg
-lpq
-lcrypt
#ECPG=/usr/local/pgsql/bin/ecpg
ECPG
=
../preproc/ecpg
-I
../include
...
...
src/interfaces/ecpg/test/test1.pgc
View file @
5933f185
...
...
@@ -18,7 +18,7 @@ void warn(void)
exec sql include sqlca;
/* comment */
exec sql define AMOUNT
4
;
exec sql define AMOUNT
6
;
exec sql type intarray is int[AMOUNT];
exec sql type string is char(8);
...
...
@@ -97,12 +97,18 @@ exec sql end declare section;
printf("Database: mm\n");
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
{
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
exec sql begin declare section;
char n[8], l = letter[i][0];
int a = amount[i];
exec sql end declare section;
strncpy(n, name[i], 8);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
amount[i]+=1000;
}
strcpy(msg, "insert");
exec sql at pm insert into "Test" (name, amount, letter) values (:name, :amount, :letter);
strcpy(msg, "insert");
exec sql at pm insert into "Test" (name, amount, letter) values (:n, :a, :l);
}
strcpy(msg, "select");
exec sql at pm select * into :name, :amount, :letter from "Test";
...
...
src/interfaces/ecpg/test/test4.pgc
View file @
5933f185
...
...
@@ -30,7 +30,7 @@ EXEC SQL END DECLARE SECTION;
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) VALUES(140787.0,2,:a);*/
EXEC SQL INSERT INTO test(f,i,a) VALUES(140787.0,2,:a);
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