artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Artanis] database with Japanese text not displaying properly


From: Nala Ginrut
Subject: Re: [Artanis] database with Japanese text not displaying properly
Date: Mon, 25 Jun 2018 00:29:06 +0800
User-agent: mu4e 1.1.0; emacs 25.1.1

Hi Julio!
It's "run-when-DB-init!", in Scheme, the naming convention "!" means there's 
kind of
side-effect.

And please "git pull" the repo since I've fixed a bug to make sure run
the hook each time creating DB connection.

BTW, please don't hasitate to report, we're using Artanis in a product,
so I want to make it stable as possible.

Thanks!



Julio Claudio Matus Ramirez writes:

> Hey Nala,
>
> Thanks for the continuous support.
> Yes, "set names utf8" is database specific, and I'm guessing not all
> users will want to use utf8 anyway. Many people might have their own
> specific settings for any number of reasons, so it'd be great if we had
> somewhere to put such non-framework-directly-related stuff. The hook in
> the ENTRY file sounds great.
>
> I tried recompiling artanis, then re-creating my project, then adding
> the code:
>
> (run-when-DB-init
>   (lambda (conn)
>     (DB-query conn "set names utf8")))
>
> to my ENTRY file (top file in project dir), between the use-modules and
> init-server functions. But it just says:
>
> ENTRY:3:0: In procedure module-lookup: Unbound variable: run-when-DB-init
>
>
> After doing a grep -r with "run-when-DB-init" on my bin/lib dir I got:
>
> Binary file guile/2.2/site-ccache/artanis/utils.go matches
>
> I'm afraid I haven't read the code enough to help you provide a solution
> for this hook, but just to let you know it's not working for me. Am I
> missing any steps?
>
> The work-around of just adding the DB-query code in the viewer before
> calling the db query is working for me so far anyway.
>
>
> Cheers,
>
>
> Nala Ginrut <address@hidden> writes:
>
>> Hmm...I've taken a glance at "set names", it's DB specific
>> things so that Artanis can't provide an unify solution for users.
>> MariaDB/postgresql support "set names", but sqlite3 doesn't. It's still
>> possible to support new databases in the future. So maybe the hook is
>> enough for users.
>>
>>
>> Nala Ginrut writes:
>>
>>> Hi Julio!
>>>
>>> Julio Claudio Matus Ramirez writes:
>>>
>>>> Hello Nala Ginrut,
>>>> <% (DB-query conn "set names utf8") %>
>>>>
>>>> (adding this before calling the database query in the viewer)
>>>
>>> This should be configurable in Artanis, I will consider how to do it
>>> properly. The idea is that users shouldn't consider these stuff by 
>>> themselves.
>>> Thanks for point it out!
>>>
>>>> It's the only way I could find to change the encoding for the client
>>>> output. If you have any other solution/suggestion I'm very interested.
>>>>
>>>> It would be great if we could add random connection initilization raw
>>>> strings/options as with other frameworks. Being able to call random sql
>>>> code would be nice too (I'm guessing you didn't intend DB-query to be
>>>> used in this way).
>>>
>>> I've added a hook which should be triggered each time when DB is
>>> initializing, it's named run-when-DB-init in (artanis utils). And you
>>> should add your hook in ENTRY file:
>>>
>>> --------------------ENTRY--------------------
>>> (use-modules (artanis utils) (artanis artanis))
>>> (run-when-DB-init
>>> (lambda (conn)
>>> (DB-query conn "set names utf8")))
>>>
>>> (init-server) ; make sure the hook is registered before (init-server)
>>> ...
>>> --------------------end---------------------
>>>
>>> This will effect all pre-connected connections in conn-pool
>>> automatically.
>>>
>>> The commit is here:
>>> https://gitlab.com/NalaGinrut/artanis/commit/1ae23e773f48d112c3a006ad214eec8a92686074
>>>
>>> Could you try and feedback?
>>> Thanks!
>>
>>
>> --
>> GNU Powered it
>> GPL Protected it
>> GOD Blessed it
>> HFG - NalaGinrut
>> Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058
>>


--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]