akzhan / DBIx-Class-ResultClass-HashRefInflator-UTF8

DBIx-Class-ResultClass-HashRefInflator-UTF8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Needs docs on why/when the module should be used

ribasushi opened this issue · comments

Hi!

Most DBD's already provide a way to do what you want natively: DBD::Pg, DBD::mysql, DBD::ODBC etc

This makes a user wonder - what is the use case of your module? Documenting that would be of great help to whoever comes next.

Note that while overriding the inflator the way you did is definitely supported, works and will continue to work, there is a lot of overhead doing so (timing HRI vs HRI::UTF8 will reveal a likely unexpected perf difference, especially on > 100 row resultsets).

Cheers!

Thanks @ribasushi for your mention. But I wanna only to get hashref inflator compatible with utf-8, without lowering to DBD level.

And thanks, I add documentation,

And latest step - i was improved speed/quality of the inflator.

I think you misunderstood what I meant... Можно по русски?

да.

кстати, если вкратце -https://gist.github.com/asan13/a1688a6f6463cf3fdd4a722beaa2842c работает

но почему-то при попытке в рабочем проекте поставить client_encoding - unsupported option.

Пакеты DBIx::Class, DBI, DBD::Pg обновлены до последних.

Ну и без этой опции при использовании обычного HashInflator строки приходят без флага utf8

Насколько помню client_encoding=utf8 директива для libpq (версия DBD::Pg тут не при чем).
Но вроде все должно сработать даже без client_encoding: не достаточно pg_enable_utf8?

Но я лично Pg не пользуюсь так что лучше сходите на #dbi спросите напрямую у G_SabinoMulane или у ilmari. Сильно рекоммендую изправить на уровне DBD - когда ползуемся "чистым" HRI внутри DBIC есть фишка совершенно обходящая inflate_result(): соответственно производительность возрастает в разы.

А насчет документации - добавьте просто:

This module should be used to force UTF8 on your results in case your DBI/DBD/lib-$protocol pipeline does not support unicode natively (similar to the higher-level DBIx::Class::ForceUTF8

Попозже уже исследую и поправлю доку. Пока что решал конкретную проблему.

9 июля 2016 г., 15:58 пользователь Peter Rabbitson <notifications@github.com

написал:

Насколько помню client_encoding=utf8 директива для libpq (версия DBD::Pg
тут не при чем).
Но вроде все должно сработать даже без client_encoding: не достаточно
pg_enable_utf8
https://gist.github.com/asan13/a1688a6f6463cf3fdd4a722beaa2842c#file-gistfile1-txt-L11
?

Но я лично Pg не пользуюсь так что лучше сходите на #dbi
https://chat.mibbit.com/?channel=%23dbi&server=irc.perl.org спросите
напрямую у G_SabinoMulane или у ilmari. Сильно рекоммендую изправить на
уровне DBD - когда ползуемся "чистым" HRI внутри DBIC есть фишка
https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082840/t/resultset/rowparser_internals.t#L672-748
совершенно обходящая inflate_result(): соответственно производительность
возрастает в разы.

А насчет документации - добавьте просто:

This module should be used to force UTF8 on your results in case your
DBI/DBD/lib-$protocol pipeline does not support unicode natively (similar
to the higher-level DBIx::Class::ForceUTF8
http://p3rl.org/DBIx::Class::ForceUTF8


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAG3hD31M5S1lvhcWFYaBkEtv2_T9Pz-ks5qT5rjgaJpZM4JIk_5
.