RE: [PROPOSAL]a new data type 'bytea' for ECPG

Поиск
Список
Период
Сортировка
От Matsumura, Ryo
Тема RE: [PROPOSAL]a new data type 'bytea' for ECPG
Дата
Msg-id 03040DFF97E6E54E88D3BFEE5F5480F737AA614F@G01JPEXMBYT04
обсуждение исходный текст
Ответ на Re: [PROPOSAL]a new data type 'bytea' for ECPG  (Michael Meskes <meskes@postgresql.org>)
Ответы Re: [PROPOSAL]a new data type 'bytea' for ECPG  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
Meskes-san

Thank you for your review.

> There is one thing that I don't understand right now. YOu
> change ecpg_store_input() to handle the bytea data type, yet you also
> change ECPGset_desc() to not use ecpg_store_input() in case of an
> bytea. This looks odd to me. Can you please explain that to me?

I try to explain as follows. I would like to receive your comment.

The current architecture of data copying of descriptor walks through the following path.
The important point is that it walks through two ecpg_store_input().

 step 1. ECPGset_desc
   Store to descriptor_item with ecpg_store_input().

 step 2. ecpg_build_params(setup for tobeinserted)
   Store to tobeinserted with ecpg_store_input().

 step 3. ecpg_build_params(building stmt->param*)
   Set tobeinserted to stmt->paramvalues.

On the other hand, the part of ecpg_build_params(building stmt->param*)
for bytea needs two information that are is_binary and binary_length.
But, data copying with ecpg_store_input() losts them.

There are two ideas to pass the information to part of ecpg_build_params(building stmt->param*).
But they are same in terms of copying data without ecpg_store_input() at least ones.
I selected Idea-1.

Idea-1.

 step 1. ECPGset_desc
   Set descriptor_item.is_binary.
   Memcpy both bytea.length and bytea.array to descriptor_item.data.

 step 2. ecpg_build_params(setup for tobeinserted)
   Store bytea.array to tobeinserted with ecpg_store_input(bytea route).
   Set is_binary(local) from descriptor_item.is_binary.
   Set binary_length(local) from descriptor_item.data.

 step 3. ecpg_build_params(building stmt->param*)
   Set stmt->paramvalues from tobeinserted.
   Set stmt->formats from is_binary(local).
   Set stmt->lengths from binary_length(local).


Idea-2.

 step 1. ECPGset_desc
   Set descriptor_item.is_binary.
   Set bytea.length to descriptor_item.data_len. (different!)
   Set bytea.array to descriptor_item.data. (different!)

 step 2. ecpg_build_params(setup for tobeinserted)
   Memcpy bytea.array to tobeinserted by using alloc and memcpy whitout store_input. (different!)
   Set is_binary(local) from descriptor_item.is_binary.
   Set binary_length(local) from descriptor_item.data_len. (different!)

 step 3. ecpg_build_params(building stmt->param*)
   Set stmt->paramvalues with tobeinserted.
   Set stmt->formats from is_binary(local).
   Set stmt->lengths from binary_length(local).

Regards
Ryo Matsumura 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Sergei Kornilov
Дата:
Сообщение: Re: pg11.1: dsa_area could not attach to segment
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: Protect syscache from bloating with negative cache entries