GPRE and VARBINARY

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

GPRE and VARBINARY

Dimitry Sibiryakov-3
   Hello, All.

   What BLR and data type must generate GPRE for retrieving/storage of VARBINARY fields?
   For VARCHAR CHARACTER SET OCTETS it used to generate blr_cstring and plain char[],
which is, IMHO, incorrect because binary strings can contain '\0' characters.
   Opinions?

--
   WBR, SD.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Vlad Khorsun-2
05.03.2017 13:35, Dimitry Sibiryakov wrote:
>    Hello, All.
>
>    What BLR and data type must generate GPRE for retrieving/storage of VARBINARY fields?
>    For VARCHAR CHARACTER SET OCTETS it used to generate blr_cstring and plain char[],
> which is, IMHO, incorrect because binary strings can contain '\0' characters.

   I see blr_cstring in fb3 and blr_text in fb4.

Vlad


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Dimitry Sibiryakov-3
05.03.2017 14:09, Vlad Khorsun wrote:
>    I see blr_cstring in fb3 and blr_text in fb4.

   Yes, and this is the source of additional zeros in tail of legacy hash if I'm not mistaken.
   Besides, char[256] is a too big buffer for VARBINARY(64).
   I don't know BLR, so I can't say what verb must be used for VARYING.

--
   WBR, SD.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Adriano dos Santos Fernandes-3
Em 05/03/2017 10:33, Dimitry Sibiryakov escreveu:
> 05.03.2017 14:09, Vlad Khorsun wrote:
>>    I see blr_cstring in fb3 and blr_text in fb4.
>
>    Yes, and this is the source of additional zeros in tail of legacy hash if I'm not mistaken.
>    Besides, char[256] is a too big buffer for VARBINARY(64).
>    I don't know BLR, so I can't say what verb must be used for VARYING.
>

blr_varying ?


Adriano

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Dimitry Sibiryakov-3
05.03.2017 16:34, Adriano dos Santos Fernandes wrote:
>>    I don't know BLR, so I can't say what verb must be used for VARYING.
>>
> blr_varying ?

   Yes, it looks like a right thing. Unfortunately, currently GPRE doesn't support this
verb at all. The only types that it can handle is blr_text for fixed length data and
blr_cstring for null-terminated strings.
   I'll try to implement support for varying string in GPRE, but it can take time. In
meantime I'd suggest to change declaration of PLG$PASSWD domain back to VARCHAR CHARACTER
SET OCTETS.


--
   WBR, SD.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Adriano dos Santos Fernandes-3
Em 05/03/2017 12:45, Dimitry Sibiryakov escreveu:

> 05.03.2017 16:34, Adriano dos Santos Fernandes wrote:
>>>    I don't know BLR, so I can't say what verb must be used for VARYING.
>>>
>> blr_varying ?
>
>    Yes, it looks like a right thing. Unfortunately, currently GPRE doesn't support this
> verb at all. The only types that it can handle is blr_text for fixed length data and
> blr_cstring for null-terminated strings.
>    I'll try to implement support for varying string in GPRE, but it can take time. In
> meantime I'd suggest to change declaration of PLG$PASSWD domain back to VARCHAR CHARACTER
> SET OCTETS.
>

Wasn't VARBINARY a syntatic sugar for VARCHAR CHARACTER SET OCTETS?

It looks like if things works different (even in a non ideal condition),
there is a bug in the new code.

(I already reported TCS behaving different after this feature)


Adriano

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

[SPAM] Re: GPRE and VARBINARY

Vlad Khorsun-2
In reply to this post by Dimitry Sibiryakov-3
05.03.2017 17:45, Dimitry Sibiryakov wrote:

...

>    I'll try to implement support for varying string in GPRE, but it can take time. In

   Not sure it is requred at all... after so many years

> meantime I'd suggest to change declaration of PLG$PASSWD domain back to VARCHAR CHARACTER
> SET OCTETS.

   AFAIU, it contains ASCII symbols only, as hash of encrypted password is converted into
base64 encoding before storing. Thus, we could change charset to ASCII or even leave it
as is (after my recent fix).

Regards,
Vlad


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Dimitry Sibiryakov-3
In reply to this post by Adriano dos Santos Fernandes-3
05.03.2017 16:59, Adriano dos Santos Fernandes wrote:
> Wasn't VARBINARY a syntatic sugar for VARCHAR CHARACTER SET OCTETS?

   It was supposed to be so. But one little thing make difference: subtype.

> It looks like if things works different (even in a non ideal condition),
> there is a bug in the new code.

   Not quite so. Old code in GPRE (for unknown reason) checks subtype of varchar fields as
if they were BLOBs and generate blr_cstring for subtype 0 and blr_text for anything else.


--
   WBR, SD.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: GPRE and VARBINARY

Adriano dos Santos Fernandes-3
Em 05/03/2017 13:05, Dimitry Sibiryakov escreveu:

> 05.03.2017 16:59, Adriano dos Santos Fernandes wrote:
>> Wasn't VARBINARY a syntatic sugar for VARCHAR CHARACTER SET OCTETS?
>
>    It was supposed to be so. But one little thing make difference: subtype.
>
>> It looks like if things works different (even in a non ideal condition),
>> there is a bug in the new code.
>
>    Not quite so. Old code in GPRE (for unknown reason) checks subtype of varchar fields as
> if they were BLOBs and generate blr_cstring for subtype 0 and blr_text for anything else.
>
>

So the new code which is supposed to be a syntatic sugar has this bug
waiting to be fixed.


Adriano

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Reply | Threaded
Open this post in threaded view
|

Re: [SPAM] Re: GPRE and VARBINARY

Dimitry Sibiryakov-3
In reply to this post by Vlad Khorsun-2
05.03.2017 17:05, Vlad Khorsun wrote:
>>    I'll try to implement support for varying string in GPRE, but it can take time. In
>    Not sure it is requred at all... after so many years

   Support of BOOLEAN was added. Why not to support (VAR)BINARY as well?..

>> meantime I'd suggest to change declaration of PLG$PASSWD domain back to VARCHAR CHARACTER
>> SET OCTETS.
>    AFAIU, it contains ASCII symbols only, as hash of encrypted password is converted into
> base64 encoding before storing. Thus, we could change charset to ASCII or even leave it
> as is (after my recent fix).

   As long as auth plugins are developed only by project members and using of Base64
encoding for storage of password is a documented - ASCII is fine.

--
   WBR, SD.

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel