[DBD-SQLite] register_global_collation()

Adam Kennedy adamkennedybackup at gmail.com
Thu Jul 23 08:40:58 GMT 2009


If we're going to make a way to override internals like that, I'd
prefer that the flag is specific for that purpose. Providing the
override/replace flag without an existing collation would be
considered an error.

I really don't want to see any kind of "get out of jail" flag like a
force => 1 you can just slap on the method and thereafter ignore the
issue.

It's becoming increasingly likely that we'll be seeing more and more
Perl programs where multiple subsystems are using SQLite, so I really
want to prevent any clashing issues before they start.

Adam K

2009/7/23 Dami Laurent (PJ) <laurent.dami at justice.ge.ch>:
>
>
>>-----Message d'origine-----
>>De : Adam Kennedy
>>Envoyé : mardi, 21. juillet 2009 10:50
>>À : Dami Laurent (PJ)
>>Objet : Re: [DBD-SQLite] Added functionalities (hooks)
>>
>>Most of this looks fine, but I don't like the global hash for
>>collations.
>>
>>It takes something that previous had a localised effect and changes it
>>into something with a global effect. Further, beyond being a global
>>registry, there's no form of clash detection available with a simple
>>hash.
>>
>>So if I add a CPAN::Version sort as "version" and someone else adds an
>>ISO version sort as "version" there's not way to know that they
>>collide with each other. One just spontaneously starts working like
>>the other.
>>
>>If we're going to have a global collation pool I would much rather
>>implement it as a registry style feature.
>>
>>DBD::SQLite->register_global_collation( ... );
>>
>>This way, if two different modules try to use the same collation name,
>>the last one to be loaded will error instead of incorrectly
>>succeeding.
>>
>>Adam K
>
> Actually the "localised effect" is still available through
> $dbh->sqlite_create_collation(...), if you choose to register it that way ...
> but in that case you have to do it manually for every new $dbh.
>
> Clash detection is indeed available through something like
>  if (exists $DBD::SQLite::COLLATION{$collation_name}) {...}
> but it's the client's responsability to check, and I agree with you
> that this could be a problem if clients are not careful. Your suggestion
> is better, because then clashes will raise errors; however there should be
> an arg like -force => 1 for people who would really wants to override a previously
> registered collation (for example overriding the builtin 'perl' and 'perllocale').
>
> I'll commit a new proposal going in that direction.
>
> Laurent D.
>
> _______________________________________________
> DBD-SQLite mailing list
> DBD-SQLite at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbd-sqlite
>



More information about the DBD-SQLite mailing list