[freetds] PHP script dies when performing a query containing CASTor CONVERT

Thompson, Bill D (London) bill_d_thompson at ml.com
Fri Oct 14 11:13:49 EDT 2005


...And the log stops there ?

I suspect it's not the cast that's the problem, it's the resulting float
datatype.
You are happily getting results back from the server, just not
processing them correctly.

I can't see any call to dbbind(), which you would have to make to get
the returned value back into your program.
dbbind would usually be called between dbresults() and dbnextrow()
I don't know how PHP calls the various dblibrary functions though.

Is this a clue ?

Bill



-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] 
Sent: 14 October 2005 17:06
To: freetds at lists.ibiblio.org
Subject: [freetds] PHP script dies when performing a query containing
CASTor CONVERT


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... at 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 mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------


More information about the FreeTDS mailing list