Skip to Content.
Sympa Menu

freetds - Retrieving binary fields with FreeBSD 4.4/PHP 4.1.1

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Freddy Vulto" <f.vulto AT re-base.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Retrieving binary fields with FreeBSD 4.4/PHP 4.1.1
  • Date: Thu, 17 Jan 2002 11:20:06 -0500


Configuration: FreeBSD 4.4/PHP 4.1.1/Apache 1.3.22/FreeTDS 0.53 connecting
to database server Windows 2000/SQL Server 2000.

When selecting the value of a binary field, PHP returns me the binary data
converted to a hexadecimal string truncated to the number of bytes of the
binary field. For example, with binary fields 'bin1..bin8' of size 1..8
bytes respectively and containing data '0x11', '0x1122', '0x112233', etc.,
the 'SELECT' commands return me the *strings*:

bin1: "0" /* SELECT bin1 ... */
bin2: "0x" /* SELECT bin2 ... */
bin3: "0x0" /* SELECT bin3 ... */
bin4: "0x11" /* SELECT bin4 ... */
bin5: "0x112" /* SELECT bin5 ... */
bin6: "0x1122" /* SELECT bin6 ... */
bin7: "0x11223" /* SELECT bin7 ... */
bin8: "0x112233" /* SELECT bin8 ... */

When running the same PHP script from my local server (Win 98/PHP
4.1.1/Apache 1.3.22), without FreeTDS, I receive the binary data just
fine. That is, after PHP's 'bin2hex()' the data is:

bin1: "11"
bin2: "1122"
bin3: "112233"
bin4: "11223344"
bin5: "1122334455"
bin6: "112233445566"
bin7: "11223344556677"
bin8: "1122334455667788"

Am I overlooking something obvious with FreeTDS? Anyone experiencing the
same problems?

TIA, Freddy Vulto



  • Retrieving binary fields with FreeBSD 4.4/PHP 4.1.1, Freddy Vulto, 01/17/2002

Archive powered by MHonArc 2.6.24.

Top of Page