Skip to Content.
Sympa Menu

freetds - [freetds] PHP script dies when performing a query containing CAST or CONVERT

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "" <Murray.Elliot AT sac.co.uk>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] PHP script dies when performing a query containing CAST or CONVERT
  • Date: Fri, 14 Oct 2005 16:05:59 +0000

I have a rather frustrating problem with php/freetds

freetds: 0.63
php: 4.4.0
apache: 2.0.54
Web Platform: Solaris 9
DB Platform: SQL 2000 on Windows NT OS

Symptom:

performing a query such as

SELECT AVG(cast(wr.gstage as float)) as gstage from WeekReport wr

kills the script stone dead (resulting in a "the page cannot be displayed"
browser
message).

Whereas SELECT AVG(wr.cplant) as cplant from WeekReport wr

works fine (I DO need to do the cast).

The log looks like this:

15:59:26.134524 Sending packet
0000 01 01 00 5a 00 00 00 00-53 45 4c 45 43 54 20 61 |...Z.... SELECT a|
0010 76 67 28 63 61 73 74 28-77 72 2e 67 73 74 61 67 |vg(cast( wr.gstag|
0020 65 20 61 73 20 66 6c 6f-61 74 29 29 20 61 73 20 |e as flo at)) as |
0030 67 73 74 61 67 65 0d 0a-20 20 20 20 20 20 20 20 |gstage.. |
0040 20 20 20 20 20 20 20 20-66 72 6f 6d 20 57 65 65 | from Wee|
0050 6b 52 65 70 6f 72 74 20-77 72 |kReport wr|

15:59:26.134660 in dbsqlok()
15:59:26.161323 Received header
0000 04 01 00 2e 00 35 01 00- |.....5..|

15:59:26.161357 Received packet
0000 a0 00 07 06 67 73 74 61-67 65 a1 00 06 00 0e 00 |....gsta ge......|
0010 09 6d 08 d1 08 40 45 e5-7b 75 a9 d4 5a fd 00 10 |.m...@E. {u..Z...|
0020 00 c1 00 00 00 01 - |......|

15:59:26.161409 dbsqlok() marker is a0
15:59:26.161421 dbsqlok() found result token
15:59:26.161432 dbresults()
15:59:26.161441 tds_free_all_results()
15:59:26.161452 processing result tokens. marker is a0(COLNAME)
15:59:26.161464 tds_get_string: reading 6 from wire to give 6 to client.
15:59:26.161475 tds_free_all_results()
15:59:26.161492 processing result tokens. marker is a1(COLFMT)
15:59:26.161505 processing result. type = 109(float-null), varint_size 1
15:59:26.161517 dbresults() process_result_tokens returned result_type = 4049
retcode = 1
15:59:26.161528 processing result tokens. marker is d1(ROW)
15:59:26.161538 dbresults() process_result_tokens returned result_type = 4040
retcode = 1
15:59:26.161548 dbnextrow()
15:59:26.161558 dbnextrow() dbresults_state = 2
15:59:26.161567 processing row tokens. marker is d1(ROW)
15:59:26.161578 processing row. column is 0 varint size = 1
15:59:26.161588 processing row. column size is 8
15:59:26.161598 clearing column 0 NULL bit
15:59:26.161609 leaving dbnextrow() returning -1
15:59:26.161623 dbdatlen() type = 109
15:59:26.161633 leaving dbdatlen() returning 8

Any help would be gratefully received as this is driving me mad..

Thanks in advance



  • [freetds] PHP script dies when performing a query containing CAST or CONVERT, , 10/14/2005

Archive powered by MHonArc 2.6.24.

Top of Page