Ignore:
Timestamp:
2018-10-31T19:48:18+13:00 (5 years ago)
Author:
ak19
Message:

Removing db_encoding as parameters to GreenstoneSQLPlugout and GreenstoneSQLPlugin: as doc.xml is always in utf8, the same contents stored in the MySQL db should be too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/gssql.pm

    r32558 r32559  
    6767    my $self = {
    6868    'collection_name' => $params_map->{'collection_name'},
    69     'db_encoding' => $params_map->{'db_encoding'}
    7069    };
    7170
     
    7574    $self->{'tablename_prefix'} = $coll_name;
    7675
     76    # The db_encoding option is presently not passed in to this constructor as parameter.
     77    # Placed here to indicate it's sort of optional.
     78    # Since docxml are all in utf8, the contents of the GS SQL database should be too,
     79    # So making utf8 the hidden default at present.
     80    $self->{'db_encoding'} = $params_map->{'db_encoding'} || "utf8";
     81   
    7782    return bless($self, $class);
    7883}
     
    110115    my $self= shift (@_);
    111116    my ($params_map) = @_;
    112     #my $db_enc = $self->{'db_encoding'} || "utf8";
    113     my $db_enc = "utf8mb4";
     117    # For proper utf8 support in MySQL, encoding should be 'utf8mb4' as 'utf8' is insufficient
     118    my $db_enc = "utf8mb4" if $self->{'db_encoding'} eq "utf8";
    114119
    115120    # these are the params for connecting to MySQL
     
    130135    print STDERR " - hostname $db_host; username: $db_user";
    131136    print STDERR "; and the password provided" if $db_pwd;
    132     print STDERR "Assuming the mysql server has been started with --character_set_server=utf8mb4" if $db_driver eq "mysql";
     137    print STDERR "\nAssuming the mysql server has been started with: --character_set_server=utf8mb4\n" if $db_driver eq "mysql";
    133138   
    134139    my $dbh = DBI->connect("$connect_str", $db_user, $db_pwd,
Note: See TracChangeset for help on using the changeset viewer.