Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] SQLSource encoding

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] SQLSource encoding
  • Date: Thu, 25 Jul 2013 16:20:13 +0200


Le 25/07/13 15:58, Guillaume Rousse a écrit :
address@concealed">Le 25/07/2013 15:48, David Verdin a écrit :
Hi,

I'm merging SQLSource to Sympa::Datasource::SQL (the problem will be the
same in Sympa::Database).

Problem: In the 6.2 branch, Soji added the enforcement of the UTF-8
encoding on the client side for all supported engines. It was done in
the "establish_connection" sub. Now, in SQL.pm, we only have a "connect"
sub with no part related to a given RDBMS.The sub modules for each RDBMS
don't have a "connect" sub. So where can we enforce UTF-8 usage? Can we
create an "enforce_utf8" sub in each module, which will be called in the
SQL::connect?
You probably didn't found thqem, but both Sympa::Datasource::SQL::SQLite and Sympa::Datasource::SQL::Sybase override the definition of connect() method for database-specific processing.
Damn me; i didn't read all the subclasses; Sorry.
address@concealed">
Here is Sybase case, for instance:

sub connect {
    my ($self, %params) = @_;

    my $result = $self->SUPER::connect(%params);
    return unless $result;

    $self->{dbh}->do("use $self->{db_name}");

    return 1;
}
Good. however, in some cases, UTF-8 enforcment should be done before connecting. It then would favorize an "enforce_utf8" sub.
address@concealed">
However, regarding the encoding issue, I object doing it unconditionnaly for external datasources, for which there is no garanty about their internal structure.
Yes, you're right. This will be an advantage of discerning Datasource from Database. So this job must be done in the Sympa::Database::<RDBMS> modules.
We will also need to convert existing databases to UTF-8.
address@concealed"> A configuration flag would be useful, tough.
Yes. though most of the time,
address@concealed">
It does make sense for Sympa::Databases subclasses, tough, for which this is enforced in every subclasses.
Yay! I understood!

Al ittle look at the modification made by Soji, so that he can also give us advice about where to set up this code: https://sourcesup.renater.fr/scm/viewvc.php/branches/sympa-6.2-branch/src/lib/SQLSource.pm?root=sympa&r1=7621&r2=9562

--
A bug in Sympa? Quick! To the bug tracker!

 
David Verdin
Infrastructure pour les Services Informatiques
 
Tél : +33 2 23 23 69 71
Fax : +33 2 23 23 71 21
 
www.renater.fr
RENATER
263 Avenue du Gal Leclerc
35042 Rennes Cedex



PNG image

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page