1. 23 May, 2022 3 commits
    • Alexander Barkov's avatar
      Step#3 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1`... · 89adedcb
      Alexander Barkov authored
      Step#3 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
      
      Splitting Lex_exact_charset_extended_collation_attrs_st into small components.
      
      - Adding classes:
        * Lex_exact_charset
        * Lex_context_collation
        * Lex_exact_collation
        * Lex_extended_collation_st
        * Lex_extended_collation
        and moving pieces of the code from methods
        * merge_charset_clause_and_collate_clause()
        * merge_collate_clause_and_collate_clause()
        into smaller methods in the new classes.
        It's easier to read, handle and reuse the code this way.
      
      - Moving static methods find_default_collation() and find_binary_collation()
        from Lex_exact_charset_extended_collation_attrs_st to non-static methods in
        Lex_exact_charset_opt_extended_collate, as now it's a better place for them.
      
      - Using Lex_extended_collation_st in sql_yacc.yy to handle COLLATE clauses,
        to handle both context and extended collations
        (instead of the previous notation with NULL CHARSET_INFO pointer
         meaning DEFAULT, and not-NULL meaning an exact collation).
        This change will also help to add more context (UCA1400) collations soon.
        The old notation with CHARSET_INFO won't be enough.
      
      - Adding LEX::set_names() and reusing it in two places in sql_yacc.yy
      
      - Removing the opt_collate_or_default rule. It's was used only
        to handle the CONVERT TO related grammar. Had to add some code duplication,
        but it will be gone in one of the next commits.
      
      This change will also soon help to add
      Lex_extended_charset_extended_collation_attrs_st -
      a new class to handle table and database level CHARACTER SET and COLLATE
      clauses easier.
      89adedcb
    • Alexander Barkov's avatar
      Step#2 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1`... · e7f635e2
      Alexander Barkov authored
      Step#2 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
      
      - Renaming Lex_charset_collation_st to
        Lex_exact_charset_extended_collation_attrs_st
      
      - Renaming Lex_explicit_charset_opt_collate to
        Lex_exact_charset_opt_extended_collate
      
      - Renaming their methods charset_collation() to charset_info(),
        so the name clearly tells that it returns CHARSET_INFO.
        Soon we'll have new classes (e.g. Lex_exact_collation) and
        methods returning Lex_exact_collation. So the old name would be
        confusing about the return type.
      e7f635e2
    • Alexander Barkov's avatar
      Step#1 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1`... · 64a5fab0
      Alexander Barkov authored
      Step#1 MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
      
      - Adding data type aliases:
        using Lex_column_charset_collation_attrs_st = Lex_charset_collation_st;
        using Lex_column_charset_collation_attrs = Lex_charset_collation;
      
        and using them all around the code (except lex_charset.*)
        instead of the original names.
      
      - Renaming Lex_field_type_st::lex_charset_collation()
        to charset_collation_attrs()
      
      - Renaming Column_definition::set_lex_charset_collation()
        to set_charset_collation_attrs()
      
      - Renaming Column_definition::lex_charset_collation()
        to charset_collation_attrs()
      
      Rationale:
      
      The name "Lex_charset_collation" was a not very good name.
      It does not tell details about its properties:
      1. if the charset is optional (yes)
      2. if the collation is optional (yes)
      3. if the charset can be exact (yes) or context (no)
      4. if the collation can be: exact (yes) or context (yes)
      5. if the clauses can be repeated multiple times (yes)
      
      We'll need a few new data types soon with different properties.
      For example, to fix MDEV-27896 and MDEV-27782, we'll need a new
      data type which is very like Lex_charset_collation, but additionally
      supports CHARACTER SET DEFAULT (which is allowed on table and database level,
      but is not allowed on the column level yet), i.e. with:
        "the charset can be exact (yes) or context (yes)" in N3.
      
      So we'll have to rename Lex_charset_collation to something else,
      e.g.: Lex_exact_charset_extended_collation_attrs,
      and add a new data type:
      e.g. Lex_extended_charset_extended_collation_attrs
      
      Also, we'll possibly allow CHARACTER SET DEFAULT at the column level for
      consistency with other places. So the storge on the column level can change:
      - from Lex_exact_charset_extended_collation_attrs
      - to   Lex_extended_charset_extended_collation_attrs
      
      Adding the aliases introduces a convenient abstraction against
      upcoming renames and c++ data type changes.
      64a5fab0
  2. 20 May, 2022 2 commits
  3. 19 May, 2022 1 commit
  4. 18 May, 2022 5 commits
  5. 17 May, 2022 11 commits
  6. 16 May, 2022 8 commits
  7. 15 May, 2022 5 commits
  8. 14 May, 2022 2 commits
  9. 13 May, 2022 3 commits