Package constants#8916
Conversation
…rong impure cache usage
|
Are comments supported for constants? I didn't see this in the documentation. Comments are simply supported for packaged procedures and functions. It would make sense to do the same for constants (and any package objects, for that matter). |
No, I didn't plan to implement comments, but I think it's possible. I will take a look |
Raise EDS rollback exception before the connection can be released by deleteTransaction(). Cleanup is still performed by catching the error and rethrow the original exception.
…multi-level LEFT JOINs. I tried it in 2022 but found regressions. Now I cannot reproduce them locally after the fix, so I'm willing to analyze the complete QA results.
…stream must be re-evaluated after the join
…onnect (FirebirdSQL#8992) * fix(udr): Add cleanup of UDR objects from `Engine` on attachment disconnect * Revert "fix(udr): Add cleanup of UDR objects from `Engine` on attachment disconnect" This reverts commit 80581c5. * fix(udr): Add cleanup of UDR objects from Engine on attachment disconnect --------- Co-authored-by: Artyom Ivanov <artyom.ivanov@red-soft.ru>
|
@Noremos Please resolve the conflict. |
Done |
| GRANT SELECT ON TABLE secret TO PACKAGE pk_secret; | ||
| GRANT EXECUTE ON PACKAGE pk_secret TO ROLE role_secret; | ||
|
|
||
| To use package constants in a select expression, a USAGE permission is required: |
There was a problem hiding this comment.
I suppose not only in a "select expression", but in any place outside the package it was defined.
|
|
||
| void write_constants() | ||
| { | ||
| Firebird::IRequest* req_handle1 = nullptr; |
There was a problem hiding this comment.
This file already has using namespace Firebird. Do not qualify things with extra Firebird::.
| CONST.RDB$PACKAGE_NAME EQ PKG.RDB$PACKAGE_NAME AND | ||
| PKG.RDB$SYSTEM_FLAG NE 1 | ||
| { | ||
| QualifiedMetaString name(CONST.RDB$CONSTANT_NAME); |
There was a problem hiding this comment.
Why not put the schema and package name here directly?
| BURP_verbose(USHORT(isc_gbak_writing_constant), SafeArg() << name.toQuotedString().data()); | ||
| put(tdgbl, att_end); | ||
| } | ||
| END_FOR; |
There was a problem hiding this comment.
| END_FOR; | |
| END_FOR |
| END_FOR; | ||
| ON_ERROR | ||
| general_on_error(); | ||
| END_ERROR; |
There was a problem hiding this comment.
| END_ERROR; | |
| END_ERROR |
| attachment->att_database->deletePool(csb_pool); | ||
| }); | ||
|
|
||
| csb_pool = attachment->att_database->createPool(ALLOC_ARGS0); |
| */ | ||
|
|
||
|
|
||
| #ifndef JRD_CONSTANT_H |
| {"EXP", 1, 1, DEFAULT, setParamsDblDec, makeDblDecResult, evlExp, NULL}, | ||
| {"FIRST_DAY", 2, 2, DEFAULT, setParamsFirstLastDay, makeFirstLastDayResult, evlFirstLastDay, (void*) funFirstDay}, | ||
| {"FLOOR", 1, 1, DEFAULT, setParamsDblDec, makeCeilFloor, evlFloor, NULL}, | ||
| {"GEN_UUID", 0, 0, CONSTANT, NULL, makeUuid, evlGenUuid, NULL}, |
| const std::initializer_list<UCHAR> aValueBlr = {} | ||
| ) | ||
| : name(aName), | ||
| fieldId(aFieldId), |
|
|
||
| EVL_field(0, rpb->rpb_record, f_const_package, &desc2); | ||
| MOV_get_metaname(tdbb, &desc2, object_name.package); | ||
|
|
|
@asfernandes, thanks for the review. I'll resolve the issues tomorrow |
Package Constants
This PR adds a new database object - Package Constant (#1036). It is a constant value located in a package header (public visibility) or a package body (private visibility). See README.packages.txt for more information.
SYNTAX
Creation:
<constant_expr>is an expression that remains unchanged after recompilation.Package constants can be queried using the expression
<package_name>.<consatnt_name>outside the package (<consatnt_name> must be a public constant) and using the expression<consatnt_name>inside the package.To query a constant, the user/role must have USAGE permission on the package.
Other SQL extensions:
Usage examples:
System Constants
As an exmaple, 3 consatnts have been added to the RDB$BLOB_UTIL package
System metadata changes
New system table - RDB$CONSTANTS
A new field has been added to
RDB$PACKAGES-RDB$PACKAGE_IDNew indexes:
Implementation
Packages have been added to the metacaching system. Since it relies heavily on identifiers, a new ID field (
RDB$PACKAGE_ID) has been added to theRDB$PACKAGEStable. Constants are stored as an array in the package metacaching object, with a constant_name-to-array_id mapping.There are also two important points: