Re: FreeTDS and PHP: empty strings and NVARCHAR
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4f+aBVTqqa2scJ_UrOpPWvmed+aE_UaMKNpmw=M-n3bWw@mail.gmail.com> |
2011/7/9 Mattia <[email protected]>: > 2011/7/7 Frediano Ziglio <[email protected]>: >> our dblib should convert to >> SYBVARCHAR and PHP should be happy with given varchar... If this is >> not true we should fix FreeTDS dblib instead. > > If a nvarchar string is passed as a simple varchar and this string > contains strange > characters (like Č), sql server will insert an empty string in that field. > > Microsoft says[1] that nvarchar is type 0xE7 which is defined as > XSYBNVARCHAR in freetds. > Yes, but not in dblib documentation. The document you refer is protocol documentation. > 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? >>> 3. The freetds092_with_nvarchar.patch (against php 5.3.6 stable) fixes a >>> redefinition of type LBYTE to work with actual Freetds cvs and adds support >>> for type SQLNVARCHAR (to use with mssql_bind function). >>> >> >> This is a PHP patch, I think you should split patch and send them. > > I wanted to put all patches here to provide a fully working solution. > > > [1] http://download.microsoft.com/download/a/e/6/ae6e4142-aa58-45c6-8dcf-a657e5900cd3/%5BMS-TDS%5D.pdf > > -- > Mattia Frediano _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds