[freetds] Image Data converted to Text/String out of MSSQL??

Andrew Atkinson andrewatkinson at mbox.com.au
Sat Mar 8 17:39:16 EST 2003


Hi,

Hope you can help with this one:

I would like to stop FreeTDS converting image data from a MSSQL Server
DB to a string.  I am trying to display an image from a MSSQL DB in a
browser but the data is just appearing as a long string of hex.  The
source datatype in the database is of type "IMAGE".  I have set text
size in freetds.conf to about 64k.  The image is about 11k (see from
freetds.log below).  I don't believe that this is the cause of the
problem.  I am using TDS V8.0 (built and set in freetds.conf).

My environment is as follows:
Win2K
   MS SQL Server 2000
Linux - Redhat 7.3
   Apache 1.3.27
   OpenSSL 0.9.7a
   PHP 4.3.1
   FreeTDS 0.61

If I look at the debug in freetds.log I can see the data comming across
from MSSQL as binary.  dbconvert() then converts this SYBIMAGE (34) to
SYBCHAR (47).  This is exactly what I want to stop.  See freetds.log below. 

Can I stop behaviour this by altering tds_willconvert() or tdsconvert.h,
or is there a more sensible way of doing it??


0a20  c2 0f fd 06 ea bf 5d bc  2b ff 00 20 6d 2b fe bd   |Â.ý.ê¿]¼ +ÿ. m+þ½|
0a30  47 f2 86 ba 31 f8 7a 78  4c 4f b2 a0 e5 4d 46 31   |Gò.º1øzx LO² åMF1|
0a40  77 8c 9c 25 bc 96 ae 1c  ad ad 36 7a 7c b4 3c fc   |w..%¼.®. ­­6z|´<ü|
0a50  6e 1e 96 12 a5 3f ab a7  4f 9a 32 6e d2 96 f1 71   |n...¥?«§ O.2nÒ.ñq|
0a60  b5 9d ef a5 fd 36 ec 7e  6b 78 df fe 09 8d f0 f6   |µ.ï¥ý6ì~ kxßþ..ðö|
0a70  14 37 5e 10 f8 a3 e3 6d  10 16 8d 56 df c4 5a 4e   |.7^.ø£ãm ...VßÄZN|
0a80  87 e2 a4 54 95 49 71 1c  da 7b 78 7e 44 06 35 51   |.â¤T.Iq. Ú{x~D.5Q|
0a90  89 7e d0 41 dc 77 12 ec  4f cf 7f 15 bf e0 9d 3e   |.~ÐAÜw.ì OÏ..¿à.>|
0aa0  22 f0 07 83 35 2f 1a f8  6b e2 66 87 e2 3b 1f 0f   |"ð..5/.ø kâf.â;..|
0ab0  d8 ae a3 ad 69 da d7 87  af fc 2d 78 2d fc 8f b4   |Ø®£­iÚ×. ¯ü-x-ü.´|
0ac0  39 d3 ae b4 ed 43 5b 8a  fe 62 0e 04 57 10 d9 aa   |9Ó®´íC[. þb..W.Ùª|
0ad0  92 d8 94 67 8f db 8f 13  7f c7 8a fd 6d ff 00 f4   |.Ø.g.Û.. .Ç.ýmÿ.ô|
0ae0  4b 57 8e fc 79 ff 00 92  0b f1 3b fe c5 5f fd c6   |KW.üyÿ.. .ñ;þÅ_ýÆ|
0af0  ad 71 54 cc b1 f8 69 d1  54 f1 53 71 9c a0 a5 19   |­qṮøiÑ TñSq. ¥.|
0b00  da 69 ae 58 ab 5e 49 cb  bb f8 af 76 f5 b6 87 25   |Úi®X«^IË »ø¯võ¶.%|
0b10  3c 45 68 ca 2b da 36 94  92 b3 d7 47 51 c7 5b f9   |<EhÊ+Ú6. .³×GQÇ[ù|
0b20  23 f9 79 59 3c c0 ac a0  80 c8 ed 83 c6 70 9b dd   |#ùyY<À¬  .Èí.Æp.Ý|
0b30  b6 0f 95 3e 40 14 22 8c  63 e5 24 a8 c1 f4 df 84   |¶..>@.". cå$¨Áôß.|
0b40  72 32 7c 54 f8 73 e5 85  5c 78 ff 00 c2 f0 a8 00   |r2|Tøså. \xÿ.Âð¨.|
0b50  05 12 1d 6f 4e 39 38 19  f2 58 a3 65 39 c0 20 7c   |...oN98. òX£e9À ||
0b60  c0 0d be 5b 07 fa b8 bf  eb 84 bf fa 4f 5e 9d f0   |À.¾[.ú¸¿ ë.¿úO^.ð|
0b70  93 fe 4a a7 c3 9f fb 29  3e 15 ff 00 d3 dd 9d 7d   |.þJ§Ã.û) >.ÿ.ÓÝ.}|
0b80  c4 9b 78 49 49 e8 e5 19  dd fa 46 56 fb b9 55 bb   |Ä.xIIèå. ÝúFVû¹U»|
0b90  74 3d 39 fc 13 5d 1c 5a  7f 34 7f ff d9 fd 10 00   |t=9ü.].Z .4.ÿÙý..|
0ba0  c1 00 01 00 00 00                                  |Á.....|


2003-03-08 15:31:57.740995 leaving dbnextrow() returning -1
2003-03-08 15:31:57.741064 dbdatlen() type = 34
2003-03-08 15:31:57.741082 leaving dbdatlen() returning 11082
2003-03-08 15:31:57.741105 inside tds_willconvert()
2003-03-08 15:31:57.741122 inside tds_willconvert() 34 47 1
2003-03-08 15:31:57.741139 dbdatlen() type = 34
2003-03-08 15:31:57.741154 leaving dbdatlen() returning 11082
2003-03-08 15:31:57.741282 inside dbconvert() srctype = 34 desttype = 47
2003-03-08 15:31:57.741307 inside dbconvert() calling tds_convert
2003-03-08 15:31:57.749205 inside dbconvert() outputting 22164 bytes
character data destlen = 22164
2003-03-08 15:31:57.749281 inside dbnextrow()
2003-03-08 15:31:57.749304 processing row tokens.  marker is  fd(DONE)
2003-03-08 15:31:57.749363 inside tds_process_end() more_results = 0,
was_cancelled = 0
2003-03-08 15:31:57.749383 leaving dbnextrow() returning -2

Thanks,
Andrew

PS.  The image displays perfectly if I run Apache, PHP, MSSQL all on Win2K.






---------------------------------------------------------------------
Faxes delivered directly to any email address, new to mBox!
Find out more http://www.mbox.com.au/fax


More information about the FreeTDS mailing list