Dmitry Yemanov wrote:
> You are confused by what a parameter is. Look:
> "Param1" VARCHAR(80) CHARACTER SET WIN1252 = ?
> "Param1" is a PSQL parameter while ? is a DSQL parameter. The
> latter is filled by your application and assigned to the
> former inside the engine. Adriano was speaking about the
> latter.
> You declare the datatype of the PSQL parameter, but the DSQL
> parameter is always described using the attachment charset,
> because user applications explicitly specify the attachment
> charset to process all input and output data -- this is a
> contract the engine cannot ignore. You want to pass one
> parameter as UTF8 and another one as WIN1252, then use NONE
> as the attachment charset and handle everything yourself.
Actually, this was exactly my point. Notice that my example
code never actually processed anything given to it by the
client.
The DSQL parameter is supposed to filled according to client
connection rules, but the PSQL parameter should (I would have
thought) obeyed the normal rules for PSQL - ie. would behave
as declared, just as it is for stored procedure parameters.
This is certainly what the documentation led me to believe
would happen, and what the appearances of the code would make
me expect.
If I gave you this stored procedure:
CREATE PROCEDURE ThisWillFail (
"Param1" VARCHAR(80) CHARACTER SET WIN1252
) RETURNS (
"Result" VARCHAR(255) CHARACTER SET UTF8
) AS
DECLARE TmpUtf8 VARCHAR(20) CHARACTER SET UTF8;
BEGIN
TmpUtf8 = _utf8 x'C690';
"Result" = TmpUtf8;
SUSPEND;
"Param1" = TmpUtf8; -- <<< Expect Error Here
"Result" = "Param1";
SUSPEND;
END
You would expect "Param1" to have a character set of WIN1252
inside the code, regardless of the connection character set.
And it does.
It is the fact that EXECUTE BLOCK silently changes the PSQL
declaration that concerns me.
If there are reasons why it must, then the documentation
should make it obvious.
--
Geoff Worboys
Telesis Computing Pty Ltd
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel