Skip to content
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

[CBRD-24929] Add identifier comparator class and refactor comparision of catalog names #4563

Merged
merged 20 commits into from
Aug 16, 2023

Conversation

hgryoo
Copy link
Member

@hgryoo hgryoo commented Aug 8, 2023

http://jira.cubrid.org/browse/CBRD-24929

  • Add a class to provide a unified routine to compare identifiers
    • string_utility.hpp: For C++ STL's string comparison, lowercase_hash and lowercase_compare structs are added, string_set_ci_lower is defined
    • identifier_store.hpp: the constructor gets a set of identifier lists and provides is_exists () API.
  • Refactor comparison routine related to system catalog names
    • schema_system_catalog.[cpp|hpp]: Use the new API of identifier_store for system catalogs
    • remove legacy duplicated routine (util_common.c, utility.h, load_server_loader.cpp...)

@hgryoo hgryoo self-assigned this Aug 8, 2023

bool sm_check_system_class_by_name (const std::string &name)
{
return cubschema::sm_catalog_names.is_exists (name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The system class name can't be contained dot(.).
So, before execute sm_catalog_names.is_exists(), how about checking if there is "." and returning false if there is ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review. In CUBRID's identifier writing rule, "." is not allowed in both cases whether a name is enclosed (by quotes) or not.

  • I've added a new static function, check_identifier_is_valid, which checks name is a valid identifier according to the name enclosed. (40c3c1e)
  • In check_identifier_condition() in identifier_store, changed to use check_identifier_is_valid() above.
  • I don't think the function check_identifier_is_valid() is in right place. We need to implement a unified identifier writing rule checker needs somewhere. Before then, I'm going to leave it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good !!

@mhoh3963
Copy link
Contributor

@hgryoo
please check fails of test_sql, test_medium.

@hgryoo
Copy link
Member Author

hgryoo commented Aug 10, 2023

Member

System table names, such as _db_class, _db_attribute, do not follow the identifier's writing rules. Because of the checking identifier's validation, createdb failed in CI because of added logic at 40c3c1e.

@hgryoo hgryoo merged commit 5fce75b into CUBRID:develop-fig-cake Aug 16, 2023
hgryoo added a commit that referenced this pull request Oct 17, 2023
… of catalog names (#4563)

http://jira.cubrid.org/browse/CBRD-24929

Add a class to provide a unified routine to compare identifiers.
- string_utility.hpp: For C++ STL's string comparison, lowercase_hash and lowercase_compare structs are added, string_set_ci_lower is defined
- identifier_store.hpp: the constructor gets a set of identifier lists and provides is_exists () API.
Refactor comparison routine related to system catalog names
- schema_system_catalog.[cpp|hpp]: Use the new API of identifier_store for system catalogs
- remove legacy duplicated routine (util_common.c, utility.h, load_server_loader.cpp...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants