freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures
- Date: Thu, 12 Jun 2008 00:06:20 -0400
Jason Young (Morgon) wrote:
> perhaps it's simply a lack of NVARCHAR in the php_mssql
> library, but I cannot send UTF8 data to SQL Server using
> mssql_init/bind/execute - yet it's not a general fault in my setup, as I
>
> can "EXEC blah N'<UTF Text>'" just fine.
In the case of "EXEC blah N'<UTF Text>'", the data are embedded in the SQL
text, which is converted to UCS-2 in libtds just before it's put on the
wire. I'm not sure what, if anything, "N'foo'" does for you; I would
think "'foo'" would work just as well.
In the case of dbrpcparam(), you're stuffing the data into a buffer and
telling the library the datatype. I'm not sure what happens -- I haven't
looked yet -- but *if* any conversion is done, it would be in libtds
during dbrpcsend().
It's a little tricky because dbrpcparam() accepts VARCHAR and NVARCHAR
parameters. The libtds function that reads the parameter buffer must
distinguish between (VAR)CHAR, which should be converted, and N(VAR)CHAR,
which is by definition UCS-2 (and doesn't need to be and can't be
converted).
src/dblib/unittests/rpc.c needs to be enhanced to test this feature, to
make sure we get it right. Patches welcome!
--jkl
-
[freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures,
Jason Young (Morgon), 06/07/2008
- Re: [freetds] Using PHP mssql_init/bind for sending Unicode to StoredProcedures, Thomas, Christopher (LLU), 06/09/2008
-
Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures,
James K. Lowden, 06/12/2008
-
Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures,
ZIGLIO, Frediano, VF-IT, 06/12/2008
- Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures, James K. Lowden, 06/14/2008
-
Re: [freetds] Using PHP mssql_init/bind for sending Unicode to Stored Procedures,
ZIGLIO, Frediano, VF-IT, 06/12/2008
Archive powered by MHonArc 2.6.24.