Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite39a118

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent76da5b8 commite39a118

File tree

6 files changed

+44
-18
lines changed

6 files changed

+44
-18
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,4 +919,9 @@ Mon May 15 10:51:31 CEST 2000
919919
- Added patch by SAKAIDA Masaaki <sakaida@psn.co.jp> to fix segfault.
920920
- Set ecpg version to 2.7.1.
921921

922+
Wed May 17 07:52:59 CEST 2000
923+
924+
- Added patch by SAKAIDA Masaaki <sakaida@psn.co.jp> to fix array
925+
handling.
926+
- Set library version to 3.1.1.
922927

‎src/interfaces/ecpg/lib/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# Copyright (c) 1994, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.65 2000/03/30 11:41:34 meskes Exp $
9+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.66 2000/05/17 06:03:13 meskes Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

1313
NAME= ecpg
1414
SO_MAJOR_VERSION= 3
15-
SO_MINOR_VERSION= 1.0
15+
SO_MINOR_VERSION= 1.1
1616

1717
SRCDIR= @top_srcdir@
1818
include $(SRCDIR)/Makefile.global

‎src/interfaces/ecpg/lib/data.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdlib.h>
2+
#include <string.h>
23

34
#include <ecpgtype.h>
45
#include <ecpglib.h>
@@ -26,8 +27,18 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
2627
ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, NULL);
2728
return (false);
2829
}
29-
else
30-
++pval;
30+
31+
switch (type)
32+
{
33+
case ECPGt_char:
34+
case ECPGt_unsigned_char:
35+
case ECPGt_varchar:
36+
break;
37+
38+
default:
39+
pval++;
40+
break;
41+
}
3142
}
3243

3344
/* We will have to decode the value */
@@ -144,7 +155,14 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
144155
case ECPGt_double:
145156
if (pval)
146157
{
147-
dres = strtod(pval, &scan_length);
158+
if (isarray && *pval == '"')
159+
dres = strtod(pval + 1, &scan_length);
160+
else
161+
dres = strtod(pval, &scan_length);
162+
163+
if (isarray && *scan_length == '"')
164+
scan_length++;
165+
148166
if ((isarray && *scan_length != ',' && *scan_length != '}')
149167
|| (!isarray && *scan_length != '\0'))/* Garbage left */
150168
{

‎src/interfaces/ecpg/test/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ all: test1 test2 test3 test4 perftest dyntest dyntest2
22

33
LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq
44

5-
ECPG=../preproc/ecpg -I../include
5+
ECPG=/usr/local/pgsql/bin/ecpg -I../include
6+
#ECPG=../preproc/ecpg -I../include
67

78
.SUFFIXES: .pgc .c
89

@@ -18,4 +19,4 @@ dyntest2: dyntest2.c
1819
$(ECPG) $?
1920

2021
clean:
21-
rm -f test1 test2 test3 test4 perftest *.c*.olog dyntest dyntest2
22+
rm -f test1 test2 test3 test4 perftest *.c log dyntest dyntest2

‎src/interfaces/ecpg/test/test1.pgc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
exec sql include sqlca;
42

53
exec sql whenever sqlerror do PrintAndStop(msg);
@@ -88,8 +86,9 @@ exec sql end declare section;
8886
strcpy(msg, "commit");
8987
exec sql commit;
9088

91-
/* Stop automatic transactioning for connection pm. */
92-
exec sql at pm set autocommit to off;
89+
/* Start automatic transactioning for connection pm. */
90+
exec sql at pm set autocommit to on;
91+
exec sql at pm begin transaction;
9392

9493
strcpy(msg, "select");
9594
exec sql select name, amount, letter into :name, :amount, :letter from "Test";
@@ -117,14 +116,17 @@ exec sql end declare section;
117116
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
118117
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
119118

120-
strcpy(msg, "drop");
121-
exec sql drop table "Test";
122-
exec sql at pm drop table "Test";
123-
124119
strcpy(msg, "commit");
125120
exec sql commit;
126121
exec sql at pm commit;
127122

123+
/* Start automatic transactioning for connection main. */
124+
exec sql set autocommit to on;
125+
126+
strcpy(msg, "drop");
127+
exec sql drop table "Test";
128+
exec sql at pm drop table "Test";
129+
128130
strcpy(msg, "disconnect");
129131
exec sql disconnect main;
130132
exec sql disconnect pm;

‎src/interfaces/ecpg/test/test4.pgc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int
88
main ()
99
{
1010
EXEC SQL BEGIN DECLARE SECTION;
11-
int i =3;
11+
int i =1;
1212
int *did = &i;
1313
int a[10] = {9,8,7,6,5,4,3,2,1,0};
1414
char text[10] = "klmnopqrst";
@@ -31,7 +31,7 @@ EXEC SQL END DECLARE SECTION;
3131

3232
EXEC SQL CREATE TABLE test (f float, i int, a int[10], text char(10), b bool);
3333

34-
EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij', 'f');
34+
EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(404.90,3,'{0,1,2,3,4,5,6,7,8,9}','abcdefghij', 'f');
3535

3636
EXEC SQL INSERT INTO test(f,i,a,text,b) VALUES(140787.0,2,:a,:text,'t');
3737

@@ -48,7 +48,7 @@ EXEC SQL END DECLARE SECTION;
4848

4949
printf("Found f=%f text=%10.10s b=%d\n", f, text, b);
5050

51-
f=14.07;
51+
f=140787;
5252
EXEC SQL SELECT a,text
5353
INTO :a,:t
5454
FROM test

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp