-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IvorySQL PL/SQL 创建函数/存储过程存在问题 #477 #492
Conversation
WalkthroughThe changes introduce a new enumeration and field to handle the end symbol state in PL/SQL code. This improves the lexer's handling of function/procedure endings, with updates to slash and semicolon processing. Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Files selected for processing (2)
- src/include/fe_utils/psqlscan_int.h (2 hunks)
- src/oracle_fe_utils/ora_psqlscan.l (6 hunks)
Additional comments (Suppressed): 6
src/include/fe_utils/psqlscan_int.h (1)
- 79-84: The new enumeration
PLSQL_endSymbolState
is introduced to manage different states of the end symbol in PL/SQL code. This seems to be a good approach for handling the end symbols (/
or;
) correctly during the creation process of functions/procedures in IvorySQL's PL/SQL compatibility mode.src/oracle_fe_utils/ora_psqlscan.l (5)
769-776: The new condition added to check for the end of the creation process seems to be correct. It checks if the expected end symbol is a slash and if both
paren_depth
andbegin_depth
are zero, or ifis_oracle_slash()
returns true. This should correctly identify the end of the creation process in most cases. However, it's important to verify that all possible edge cases have been considered and tested.794-800: The handling of semicolons has been updated to change the expected end symbol to a slash when the current expected end symbol is a semicolon. This seems to be a logical change given the context, but it would be good to verify that this doesn't introduce any unexpected behavior in other parts of the code that rely on the value of
ora_plsql_expect_end_symbol
.1086-1088: The state of
ora_plsql_expect_end_symbol
is reset toEND_SYMBOL_INVALID
when it's not null. This seems to be a cleanup operation to ensure that the state is reset after each use. However, it's important to verify that this doesn't interfere with any ongoing operations that might still be expecting an end symbol.1127-1130: The expected end symbol is set to
END_SYMBOL_SEMICOLON
whenbegin_depth
is greater than zero. This seems to be a logical change given the context, but it would be good to verify that this doesn't introduce any unexpected behavior in other parts of the code that rely on the value ofora_plsql_expect_end_symbol
.1453-1456: The initialization of
ora_plsql_expect_end_symbol
toEND_SYMBOL_INVALID
inpsql_scan_reset()
is a good practice as it ensures that the state is reset before each scan. This should prevent any lingering state from affecting subsequent scans.
/* Used to handle funtion/procedure that does not end properly */ | ||
PLSQL_endSymbolState ora_plsql_expect_end_symbol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new field ora_plsql_expect_end_symbol
is added to the PsqlScanStateData
struct, which stores the expected end symbol state. This change appears to be aimed at properly managing function/procedure endings. However, it would be beneficial to add a comment explaining what each state means and when it should be used.
- /* Used to handle funtion/procedure that does not end properly */
+ /* Used to handle function/procedure that does not end properly.
+ * END_SYMBOL_INVALID: The end symbol state is invalid (default state).
+ * END_SYMBOL_SEMICOLON: A semicolon is expected as the end symbol.
+ * END_SYMBOL_SLASH: A slash is expected as the end symbol.
+ */
a. 修复按上键不能正常创建function/procedure的异常情况
make clean make && make install psql -d postgres
Summary by CodeRabbit
PLSQL_endSymbolState
and fieldora_plsql_expect_end_symbol
to track the expected end symbol (slash or semicolon), enhancing the code's readability and maintainability.