Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
91411b61
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91411b61
编写于
6月 11, 2007
作者:
M
Michael Meskes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed one memory leak in descriptor code.
Made sure ecpg deletes output file in case of an error.
上级
5f2bda15
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
15 deletion
+38
-15
src/interfaces/ecpg/ecpglib/descriptor.c
src/interfaces/ecpg/ecpglib/descriptor.c
+14
-2
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+2
-2
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/ecpg.c
+14
-8
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/extern.h
+3
-2
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+5
-1
未找到文件。
src/interfaces/ecpg/ecpglib/descriptor.c
浏览文件 @
91411b61
/* dynamic SQL support routines
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.2
1 2007/04/27 06:56:11
meskes Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.2
2 2007/06/11 11:52:08
meskes Exp $
*/
#define POSTGRES_ECPG_INTERNAL
...
...
@@ -547,7 +547,7 @@ ECPGset_desc(int lineno, const char *desc_name, int index,...)
ECPGfree
(
var
);
return
false
;
}
ECPGfree
(
desc_item
->
data
);
/* free() takes care of a potential NULL value */
desc_item
->
data
=
(
char
*
)
tobeinserted
;
tobeinserted
=
NULL
;
break
;
...
...
@@ -607,6 +607,18 @@ ECPGdeallocate_desc(int line, const char *name)
{
if
(
!
strcmp
(
name
,
i
->
name
))
{
struct
descriptor_item
*
desc_item
;
for
(
desc_item
=
i
->
items
;
desc_item
;)
{
struct
descriptor_item
*
di
;
ECPGfree
(
desc_item
->
data
);
di
=
desc_item
;
desc_item
=
desc_item
->
next
;
ECPGfree
(
di
);
}
*
lastptr
=
i
->
next
;
ECPGfree
(
i
->
name
);
PQclear
(
i
->
result
);
...
...
src/interfaces/ecpg/ecpglib/execute.c
浏览文件 @
91411b61
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.6
6 2007/04/27 06:56:11
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.6
7 2007/06/11 11:52:08
meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
...
...
@@ -48,7 +48,7 @@ quote_postgres(char *arg, bool quote, int lineno)
* will be quoted once they are inserted in a statement
*/
if
(
!
quote
)
return
res
=
ECPGstrdup
(
arg
,
lineno
)
;
return
arg
;
else
{
length
=
strlen
(
arg
);
...
...
src/interfaces/ecpg/preproc/ecpg.c
浏览文件 @
91411b61
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.9
8 2007/03/17 19:25:23
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.9
9 2007/06/11 11:52:08
meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
...
...
@@ -20,6 +20,8 @@ int ret_value = 0,
header_mode
=
false
,
regression_mode
=
false
;
char
*
output_filename
;
enum
COMPAT_MODE
compat
=
ECPG_COMPAT_PGSQL
;
struct
_include_path
*
include_paths
=
NULL
;
...
...
@@ -135,6 +137,7 @@ main(int argc, char *const argv[])
find_my_exec
(
argv
[
0
],
my_exec_path
);
output_filename
=
NULL
;
while
((
c
=
getopt_long
(
argc
,
argv
,
"vcio:I:tD:dC:r:h?"
,
ecpg_options
,
NULL
))
!=
-
1
)
{
switch
(
c
)
...
...
@@ -163,14 +166,18 @@ main(int argc, char *const argv[])
regression_mode
=
true
;
break
;
case
'o'
:
if
(
strcmp
(
optarg
,
"-"
)
==
0
)
output_filename
=
optarg
;
if
(
strcmp
(
output_filename
,
"-"
)
==
0
)
yyout
=
stdout
;
else
yyout
=
fopen
(
o
ptarg
,
PG_BINARY_W
);
yyout
=
fopen
(
o
utput_filename
,
PG_BINARY_W
);
if
(
yyout
==
NULL
)
if
(
yyout
==
NULL
)
{
fprintf
(
stderr
,
"%s: could not open file
\"
%s
\"
: %s
\n
"
,
progname
,
optarg
,
strerror
(
errno
));
progname
,
output_filename
,
strerror
(
errno
));
output_filename
=
NULL
;
}
else
out_option
=
1
;
break
;
...
...
@@ -269,8 +276,7 @@ main(int argc, char *const argv[])
/* after the options there must not be anything but filenames */
for
(
fnr
=
optind
;
fnr
<
argc
;
fnr
++
)
{
char
*
output_filename
=
NULL
,
*
ptr2ext
;
char
*
ptr2ext
;
/* If argv[fnr] is "-" we have to read from stdin */
if
(
strcmp
(
argv
[
fnr
],
"-"
)
==
0
)
...
...
@@ -467,7 +473,7 @@ main(int argc, char *const argv[])
fclose
(
yyout
);
}
if
(
output_filename
)
if
(
output_filename
&&
out_option
==
0
)
free
(
output_filename
);
free
(
input_filename
);
...
...
src/interfaces/ecpg/preproc/extern.h
浏览文件 @
91411b61
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.6
5 2007/03/17 19:25:23
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.6
6 2007/06/11 11:52:08
meskes Exp $ */
#ifndef _ECPG_PREPROC_EXTERN_H
#define _ECPG_PREPROC_EXTERN_H
...
...
@@ -37,6 +37,7 @@ extern int yylineno,
yyleng
;
extern
FILE
*
yyin
,
*
yyout
;
extern
char
*
output_filename
;
extern
struct
_include_path
*
include_paths
;
extern
struct
cursor
*
cur
;
...
...
@@ -93,7 +94,7 @@ extern ScanKeyword *ScanKeywordLookup(char *text);
extern
void
scanner_init
(
const
char
*
);
extern
void
parser_init
(
void
);
extern
void
scanner_finish
(
void
);
int
filtered_base_yylex
(
void
);
extern
int
filtered_base_yylex
(
void
);
/* return codes */
...
...
src/interfaces/ecpg/preproc/preproc.y
浏览文件 @
91411b61
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.34
3 2007/05/10 09:53:17
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.34
4 2007/06/11 11:52:08
meskes Exp $ */
/* Copyright comment */
%{
...
...
@@ -99,6 +99,10 @@ mmerror(int error_code, enum errortype type, char * error, ...)
ret_value = error_code;
break;
case ET_FATAL:
fclose(yyin);
fclose(yyout);
if (unlink(output_filename) != 0)
fprintf(stderr, "Could not remove ourput file %s!\n", output_filename);
exit(error_code);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录