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

Commit30f16e7

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent6124c67 commit30f16e7

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

‎src/interfaces/ecpg/include/sqlca.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndefPOSTGRES_SQLCA_H
22
#definePOSTGRES_SQLCA_H
33

4+
#defineSQLERRMC_LEN70
5+
46
#ifdef__cplusplus
57
extern"C"
68
{
@@ -14,7 +16,7 @@ extern"C"
1416
struct
1517
{
1618
intsqlerrml;
17-
charsqlerrmc[70];
19+
charsqlerrmc[SQLERRMC_LEN];
1820
}sqlerrm;
1921
charsqlerrp[8];
2022
longsqlerrd[6];

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ register_error(long code, char *fmt,...)
109109

110110
sqlca.sqlcode=code;
111111
va_start(args,fmt);
112-
vsprintf(sqlca.sqlerrm.sqlerrmc,fmt,args);
112+
vsnprintf(sqlca.sqlerrm.sqlerrmc,SQLERRMC_LEN,fmt,args);
113113
va_end(args);
114114
sqlca.sqlerrm.sqlerrml=strlen(sqlca.sqlerrm.sqlerrmc);
115115

@@ -649,7 +649,8 @@ ECPGexecute(struct statement * stmt)
649649
intnfields,
650650
ntuples,
651651
act_tuple,
652-
act_field;
652+
act_field,
653+
isarray;
653654

654655
casePGRES_TUPLES_OK:
655656
nfields=PQnfields(results);
@@ -678,6 +679,16 @@ ECPGexecute(struct statement * stmt)
678679
return (false);
679680
}
680681

682+
array_query= (char*)ecpg_alloc(strlen("select typelem from pg_type where oid=")+11,stmt->lineno);
683+
sprintf(array_query,"select typelem from pg_type where oid=%d",PQftype(results,act_field));
684+
query=PQexec(stmt->connection->connection,array_query);
685+
isarray=0;
686+
if (PQresultStatus(query)==PGRES_TUPLES_OK) {
687+
isarray=atol((char*)PQgetvalue(query,0,0));
688+
ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array: %s\n",stmt->lineno,PQftype(results,act_field),var->type,isarray ?"yes" :"no");
689+
}
690+
PQclear(query);
691+
681692
/*
682693
* if we don't have enough space, we cannot read all
683694
* tuples
@@ -726,14 +737,6 @@ ECPGexecute(struct statement * stmt)
726737
add_mem(var->value,stmt->lineno);
727738
}
728739

729-
#if0
730-
array_query= (char*)ecpg_alloc(strlen("select typelem from pg_type where oid=")+11,stmt->lineno);
731-
sprintf(array_query,"select typelem from pg_type where oid=%d",PQftype(results,act_field));
732-
query=PQexec(stmt->connection->connection,array_query);
733-
if (PQresultStatus(query)==PGRES_TUPLES_OK)
734-
ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array OID: %s\n",stmt->lineno,PQftype(results,act_field),var->type, (char*)PQgetvalue(query,0,0));
735-
PQclear(query);
736-
#endif
737740
for (act_tuple=0;act_tuple<ntuples&&status;act_tuple++)
738741
{
739742
pval= (char*)PQgetvalue(results,act_tuple,act_field);

‎src/interfaces/ecpg/test/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
all: stp.so test1 test2 test3 test4 test5 perftest
22

33
#LDFLAGS=-g -I /usr/local/pgsql/include -L/usr/local/pgsql/lib -lecpg -lpq -lcrypt
4-
#LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
5-
LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
4+
LDFLAGS=-g -I../include -I/usr/include/postgresql -L/usr/lib/postgresql -L../lib -lecpg -lpq -lcrypt
5+
#LDFLAGS=-g -I/usr/include/postgresql -lecpg -lpq -lcrypt
66

77
#ECPG=/usr/local/pgsql/bin/ecpg
8-
#ECPG=../preproc/ecpg -I../include
9-
ECPG=/usr/bin/ecpg -I/usr/include/postgresql
8+
ECPG=../preproc/ecpg -I../include
9+
#ECPG=/usr/bin/ecpg -I/usr/include/postgresql
1010

1111
.SUFFIXES: .pgc .c
1212

@@ -22,7 +22,7 @@ perftest: perftest.c
2222

2323
stp.so: stp.c
2424
cc -fPIC -I../include -I/usr/include/postgresql -c -o stp.o stp.c
25-
ld -Bdynamic -shared -soname stp.so -o stp.so stp.o -lpq -lecpg
25+
ld -Bdynamic -shared -soname stp.so -o stp.so stp.o -lpq -lecpg -lc
2626

2727

2828
clean:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp