[MDEV-12659] Add THD::make_string_literal() Created: 2017-05-02  Updated: 2017-05-02  Resolved: 2017-05-02

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.3.1

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-12658 Make the third parameter to LPAD and ... Closed

 Description   

In order to implement MDEV-12658 easier, and to remove duplicate code between sql_yacc.yy and sql_yacc_ora.yy, we'll remove this code:

text_literal:
          TEXT_STRING
          {
            LEX_CSTRING tmp;
            CHARSET_INFO *cs_con= thd->variables.collation_connection;
            CHARSET_INFO *cs_cli= thd->variables.character_set_client;
            uint repertoire= $1.repertoire(cs_cli);
            if (thd->charset_is_collation_connection ||
                (repertoire == MY_REPERTOIRE_ASCII &&
                 my_charset_is_ascii_based(cs_con)))
              tmp= $1;
            else
            {
              LEX_STRING to;
              if (thd->convert_string(&to, cs_con, $1.str, $1.length, cs_cli))
                MYSQL_YYABORT;
             tmp.str=    to.str;
             tmp.length= to.length;
            }
            $$= new (thd->mem_root) Item_string(thd, tmp.str, tmp.length,
                                                cs_con,
                                                DERIVATION_COERCIBLE,
                                                repertoire);
            if ($$ == NULL)
              MYSQL_YYABORT;
          }

and add a new method in THD instead, so the code in .yy files will be simplified to:

text_literal:
          TEXT_STRING
          {
            if (!($$= thd->make_string_literal($1)))
              MYSQL_YYABORT;
          }



 Comments   
Comment by Alexander Barkov [ 2017-05-02 ]

Pushed to bb-10.2.ext

Generated at Thu Feb 08 07:59:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.