Re: FreeTDS and PHP: empty strings and NVARCHAR
Mattia <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CA+heTbqg-dved27zgX1VsD=nEEk6nFNBN4z7dChnhoUBmERnFA@mail.gmail.com> |
2011/7/11 Frediano Ziglio:
> 2011/7/9 Mattia:
>> So,
>> with SYBVARCHAR an empty string is inserted (in presence of strange characters);
>> with SYBNVARCHAR, sql server throws an error (unknown data type)
>> with XSYBNVARCHAR, everything works perfectly.
>>
>
> Could you provide a simple PHP code which demonstrate the problem?
> Have you the problem inserting data or fetching them? Did you setup
> correctly client charset?
>
The problem is inserting data. Fetching them works fine.
Client charset is UTF-8.
Php code is pretty simple:
<?php
$conn = mssql_connect($hostname, $db_user, $db_pass ) or die ( "Unable
to connect" );
mssql_select_db($db_name) or die("$db_name not found");
$an_id = 1;
$the_string="This would result Ő in an empty string";
$stmt = mssql_init('My_Stored_Proc');
mssql_bind ($stmt, '@string', $the_string, SQLVARCHAR, false, false);
mssql_bind($stmt, '@id', $an_id, SQLINT4, false, false);
$result=mssql_execute($stmt) or die('Stored proc execution failed');
mssql_free_statement($stmt);
mssql_close($conn);
?>
Id gets inserted and mssql_execute returns true. The string is empty.
Db is a Sql 2008 R2 Web Edition (with the standard edition is the same).
--
Mattia
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds