PL/SQL parser (MDEV-10142)

[MDEV-13414] Fix the SP code to avoid excessive use of strlen Created: 2017-07-31  Updated: 2018-08-31  Resolved: 2017-07-31

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 10.3
Fix Version/s: 10.3.1

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: refactoring

Issue Links:
Blocks
blocks MDEV-10591 Oracle-style packages Closed
Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 Description   

Functions sp_load_for_information_schema() and show_create_sp() do a lot of strlen calls, e.g.:

  if (parse_user(definer, strlen(definer),
                 definer_user_name.str, &definer_user_name.length,
                 definer_host_name.str, &definer_host_name.length) &&
      definer_user_name.length && !definer_host_name.length)

  if (!show_create_sp(thd, &defstr,
                     type,
                     NULL, 0,
                     name->m_name.str, name->m_name.length,
                     params, strlen(params),
                     returns, strlen(returns),
                     body, strlen(body),
                     &chistics, definer_user_name, definer_host_name,
                     sql_mode))

  if (!show_create_sp(thd, &defstr, type,
                     sp_db_str.str, sp_db_str.length,
                     sp_name_obj.m_name.str, sp_name_obj.m_name.length,
                     params, strlen(params),
                     returns, strlen(returns), 
                     sp_body, strlen(sp_body),
                     &sp_chistics, &definer_user, &definer_host, sql_mode))

This code is going to be shared by Oracle-style packages soon (MDEV-10591). Before adding packages, it would be nice to get rid of strlen calls.

Under terms if this task we'll change API for these functions to accept LEX_CSTRING instead of const char * and fix the caller code accordingly.


Generated at Thu Feb 08 08:05:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.