[Rt-commit] rt branch, 4.4/mysql8-quoted-tables, repushed

Aaron Trevena ast at bestpractical.com
Fri Sep 4 15:33:28 EDT 2020


The branch 4.4/mysql8-quoted-tables was deleted and repushed:
       was 5652201fe56c7835affbaa6e6d6d042757eac0e5
       now fa9ab931860c85664e3f518d2adaeabc5db5938b

 1: 7b048865db =  1: 7b048865db Allow to squelch recipients that also exist in one time inputs
 2: 6cf274f5bc =  2: 6cf274f5bc Check txn's fields for its relationship with ticket
 3: 9d05b93c13 =  3: 9d05b93c13 Fix "Case sensitive search by Queues.Name" warnings in GetReferencedQueues
 4: 406252f311 =  4: 406252f311 Support to copy saved charts like searches
 5: de3e4f5000 =  5: de3e4f5000 Refactor saved chart tests a bit to reduce code duplication by using a loop
 6: feec798d3d =  6: feec798d3d Test the copy feature of saved charts
 7: 5dc91ca147 =  7: 5dc91ca147 Exclude MIME attachments when questing a transaction's content
 8: 2505933f07 =  8: 2505933f07 Add tests for transaction content
 9: 31ca5c2ab2 =  9: 31ca5c2ab2 Fix wrongly duplicated one-time addresses on ticket update page
10: 43061702cb = 10: 43061702cb Update mysql schema for mysql 8 making Groups reserved word
11: d61dc3c5f1 ! 11: e3ba6e1ab5 Update queries and user creation for Mysql 8
    @@ -14,15 +14,19 @@
     --- a/lib/RT/Handle.pm
     +++ b/lib/RT/Handle.pm
     @@
    -         $ENV{'NLS_LANG'} = "AMERICAN_AMERICA.AL32UTF8";
    -         $ENV{'NLS_NCHAR'} = "AL32UTF8";
    -     }
    -+    if ( $db_type eq 'mysql' ) {
    -+        $args{QuoteTableNames} = 1;
    -+    }
    - 
    -     $self->SUPER::Connect(
    -         User => RT->Config->Get('DatabaseUser'),
    +         return (0, "RT is unsupported on MySQL versions before 4.1.  Your version is $version.")
    +             if $version < 4.1;
    + 
    ++        # Installed DBIx::SearchBuilder must have table name quoting for mysql 8
    ++        if ($version >= 8) {
    ++            unless ($self->can('QuoteName')) {
    ++                return (0, "RT support for MySQL 8 requires a DBIx::SearchBuilder with table quoting support, check that you have the latest version of DBIx::SearchBuilder installed");
    ++            }
    ++        }
    ++
    +         # MySQL must have InnoDB support
    +         local $dbh->{FetchHashKeyName} = 'NAME_lc';
    +         my $innodb = lc($dbh->selectall_hashref("SHOW ENGINES", "engine")->{InnoDB}{support} || "no");
     
     diff --git a/lib/RT/Principal.pm b/lib/RT/Principal.pm
     --- a/lib/RT/Principal.pm
    @@ -31,7 +35,7 @@
          }
          my $roles;
          {
    -+        my $groups_table = $self->QuoteOtherTableName('Groups');
    ++        my $groups_table = $self->_MaybeQuoteName('Groups');
              my $query
     -            = "SELECT DISTINCT Groups.Name "
     +            = "SELECT DISTINCT $groups_table.Name "
    @@ -44,7 +48,7 @@
          return 0 unless @roles;
     -
     -    my $query = "SELECT Groups.id "
    -+    my $groups_table = $self->QuoteOtherTableName('Groups');
    ++    my $groups_table = $self->_MaybeQuoteName('Groups');
     +    my $query = "SELECT $groups_table.id "
              . $self->_HasRoleRightQuery( %args, Roles => \@roles );
      
    @@ -53,7 +57,7 @@
                       @_
                     );
      
    -+    my $groups_table = $self->QuoteOtherTableName('Groups');
    ++    my $groups_table = $self->_MaybeQuoteName('Groups');
          my $query =
     -        " FROM Groups, Principals, CachedGroupMembers WHERE "
     +        " FROM $groups_table, Principals, CachedGroupMembers WHERE "
    @@ -84,7 +88,7 @@
      sub LockForUpdate {
          my $self = shift;
      
    -+    my $table = $self->QuotedTableName;
    ++    my $table = $self->_MaybeQuoteName($self->Table);
          my $pk = $self->_PrimaryKey;
          my $id = @_ ? $_[0] : $self->$pk;
          $self->_expire if $self->isa("DBIx::SearchBuilder::Record::Cachable");
    @@ -105,14 +109,22 @@
              );
          }
     @@
    - 
    -     my $dbh = $RT::Handle->dbh;
    - 
    --    my $res = "INSERT INTO ". $dbh->quote_identifier( $self->Table );
    -+    my $res = "INSERT INTO ". $dbh->quote_identifier( $self->QuotedTableName );
    -     my $values = $self->{'values'};
    -     $res .= "(". join( ",", map { $dbh->quote_identifier( $_ ) } sort keys %$values ) .")";
    -     $res .= " VALUES";
    +     return 1;
    + }
    + 
    ++sub _MaybeQuoteName {
    ++    my ($self, $name) = @_;
    ++
    ++    # no action unless DBIx::SearchBuilder quoting supported and enabled
    ++    return $name
    ++        unless (defined($self->_Handle->{'QuoteTableNames'}) && $self->_Handle->{'QuoteTableNames'});
    ++
    ++    return $self->QuotedTableName($name);
    ++}
    ++
    + sub PostInflate {
    + }
    + 
     
     diff --git a/lib/RT/Users.pm b/lib/RT/Users.pm
     --- a/lib/RT/Users.pm
    @@ -121,7 +133,7 @@
          my $groups = shift;
          my @objects = @_;
      
    -+    my $groups_table = $self->RecordClass->QuoteOtherTableName($groups);
    ++    my $groups_table = $self->RecordClass->_MaybeQuoteName($groups);
     +
          my @groups_clauses;
          foreach my $obj ( @objects ) {
12: 5652201fe5 = 12: fa9ab93186 Update tests for mysql 8



More information about the rt-commit mailing list