- Timestamp:
- 2018-10-31T19:48:18+13:00 (5 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/gssql.pm
r32558 r32559 67 67 my $self = { 68 68 'collection_name' => $params_map->{'collection_name'}, 69 'db_encoding' => $params_map->{'db_encoding'}70 69 }; 71 70 … … 75 74 $self->{'tablename_prefix'} = $coll_name; 76 75 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 77 82 return bless($self, $class); 78 83 } … … 110 115 my $self= shift (@_); 111 116 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"; 114 119 115 120 # these are the params for connecting to MySQL … … 130 135 print STDERR " - hostname $db_host; username: $db_user"; 131 136 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"; 133 138 134 139 my $dbh = DBI->connect("$connect_str", $db_user, $db_pwd, -
main/trunk/greenstone2/perllib/plugins/GreenstoneSQLPlugin.pm
r32556 r32559 146 146 'deft' => "127.0.0.1", 147 147 'reqd' => "yes"}, 148 { 'name' => "db_encoding",149 'desc' => "{GreenstoneSQLPlug.db_encoding}",150 'type' => "string",151 'deft' => "utf8",152 'reqd' => "yes"}153 148 ]; 154 149 … … 373 368 # print STDERR "@@@@ user: " . $self->{'db_client_user'} . "\n"; 374 369 # print STDERR "@@@@ db_host: " . $self->{'db_host'} . "\n"; 375 # print STDERR "@@@@ db_enc: " . $self->{'db_encoding'} . "\n";376 370 # print STDERR "@@@@ db_driver: " . $self->{'db_driver'} . "\n"; 377 371 #################### 378 372 373 # create gssql object. 374 # collection name will be used for naming tables (site name will be used for naming database) 379 375 my $gs_sql = new gssql({ 380 'collection_name' => $ENV{'GSDLCOLLECTION'}, 381 'db_encoding' => $self->{'db_encoding'} 382 } 383 ); 376 'collection_name' => $ENV{'GSDLCOLLECTION'} 377 }); 384 378 385 379 # try connecting to the mysql db, if that fails it will die -
main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm
r32555 r32559 94 94 'type' => "string", 95 95 'deft' => "127.0.0.1", 96 'reqd' => "yes"},97 { 'name' => "db_encoding",98 'desc' => "{GreenstoneSQLPlug.db_encoding}",99 'type' => "string",100 'deft' => "utf8",101 96 'reqd' => "yes"} 102 97 ]; … … 136 131 #print STDERR "@@@@ user: " . $self->{'db_client_user'} . "\n"; 137 132 #print STDERR "@@@@ db_host: " . $self->{'db_host'} . "\n"; 138 #print STDERR "@@@@ db_enc: " . $self->{'db_encoding'} . "\n";139 133 #print STDERR "@@@@ db_driver: " . $self->{'db_driver'} . "\n"; 140 134 #print STDERR "@@@@ proc_mode: " . $self->{'process_mode'} . "\n"; … … 147 141 148 142 my $db_params = { 149 'collection_name' => $ENV{'GSDLCOLLECTION'}, 150 'db_encoding' => $self->{'db_encoding'} 143 'collection_name' => $ENV{'GSDLCOLLECTION'} 151 144 }; 152 145 -
main/trunk/greenstone2/perllib/strings.properties
r32541 r32559 1459 1459 GreenstoneSQLPlug.db_client_pwd:The password with which you connect to the (My)SQL database. 1460 1460 GreenstoneSQLPlug.db_host:The hostname on which the (My)SQL database server is running, 127.0.0.1 by default. Other values to try include localhost. 1461 GreenstoneSQLPlug.db_encoding:The encoding of the contents of the database, utf8 by default. For other options, see https://dev.mysql.com/doc/refman/5.7/en/charset-applications.html. Use the same encoding to write contents to the database with GreenstoneSQLPlugout as to read back in with GreenstoneSQLPlugin.1462 1461 1463 1462 #
Note:
See TracChangeset
for help on using the changeset viewer.