Charset in IExternalProcedureImpl

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Charset in IExternalProcedureImpl

Jiří Činčura-2
Hi *,

do I understand correctly that the IExternalProcedureImpl::getCharSet
allows me to tell engine in what charset I want the varchar/char values?
Because although I have UTF-8 hardcoded there, when I declare procedure
parameter as "result varchar(1) character set ascii" I'm getting
length==1 in metadata (metadata->getLength(status, i)), while when I
omit the "character set ascii" I get the expected length==4.

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

------------------------------------------------------------------------------
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
|  
Report Content as Inappropriate

Re: Charset in IExternalProcedureImpl

Jiří Činčura-2
Looks like it has no effect, though it is called. Using WIN1250 there and I'm still getting the varchars in UTF-8 (connection charset). So it probably has different purpose?

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/


On Mon, Jul 24, 2017, at 11:56, Jiří Činčura wrote:
> Hi *,
>
> do I understand correctly that the IExternalProcedureImpl::getCharSet
> allows me to tell engine in what charset I want the varchar/char values?
> Because although I have UTF-8 hardcoded there, when I declare procedure
> parameter as "result varchar(1) character set ascii" I'm getting
> length==1 in metadata (metadata->getLength(status, i)), while when I
> omit the "character set ascii" I get the expected length==4.
>
> --
> Mgr. Jiří Činčura
> https://www.tabsoverspaces.com/


------------------------------------------------------------------------------
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
|  
Report Content as Inappropriate

Re: Charset in IExternalProcedureImpl

Adriano dos Santos Fernandes-3
On 27/07/2017 03:01, Jiří Činčura wrote:
> Looks like it has no effect, though it is called. Using WIN1250 there
> and I'm still getting the varchars in UTF-8 (connection charset). So
> it probably has different purpose?
>
>
This method changes the connection charset whiling the execute/open
method is in progress.

It does not change how parameters are described.

I suppose you can use ExternalEngine::getCharSet to change the default
charset to map parameters.


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
|  
Report Content as Inappropriate

Re: Charset in IExternalProcedureImpl

Jiří Činčura-2
> This method changes the connection charset whiling the execute/open
> method is in progress.

What is this good for?
 
> It does not change how parameters are described.
>
> I suppose you can use ExternalEngine::getCharSet to change the default
> charset to map parameters.

You mean IMetadataBuilder, right?

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

------------------------------------------------------------------------------
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
|  
Report Content as Inappropriate

Re: Charset in IExternalProcedureImpl

Adriano dos Santos Fernandes-3
On 01/08/2017 02:52, Jiří Činčura wrote:
>> This method changes the connection charset whiling the execute/open
>> method is in progress.
> What is this good for?
>  

When an attachment runs external code, it may be in three different
"states":
- User (client) code (PSQL / SQL)
- Plugin management code (it may use user's attachment)
- User (server) code called from plugin

Each of these states may be completely different beasts, so require
customization of connection charset.

>> It does not change how parameters are described.
>>
>> I suppose you can use ExternalEngine::getCharSet to change the default
>> charset to map parameters.
> You mean IMetadataBuilder, right?
>
I mean ExternalEngine::getCharSet, the function to set connection
charset for plugin management code.

If you set charset there, I suppose IMessageMetadata will be already in
its charset, but I'm not looking in the code and may be wrong.

But of course, you can use IMetadataBuilder.


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
|  
Report Content as Inappropriate

Re: Charset in IExternalProcedureImpl

Jiří Činčura-2
> I mean ExternalEngine::getCharSet, the function to set connection
> charset for plugin management code.

I see getCharSet on IExternalProcedureImpl only. Nothing on
IExternalEngineImpl. :\

Anyway. I have there strncpy(name, "UTF-8", nameSize);, nothing else...

> If you set charset there, I suppose IMessageMetadata will be already in
> its charset, but I'm not looking in the code and may be wrong.

...and still in IExternalProcedureImpl::open I get length==1 for
"character set ascii" parameter. I'll throw an exception when it's not
UTF8 and that's it. I'll not burn my time on this any more.

> But of course, you can use IMetadataBuilder.

Yeah. Not really. If I change charset I have to change the length myself
as well and I don't know the bytes per char for original charset.

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

------------------------------------------------------------------------------
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
Loading...