Skip to content

Commit 42a36c7

Browse files
committed
IvorySQL:refactor CALL INTO codes
1 parent 3ee93bd commit 42a36c7

File tree

11 files changed

+26
-33
lines changed

11 files changed

+26
-33
lines changed

src/backend/nodes/params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ makeParamList(int numParams)
6262
retval->numParams = numParams;
6363
retval->outparamSetup = NULL;
6464

65-
/* set all the params mode to IN and typmod is -1 */
65+
/* Initialize all parameters to IN mode with typmod -1 */
6666
for (i = 0; i < numParams; i++)
6767
{
6868
retval->params[i].pmode = PROARGMODE_IN;

src/backend/parser/analyze.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,8 +3018,7 @@ transformPLAssignStmt(ParseState *pstate, PLAssignStmt *stmt)
30183018
if (pstate->do_from_call &&
30193019
(((type_id == ORACHARCHAROID || type_id == ORACHARBYTEOID) &&
30203020
(targettype == ORACHARCHAROID || targettype == ORACHARBYTEOID)) ||
3021-
((targettype == ORAVARCHARCHAROID || targettype == ORAVARCHARBYTEOID) &&
3022-
(targettype == ORAVARCHARCHAROID || targettype == ORAVARCHARBYTEOID))))
3021+
((targettype == ORAVARCHARCHAROID || targettype == ORAVARCHARBYTEOID))))
30233022
tle->expr = (Expr *)
30243023
coerce_to_target_type(pstate,
30253024
orig_expr, type_id,

src/backend/parser/parse_param.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,8 +2612,8 @@ get_bindByName(void)
26122612
}
26132613

26142614
/*
2615-
* * set dynamic CallStmt parser status
2616-
* */
2615+
* set dynamic CallStmt parser status
2616+
*/
26172617
void
26182618
setdynamic_callparser(bool value)
26192619
{

src/backend/tcop/postgres.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,7 @@ exec_bind_message(StringInfo input_message)
19271927
elog(ERROR, "number of parameters modes isn't same as of params");
19281928
}
19291929

1930+
/* Validate parameter length list length matches parameter count */
19301931
if (dostmt_plength != NIL && list_length(dostmt_plength) != numParams)
19311932
elog(ERROR, "the specified parameter length list does not match the number of parameters");
19321933

@@ -2155,10 +2156,7 @@ exec_bind_message(StringInfo input_message)
21552156
case ORACHARBYTEOID:
21562157
case ORAVARCHARCHAROID:
21572158
case ORAVARCHARBYTEOID:
2158-
/*
2159-
* Simple enough, hardcoded to avoid constructing an ArrayType
2160-
* representing typmod and calling the typmodin function.
2161-
*/
2159+
/* Hard-code typmod for Oracle char/varchar types to avoid ArrayType construction */
21622160
params->params[paramno].ptypmod = intVal(v) + VARHDRSZ;
21632161
break;
21642162
default:

src/backend/utils/adt/rowtypes.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,6 @@ get_parameter_description(PG_FUNCTION_ARGS)
21472147
if (nodeTag(linitial(parsetree)) == T_RawStmt &&
21482148
nodeTag(((RawStmt *)linitial(parsetree))->stmt) == T_DoStmt)
21492149
{
2150-
/* Begin - BUG:M0000077 */
21512150
DoStmt *stmt = (DoStmt *)(((RawStmt *)linitial(parsetree))->stmt);
21522151
ListCell *arg;
21532152
DefElem *as_item = NULL;

src/bin/psql/common.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,7 +3256,6 @@ IvyPrintQueryResults(PGresult *results, bool quiet, bool isoracall)
32563256
{
32573257
case PGRES_TUPLES_OK:
32583258

3259-
/* Begin - ReqID:SRS-CMD-PSQL */
32603259
cmdstatus = PQcmdStatus(results);
32613260

32623261
/*
@@ -3281,7 +3280,6 @@ IvyPrintQueryResults(PGresult *results, bool quiet, bool isoracall)
32813280
success = true;
32823281
break;
32833282
}
3284-
/* End - ReqID:SRS-CMD-PSQL */
32853283

32863284
/* store or execute or print the data ... */
32873285
if (pset.gset_prefix)
@@ -3310,7 +3308,6 @@ IvyPrintQueryResults(PGresult *results, bool quiet, bool isoracall)
33103308
PrintQueryStatus2(results, "\nCall completed.\n");
33113309
else
33123310
IvyPrintQueryStatus(results);
3313-
/* End - ReqID:SRS-CMD-PSQL */
33143311
success = true;
33153312
break;
33163313

src/include/catalog/dependency.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ typedef struct ObjectAddresses ObjectAddresses;
100100

101101
/*
102102
* Used to store the functions or packages found in pg_depend.
103-
* If arguments or return datatype of funtions(package subprocedures) reference %TYPE and %ROWTYPE,
103+
* If arguments or return datatype of functions(package subprocedures) reference %TYPE and %ROWTYPE,
104104
* record the dependencies between function(or package) and the relation.
105105
*/
106106
typedef struct

src/interfaces/libpq/ivy-exec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4005,7 +4005,7 @@ Ivyreplacenamebindtoposition(Ivyconn *tconn,
40054005

40064006
if (position == stmtHandle->nParams)
40074007
{
4008-
snprintf(errmsg, size_error_buf, "placehondvar \"%s\" not found",
4008+
snprintf(errmsg, size_error_buf, "placeholder variable \"%s\" not found",
40094009
tmp->name);
40104010
return 0;
40114011
}
@@ -4273,7 +4273,7 @@ Ivyreplacenamebindtoposition2(Ivyconn *tconn,
42734273

42744274
if (position == stmtHandle->nParams)
42754275
{
4276-
snprintf(errhp->error_msg, errhp->err_buf_size, "placehondvar \"%s\" not found",
4276+
snprintf(errhp->error_msg, errhp->err_buf_size, "placeholder variable \"%s\" not found",
42774277
tmp->name);
42784278
return 0;
42794279
}
@@ -4334,7 +4334,7 @@ Ivyreplacenamebindtoposition3(Ivyconn *tconn,
43344334
{
43354335
if (!host || host->length == 0)
43364336
{
4337-
snprintf(errhp->error_msg, errhp->err_buf_size, "%s", "No placehondvars specified");
4337+
snprintf(errhp->error_msg, errhp->err_buf_size, "%s", "No placeholder variables specified");
43384338
return 0;
43394339
}
43404340

@@ -4452,7 +4452,7 @@ Ivyreplacenamebindtoposition3(Ivyconn *tconn,
44524452
break;
44534453
if (position == stmtHandle->nParams)
44544454
{
4455-
snprintf(errhp->error_msg, errhp->err_buf_size, "placehondvar \"%s\" not found",
4455+
snprintf(errhp->error_msg, errhp->err_buf_size, "placeholder variable \"%s\" not found",
44564456
tmp->name);
44574457
return 0;
44584458
}

src/interfaces/libpq/ivytest/testlibpq_prepare_call.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ exec_prepare_func(Ivyconn *conn, int byname)
4242
IvyError *errhp = NULL;
4343
char x[256] = "beijing";
4444
char y[256] = "welcome to beijing";
45-
char z[256] = "welcome to HighGo Software";
45+
char z[256] = "welcome to IvorySQL";
4646
IvyBindInfo *bindinfo[3] = {NULL, NULL, NULL};
4747
int index[3] = {0,0,0};
4848

@@ -183,7 +183,7 @@ exec_prepare_proc(Ivyconn *conn, int byname)
183183
IvyPreparedStatement *stmthandle = NULL;
184184
IvyError *errhp = NULL;
185185
char x[256] = "welcome to ";
186-
char y[256] = "welcome to HighGo Software";
186+
char y[256] = "welcome to IvorySQL";
187187
IvyBindInfo *bindinfo[2] = {NULL, NULL};
188188
int index[2] = {0,0};
189189

src/oracle_test/regress/expected/ora_psql.out

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,13 +1043,13 @@ print x
10431043

10441044
begin
10451045
raise notice 'old value of :x is %', :x;
1046-
:x := '瀚高集团';
1046+
:x := 'IvorySQL社区';
10471047
raise notice 'new value of :x is %', :x;
10481048
end;
10491049
/
10501050
NOTICE: old value of :x is 数据库
10511051
ERROR: value too long for type char(3 char)
1052-
CONTEXT: PL/iSQL assignment ":x := '瀚高集团'"
1052+
CONTEXT: PL/iSQL assignment ":x := 'IvorySQL社区'"
10531053
PL/iSQL function inline_code_block line 3 at assignment
10541054
print x
10551055
X
@@ -1059,20 +1059,20 @@ print x
10591059
-- catch exception
10601060
begin
10611061
raise notice 'old value of :x is %', :x;
1062-
:x := '瀚高集团';
1062+
:x := 'IvorySQL社区';
10631063
EXCEPTION WHEN OTHERS THEN
10641064
raise notice 'Get an exception and reassign an acceptable value to the bind variable';
1065-
:x := '瀚高';
1065+
:x := 'abc';
10661066
raise notice 'new value of :x is %', :x;
10671067
end;
10681068
/
10691069
NOTICE: old value of :x is 数据库
10701070
NOTICE: Get an exception and reassign an acceptable value to the bind variable
1071-
NOTICE: new value of :x is 瀚高
1071+
NOTICE: new value of :x is abc
10721072
print x
1073-
X
1074-
-------
1075-
瀚高
1073+
X
1074+
-----
1075+
abc
10761076

10771077
-- Referencing bind variables within non-anonymous block queries
10781078
var x number = 4
@@ -1188,7 +1188,7 @@ return 999;
11881188
END;
11891189
/
11901190
-- error out within Oracle: ORA-06572: Function F_TEST has out arguments.
1191-
-- error out within IvorySQL: ERROR: OUT or IN OUT arguments of the funtion f_test must be variables.
1191+
-- error out within IvorySQL: ERROR: OUT or IN OUT arguments of the function f_test must be variables.
11921192
select f_test(:x, :y, :z) from dual;
11931193
ERROR: OUT or IN OUT arguments of the function f_test must be variables
11941194
-- error out within Oracle: ORA-06572: Function F_TEST has out arguments.

0 commit comments

Comments
 (0)