Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
29e29168
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,发现更多精彩内容 >>
提交
29e29168
编写于
4月 14, 1999
作者:
M
Michael Meskes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
*** empty log message ***
上级
9a4344e7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
101 addition
and
40 deletion
+101
-40
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpglib.h
+0
-2
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/lib/ecpglib.c
+8
-8
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/ecpg.c
+2
-2
src/interfaces/ecpg/preproc/ecpg_keywords.c
src/interfaces/ecpg/preproc/ecpg_keywords.c
+2
-0
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/extern.h
+1
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+79
-25
src/interfaces/ecpg/test/test1.pgc
src/interfaces/ecpg/test/test1.pgc
+5
-2
未找到文件。
src/interfaces/ecpg/ChangeLog
浏览文件 @
29e29168
...
@@ -555,6 +555,10 @@ Mon Apr 12 17:56:14 CEST 1999
...
@@ -555,6 +555,10 @@ Mon Apr 12 17:56:14 CEST 1999
- Fixed ECPG variable handling.
- Fixed ECPG variable handling.
- Make no_auto_trans be accessible via SET command.
- Make no_auto_trans be accessible via SET command.
- Do not eat comments so line numbering should be correct.
- Do not eat comments so line numbering should be correct.
Wed Apr 14 17:59:06 CEST 1999
- Added simple calculations for array bounds.
- Set library version to 3.0.0
- Set library version to 3.0.0
- Set ecpg version to 2.6.0
- Set ecpg version to 2.6.0
src/interfaces/ecpg/include/ecpglib.h
浏览文件 @
29e29168
...
@@ -45,8 +45,6 @@ extern "C"
...
@@ -45,8 +45,6 @@ extern "C"
struct
cursor
*
next
;
struct
cursor
*
next
;
};
};
extern
int
no_auto_trans
;
/* define this for simplicity as well as compatibility */
/* define this for simplicity as well as compatibility */
#define SQLCODE sqlca.sqlcode
#define SQLCODE sqlca.sqlcode
...
...
src/interfaces/ecpg/lib/ecpglib.c
浏览文件 @
29e29168
...
@@ -55,7 +55,7 @@ static struct connection
...
@@ -55,7 +55,7 @@ static struct connection
char
*
name
;
char
*
name
;
PGconn
*
connection
;
PGconn
*
connection
;
bool
committed
;
bool
committed
;
int
no_auto_trans
;
int
autocommit
;
struct
connection
*
next
;
struct
connection
*
next
;
}
*
all_connections
=
NULL
,
*
actual_connection
=
NULL
;
}
*
all_connections
=
NULL
,
*
actual_connection
=
NULL
;
...
@@ -660,7 +660,7 @@ ECPGexecute(struct statement * stmt)
...
@@ -660,7 +660,7 @@ ECPGexecute(struct statement * stmt)
/* Now the request is built. */
/* Now the request is built. */
if
(
stmt
->
connection
->
committed
&&
!
stmt
->
connection
->
no_auto_trans
)
if
(
stmt
->
connection
->
committed
&&
!
stmt
->
connection
->
autocommit
)
{
{
if
((
results
=
PQexec
(
stmt
->
connection
->
connection
,
"begin transaction"
))
==
NULL
)
if
((
results
=
PQexec
(
stmt
->
connection
->
connection
,
"begin transaction"
))
==
NULL
)
{
{
...
@@ -1164,7 +1164,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
...
@@ -1164,7 +1164,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
if
(
con
)
if
(
con
)
{
{
if
(
con
->
no_auto_trans
==
true
&&
strncmp
(
mode
,
"ON"
,
strlen
(
"ON
"
))
==
0
)
if
(
con
->
autocommit
==
true
&&
strncmp
(
mode
,
"OFF"
,
strlen
(
"OFF
"
))
==
0
)
{
{
if
(
con
->
committed
)
if
(
con
->
committed
)
{
{
...
@@ -1176,9 +1176,9 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
...
@@ -1176,9 +1176,9 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
PQclear
(
results
);
PQclear
(
results
);
con
->
committed
=
false
;
con
->
committed
=
false
;
}
}
con
->
no_auto_trans
=
false
;
con
->
autocommit
=
false
;
}
}
else
if
(
con
->
no_auto_trans
==
false
&&
strncmp
(
mode
,
"OFF"
,
strlen
(
"OFF
"
))
==
0
)
else
if
(
con
->
autocommit
==
false
&&
strncmp
(
mode
,
"ON"
,
strlen
(
"ON
"
))
==
0
)
{
{
if
(
!
con
->
committed
)
if
(
!
con
->
committed
)
{
{
...
@@ -1190,7 +1190,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
...
@@ -1190,7 +1190,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
PQclear
(
results
);
PQclear
(
results
);
con
->
committed
=
true
;
con
->
committed
=
true
;
}
}
con
->
no_auto_trans
=
true
;
con
->
autocommit
=
true
;
}
}
}
}
else
else
...
@@ -1220,7 +1220,7 @@ ECPGsetconn(int lineno, const char *connection_name)
...
@@ -1220,7 +1220,7 @@ ECPGsetconn(int lineno, const char *connection_name)
}
}
bool
bool
ECPGconnect
(
int
lineno
,
const
char
*
dbname
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
connection_name
,
int
no_auto_trans
)
ECPGconnect
(
int
lineno
,
const
char
*
dbname
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
connection_name
,
int
autocommit
)
{
{
struct
connection
*
this
=
(
struct
connection
*
)
ecpg_alloc
(
sizeof
(
struct
connection
),
lineno
);
struct
connection
*
this
=
(
struct
connection
*
)
ecpg_alloc
(
sizeof
(
struct
connection
),
lineno
);
...
@@ -1258,7 +1258,7 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
...
@@ -1258,7 +1258,7 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
}
}
this
->
committed
=
true
;
this
->
committed
=
true
;
this
->
no_auto_trans
=
no_auto_trans
;
this
->
autocommit
=
autocommit
;
return
true
;
return
true
;
}
}
...
...
src/interfaces/ecpg/preproc/ecpg.c
浏览文件 @
29e29168
...
@@ -23,7 +23,7 @@ extern char *optarg;
...
@@ -23,7 +23,7 @@ extern char *optarg;
#include "extern.h"
#include "extern.h"
struct
_include_path
*
include_paths
;
struct
_include_path
*
include_paths
;
int
no_auto_trans
=
0
;
int
autocommit
=
0
;
struct
cursor
*
cur
=
NULL
;
struct
cursor
*
cur
=
NULL
;
struct
typedefs
*
types
=
NULL
;
struct
typedefs
*
types
=
NULL
;
...
@@ -76,7 +76,7 @@ main(int argc, char *const argv[])
...
@@ -76,7 +76,7 @@ main(int argc, char *const argv[])
add_include_path
(
optarg
);
add_include_path
(
optarg
);
break
;
break
;
case
't'
:
case
't'
:
no_auto_trans
=
1
;
autocommit
=
1
;
break
;
break
;
case
'v'
:
case
'v'
:
fprintf
(
stderr
,
"ecpg - the postgresql preprocessor, version: %d.%d.%d
\n
"
,
MAJOR_VERSION
,
MINOR_VERSION
,
PATCHLEVEL
);
fprintf
(
stderr
,
"ecpg - the postgresql preprocessor, version: %d.%d.%d
\n
"
,
MAJOR_VERSION
,
MINOR_VERSION
,
PATCHLEVEL
);
...
...
src/interfaces/ecpg/preproc/ecpg_keywords.c
浏览文件 @
29e29168
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
static
ScanKeyword
ScanKeywords
[]
=
{
static
ScanKeyword
ScanKeywords
[]
=
{
/* name value */
/* name value */
{
"at"
,
SQL_AT
},
{
"at"
,
SQL_AT
},
{
"autocommit"
,
SQL_AUTOCOMMIT
},
{
"bool"
,
SQL_BOOL
},
{
"bool"
,
SQL_BOOL
},
{
"break"
,
SQL_BREAK
},
{
"break"
,
SQL_BREAK
},
{
"call"
,
SQL_CALL
},
{
"call"
,
SQL_CALL
},
...
@@ -39,6 +40,7 @@ static ScanKeyword ScanKeywords[] = {
...
@@ -39,6 +40,7 @@ static ScanKeyword ScanKeywords[] = {
{
"indicator"
,
SQL_INDICATOR
},
{
"indicator"
,
SQL_INDICATOR
},
{
"int"
,
SQL_INT
},
{
"int"
,
SQL_INT
},
{
"long"
,
SQL_LONG
},
{
"long"
,
SQL_LONG
},
{
"off"
,
SQL_OFF
},
{
"open"
,
SQL_OPEN
},
{
"open"
,
SQL_OPEN
},
{
"prepare"
,
SQL_PREPARE
},
{
"prepare"
,
SQL_PREPARE
},
{
"reference"
,
SQL_REFERENCE
},
{
"reference"
,
SQL_REFERENCE
},
...
...
src/interfaces/ecpg/preproc/extern.h
浏览文件 @
29e29168
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
/* variables */
/* variables */
extern
int
braces_open
,
extern
int
braces_open
,
no_auto_trans
,
struct_level
;
autocommit
,
struct_level
;
extern
char
*
yytext
,
errortext
[
128
];
extern
char
*
yytext
,
errortext
[
128
];
extern
int
yylineno
,
extern
int
yylineno
,
yyleng
;
yyleng
;
...
...
src/interfaces/ecpg/preproc/preproc.y
浏览文件 @
29e29168
...
@@ -654,12 +654,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -654,12 +654,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
}
}
/* special embedded SQL token */
/* special embedded SQL token */
%token SQL_AT SQL_BOOL SQL_BREAK
%token SQL_AT SQL_
AUTOCOMMIT SQL_
BOOL SQL_BREAK
%token SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
%token SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
%token SQL_DEALLOCATE SQL_DISCONNECT SQL_ENUM
%token SQL_DEALLOCATE SQL_DISCONNECT SQL_ENUM
%token SQL_FOUND SQL_FREE SQL_GO SQL_GOTO
%token SQL_FOUND SQL_FREE SQL_GO SQL_GOTO
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
%token SQL_OPEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
%token SQL_O
FF SQL_O
PEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
%token SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR SQL_SQLPRINT
%token SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR SQL_SQLPRINT
%token SQL_SQLWARNING SQL_START SQL_STOP SQL_STRUCT SQL_UNSIGNED
%token SQL_SQLWARNING SQL_START SQL_STOP SQL_STRUCT SQL_UNSIGNED
%token SQL_VAR SQL_WHENEVER
%token SQL_VAR SQL_WHENEVER
...
@@ -831,7 +831,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -831,7 +831,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
%type <str> sql_declaration sql_variable_list sql_variable opt_at
%type <str> sql_declaration sql_variable_list sql_variable opt_at
%type <str> struct_type s_struct declaration variable_declarations
%type <str> struct_type s_struct declaration variable_declarations
%type <str> s_struct s_union union_type
%type <str> s_struct s_union union_type
ECPGSetAutocommit on_off
%type <type_enum> simple_type varchar_type
%type <type_enum> simple_type varchar_type
...
@@ -842,6 +842,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -842,6 +842,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <index> opt_array_bounds nest_array_bounds opt_type_array_bounds
%type <index> opt_array_bounds nest_array_bounds opt_type_array_bounds
%type <index> nest_type_array_bounds
%type <index> nest_type_array_bounds
%type <ival> Iresult
%%
%%
prog: statements;
prog: statements;
...
@@ -913,7 +914,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
...
@@ -913,7 +914,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
if (connection)
if (connection)
yyerror("no at option for connect statement.\n");
yyerror("no at option for connect statement.\n");
fprintf(yyout, "ECPGconnect(__LINE__, %s, %d);", $1,
no_auto_trans
);
fprintf(yyout, "ECPGconnect(__LINE__, %s, %d);", $1,
autocommit
);
whenever_action(0);
whenever_action(0);
free($1);
free($1);
}
}
...
@@ -981,6 +982,11 @@ stmt: AddAttrStmt { output_statement($1, 0); }
...
@@ -981,6 +982,11 @@ stmt: AddAttrStmt { output_statement($1, 0); }
free($1);
free($1);
}
}
| ECPGRelease { /* output already done */ }
| ECPGRelease { /* output already done */ }
| ECPGSetAutocommit {
fprintf(yyout, "ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
whenever_action(0);
free($1);
}
| ECPGSetConnection {
| ECPGSetConnection {
if (connection)
if (connection)
yyerror("no at option for set connection statement.\n");
yyerror("no at option for set connection statement.\n");
...
@@ -3170,11 +3176,14 @@ opt_array_bounds: '[' ']' nest_array_bounds
...
@@ -3170,11 +3176,14 @@ opt_array_bounds: '[' ']' nest_array_bounds
$$.index2 = $3.index1;
$$.index2 = $3.index1;
$$.str = cat2_str(make1_str("[]"), $3.str);
$$.str = cat2_str(make1_str("[]"), $3.str);
}
}
| '[' I
cons
t ']' nest_array_bounds
| '[' I
resul
t ']' nest_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| /* EMPTY */
| /* EMPTY */
{
{
...
@@ -3190,11 +3199,14 @@ nest_array_bounds: '[' ']' nest_array_bounds
...
@@ -3190,11 +3199,14 @@ nest_array_bounds: '[' ']' nest_array_bounds
$$.index2 = $3.index1;
$$.index2 = $3.index1;
$$.str = cat2_str(make1_str("[]"), $3.str);
$$.str = cat2_str(make1_str("[]"), $3.str);
}
}
| '[' I
cons
t ']' nest_array_bounds
| '[' I
resul
t ']' nest_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| /* EMPTY */
| /* EMPTY */
{
{
...
@@ -3204,6 +3216,16 @@ nest_array_bounds: '[' ']' nest_array_bounds
...
@@ -3204,6 +3216,16 @@ nest_array_bounds: '[' ']' nest_array_bounds
}
}
;
;
Iresult: Iconst { $$ = atol($1); }
| '(' Iresult ')' { $$ = $2; }
| Iresult '+' Iresult { $$ = $1 + $3};
| Iresult '-' Iresult { $$ = $1 - $3};
| Iresult '*' Iresult { $$ = $1 * $3};
| Iresult '/' Iresult { $$ = $1 / $3};
| Iresult '%' Iresult { $$ = $1 % $3};
/*****************************************************************************
/*****************************************************************************
*
*
* Type syntax
* Type syntax
...
@@ -3239,6 +3261,7 @@ Generic: generic
...
@@ -3239,6 +3261,7 @@ Generic: generic
generic: ident { $$ = $1; }
generic: ident { $$ = $1; }
| TYPE_P { $$ = make1_str("type"); }
| TYPE_P { $$ = make1_str("type"); }
| SQL_AT { $$ = make1_str("at"); }
| SQL_AT { $$ = make1_str("at"); }
| SQL_AUTOCOMMIT { $$ = make1_str("autocommit"); }
| SQL_BOOL { $$ = make1_str("bool"); }
| SQL_BOOL { $$ = make1_str("bool"); }
| SQL_BREAK { $$ = make1_str("break"); }
| SQL_BREAK { $$ = make1_str("break"); }
| SQL_CALL { $$ = make1_str("call"); }
| SQL_CALL { $$ = make1_str("call"); }
...
@@ -3255,6 +3278,7 @@ generic: ident { $$ = $1; }
...
@@ -3255,6 +3278,7 @@ generic: ident { $$ = $1; }
| SQL_INDICATOR { $$ = make1_str("indicator"); }
| SQL_INDICATOR { $$ = make1_str("indicator"); }
| SQL_INT { $$ = make1_str("int"); }
| SQL_INT { $$ = make1_str("int"); }
| SQL_LONG { $$ = make1_str("long"); }
| SQL_LONG { $$ = make1_str("long"); }
| SQL_OFF { $$ = make1_str("off"); }
| SQL_OPEN { $$ = make1_str("open"); }
| SQL_OPEN { $$ = make1_str("open"); }
| SQL_PREPARE { $$ = make1_str("prepare"); }
| SQL_PREPARE { $$ = make1_str("prepare"); }
| SQL_RELEASE { $$ = make1_str("release"); }
| SQL_RELEASE { $$ = make1_str("release"); }
...
@@ -4475,7 +4499,6 @@ ColId: ident { $$ = $1; }
...
@@ -4475,7 +4499,6 @@ ColId: ident { $$ = $1; }
| SQL_BREAK { $$ = make1_str("break"); }
| SQL_BREAK { $$ = make1_str("break"); }
| SQL_CALL { $$ = make1_str("call"); }
| SQL_CALL { $$ = make1_str("call"); }
| SQL_CONNECT { $$ = make1_str("connect"); }
| SQL_CONNECT { $$ = make1_str("connect"); }
| SQL_CONNECTION { $$ = make1_str("connection"); }
| SQL_CONTINUE { $$ = make1_str("continue"); }
| SQL_CONTINUE { $$ = make1_str("continue"); }
| SQL_DEALLOCATE { $$ = make1_str("deallocate"); }
| SQL_DEALLOCATE { $$ = make1_str("deallocate"); }
| SQL_DISCONNECT { $$ = make1_str("disconnect"); }
| SQL_DISCONNECT { $$ = make1_str("disconnect"); }
...
@@ -4487,6 +4510,7 @@ ColId: ident { $$ = $1; }
...
@@ -4487,6 +4510,7 @@ ColId: ident { $$ = $1; }
| SQL_INDICATOR { $$ = make1_str("indicator"); }
| SQL_INDICATOR { $$ = make1_str("indicator"); }
| SQL_INT { $$ = make1_str("int"); }
| SQL_INT { $$ = make1_str("int"); }
| SQL_LONG { $$ = make1_str("long"); }
| SQL_LONG { $$ = make1_str("long"); }
| SQL_OFF { $$ = make1_str("off"); }
| SQL_OPEN { $$ = make1_str("open"); }
| SQL_OPEN { $$ = make1_str("open"); }
| SQL_PREPARE { $$ = make1_str("prepare"); }
| SQL_PREPARE { $$ = make1_str("prepare"); }
| SQL_RELEASE { $$ = make1_str("release"); }
| SQL_RELEASE { $$ = make1_str("release"); }
...
@@ -5138,13 +5162,27 @@ ECPGRelease: TransactionStmt SQL_RELEASE
...
@@ -5138,13 +5162,27 @@ ECPGRelease: TransactionStmt SQL_RELEASE
free($1);
free($1);
}
}
/*
* set/reset the automatic transaction mode, this needs a differnet handling
* as the other set commands
*/
ECPGSetAutocommit: SET SQL_AUTOCOMMIT to_equal on_off
{
$$ = $4;
}
on_off: ON { $$ = make1_str("on"); }
| SQL_OFF { $$ = make1_str("off"); }
to_equal: TO | "=";
/*
/*
* set the actual connection, this needs a differnet handling as the other
* set the actual connection, this needs a differnet handling as the other
* set commands
* set commands
*/
*/
ECPGSetConnection: SET SQL_CONNECTION connection_object
ECPGSetConnection: SET SQL_CONNECTION
to_equal
connection_object
{
{
$$ = $
3
;
$$ = $
4
;
}
}
/*
/*
...
@@ -5204,17 +5242,23 @@ opt_type_array_bounds: '[' ']' nest_type_array_bounds
...
@@ -5204,17 +5242,23 @@ opt_type_array_bounds: '[' ']' nest_type_array_bounds
$$.index2 = $3.index1;
$$.index2 = $3.index1;
$$.str = cat2_str(make1_str("[]"), $3.str);
$$.str = cat2_str(make1_str("[]"), $3.str);
}
}
| '[' I
cons
t ']' nest_type_array_bounds
| '[' I
resul
t ']' nest_type_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| '(' I
cons
t ')' nest_type_array_bounds
| '(' I
resul
t ')' nest_type_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| /* EMPTY */
| /* EMPTY */
{
{
...
@@ -5236,17 +5280,23 @@ nest_type_array_bounds: '[' ']' nest_type_array_bounds
...
@@ -5236,17 +5280,23 @@ nest_type_array_bounds: '[' ']' nest_type_array_bounds
$$.index2 = $3.index1;
$$.index2 = $3.index1;
$$.str = cat2_str(make1_str("[]"), $3.str);
$$.str = cat2_str(make1_str("[]"), $3.str);
}
}
| '[' I
cons
t ']' nest_type_array_bounds
| '[' I
resul
t ']' nest_type_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| '(' I
cons
t ')' nest_type_array_bounds
| '(' I
resul
t ')' nest_type_array_bounds
{
{
$$.index1 = atol($2);
char *txt = mm_alloc(20L);
sprintf (txt, "%d", $2);
$$.index1 = $2;
$$.index2 = $4.index1;
$$.index2 = $4.index1;
$$.str = cat4_str(make1_str("["),
$2
, make1_str("]"), $4.str);
$$.str = cat4_str(make1_str("["),
txt
, make1_str("]"), $4.str);
}
}
| /* EMPTY */
| /* EMPTY */
{
{
...
@@ -5954,6 +6004,10 @@ c_anything: IDENT { $$ = $1; }
...
@@ -5954,6 +6004,10 @@ c_anything: IDENT { $$ = $1; }
| Iconst { $$ = $1; }
| Iconst { $$ = $1; }
| Fconst { $$ = $1; }
| Fconst { $$ = $1; }
| '*' { $$ = make1_str("*"); }
| '*' { $$ = make1_str("*"); }
| '+' { $$ = make1_str("+"); }
| '-' { $$ = make1_str("-"); }
| '/' { $$ = make1_str("/"); }
| '%' { $$ = make1_str("%"); }
| S_AUTO { $$ = make1_str("auto"); }
| S_AUTO { $$ = make1_str("auto"); }
| S_BOOL { $$ = make1_str("bool"); }
| S_BOOL { $$ = make1_str("bool"); }
| S_CHAR { $$ = make1_str("char"); }
| S_CHAR { $$ = make1_str("char"); }
...
...
src/interfaces/ecpg/test/test1.pgc
浏览文件 @
29e29168
...
@@ -2,6 +2,7 @@ exec sql whenever sqlerror sqlprint;
...
@@ -2,6 +2,7 @@ exec sql whenever sqlerror sqlprint;
exec sql include sqlca;
exec sql include sqlca;
/* comment */
exec sql define AMOUNT 4;
exec sql define AMOUNT 4;
exec sql type intarray is int[AMOUNT];
exec sql type intarray is int[AMOUNT];
...
@@ -42,7 +43,7 @@ exec sql end declare section;
...
@@ -42,7 +43,7 @@ exec sql end declare section;
exec sql commit;
exec sql commit;
strcpy(msg, "set connection");
strcpy(msg, "set connection");
exec sql set connection main;
exec sql set connection
to
main;
strcpy(msg, "execute insert 1");
strcpy(msg, "execute insert 1");
sprintf(command, "insert into test(name, amount, letter) values ('db: mm', 1, 'f')");
sprintf(command, "insert into test(name, amount, letter) values ('db: mm', 1, 'f')");
...
@@ -69,7 +70,9 @@ exec sql end declare section;
...
@@ -69,7 +70,9 @@ exec sql end declare section;
strcpy(msg, "commit");
strcpy(msg, "commit");
exec sql commit;
exec sql commit;
exec sql at pm commit;
/* Stop automatic transactioning for connection pm. */
exec sql at pm set autocommit to off;
strcpy(msg, "select");
strcpy(msg, "select");
exec sql select name, amount, letter into :name, :amount, :letter from test;
exec sql select name, amount, letter into :name, :amount, :letter from test;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录