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

Commit051a4f2

Browse files
author
Michael Meskes
committed
Added Christof's fixes.
1 parent4e37786 commit051a4f2

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,5 +1196,10 @@ Tue Jan 8 15:16:37 CET 2002
11961196
Thu Jan 10 11:12:14 CET 2002
11971197

11981198
- Include sqlca.h automatically.
1199+
1200+
Fri Jan 11 15:43:39 CET 2002
1201+
1202+
- clear sqlca on : [de]allocate descriptor & get descriptor and set
1203+
sqlca.sqlerrd[2] accordingly (Christof).
11991204
- Set ecpg version to 2.9.0.
12001205
- Set library version to 3.3.0.

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

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dynamic SQL support routines
22
*
3-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.20 2001/12/23 12:17:41 meskes Exp $
3+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.21 2002/01/11 14:43:11 meskes Exp $
44
*/
55

66
#include"postgres_fe.h"
@@ -10,6 +10,7 @@
1010
#include"ecpglib.h"
1111
#include"ecpgerrno.h"
1212
#include"extern.h"
13+
#include"sqlca.h"
1314
#include"sql3types.h"
1415

1516
structdescriptor*all_descriptors=NULL;
@@ -49,12 +50,15 @@ ECPGDynamicType_DDT(Oid type)
4950
bool
5051
ECPGget_desc_header(intlineno,char*desc_name,int*count)
5152
{
52-
PGresult*ECPGresult=ECPGresultByDescriptor(lineno,desc_name);
53+
PGresult*ECPGresult;
5354

55+
ECPGinit_sqlca();
56+
ECPGresult=ECPGresultByDescriptor(lineno,desc_name);
5457
if (!ECPGresult)
5558
return false;
5659

5760
*count=PQnfields(ECPGresult);
61+
sqlca.sqlerrd[2]=1;
5862
ECPGlog("ECPGget_desc_header: found %d attributes.\n",*count);
5963
return true;
6064
}
@@ -140,13 +144,15 @@ bool
140144
ECPGget_desc(intlineno,char*desc_name,intindex,...)
141145
{
142146
va_listargs;
143-
PGresult*ECPGresult=ECPGresultByDescriptor(lineno,desc_name);
147+
PGresult*ECPGresult;
144148
enumECPGdtypetype;
145149
intntuples,
146150
act_tuple;
147151
structvariabledata_var;
148152

149153
va_start(args,index);
154+
ECPGinit_sqlca();
155+
ECPGresult=ECPGresultByDescriptor(lineno,desc_name);
150156
if (!ECPGresult)
151157
return (false);
152158

@@ -359,7 +365,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
359365
ECPGlog("ECPGget_desc: INDICATOR[%d] = %d\n",act_tuple,-PQgetisnull(ECPGresult,act_tuple,index));
360366
}
361367
}
362-
368+
sqlca.sqlerrd[2]=ntuples;
363369
return (true);
364370
}
365371

@@ -369,6 +375,7 @@ ECPGdeallocate_desc(int line, const char *name)
369375
structdescriptor*i;
370376
structdescriptor**lastptr=&all_descriptors;
371377

378+
ECPGinit_sqlca();
372379
for (i=all_descriptors;i;lastptr=&i->next,i=i->next)
373380
{
374381
if (!strcmp(name,i->name))
@@ -387,11 +394,26 @@ ECPGdeallocate_desc(int line, const char *name)
387394
bool
388395
ECPGallocate_desc(intline,constchar*name)
389396
{
390-
structdescriptor*new= (structdescriptor*)ECPGalloc(sizeof(structdescriptor),line);
397+
structdescriptor*new;
391398

399+
ECPGinit_sqlca();
400+
new= (structdescriptor*)ECPGalloc(sizeof(structdescriptor),line);
401+
if (!new)return false;
392402
new->next=all_descriptors;
393403
new->name=ECPGalloc(strlen(name)+1,line);
404+
if (!new->name)
405+
{
406+
ECPGfree(new);
407+
return false;
408+
}
394409
new->result=PQmakeEmptyPGresult(NULL,0);
410+
if (!new->result)
411+
{
412+
ECPGfree(new->name);
413+
ECPGfree(new);
414+
ECPGraise(line,ECPG_OUT_OF_MEMORY,NULL);
415+
return false;
416+
}
395417
strcpy(new->name,name);
396418
all_descriptors=new;
397419
return true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp