Fix found flaws of package constants #9022
Conversation
| PRIV.RDB$PRIVILEGE[1] = 0; | ||
| PRIV.RDB$PRIVILEGE[0] = privileges[0]; | ||
| PRIV.RDB$PRIVILEGE[1] = privileges[1]; | ||
| PRIV.RDB$PRIVILEGE[2] = 0; |
There was a problem hiding this comment.
I followed the original style. Is loop worth it?
There was a problem hiding this comment.
Or do you mean storing each privilege in a separate record?
There was a problem hiding this comment.
No, I mean that the check and the way one string is assigned to another is strange, but if it was an original code... Probably, it still must be replaced with strncpy.
There was a problem hiding this comment.
Hm, as I can see, storing each privilege in a separate record is indead a correct way to do it
There was a problem hiding this comment.
In this case CHAR(6) field makes no sense.
|
I found an issue related to metadata. When selecting a constant from a procedure, an error may occur: Code to reproduce: set term ^;
CREATE PACKAGE TEST1
AS
BEGIN
PROCEDURE P1(I INT) RETURNS (PROCEDURE_OUTPUT INT); -- public procedure
CONSTANT TEST1_PACKAGE_CONSTANT INTEGER = 10;
END^
CREATE PACKAGE BODY TEST1
AS
BEGIN
CONSTANT CP2 INTEGER = 15;
CONSTANT CP3 INTEGER = 30;
PROCEDURE P1(I INT) RETURNS (PROCEDURE_OUTPUT INT)
AS
BEGIN
PROCEDURE_OUTPUT = TEST1.TEST1_PACKAGE_CONSTANT + TEST1.CP2;
SUSPEND;
END
END ^
set term ;^
commit;
-- Test Public
select test1.TEST1_PACKAGE_CONSTANT from rdb$database ;
select * from test1.p1(0);
commit; |
| CONST.RDB$PRIVATE_FLAG = m_isPrivate; | ||
|
|
||
| CONST.RDB$CONSTANT_SOURCE.NULL = TRUE; | ||
| attachment->storeBinaryBlob(tdbb, transaction, &CONST.RDB$CONSTANT_SOURCE, source); |
There was a problem hiding this comment.
Thanks for the advice. Changed as suggested
Fix incorrect search in SCHEMAs list
Fix missing RDB$CONSTANT_SOURCE setup
Add USAGE privilage to SYSTEM packages