Bug #2117: odbc_exec and odbc_execute err out

From: Date: Fri, 20 Aug 1999 18:40:41 +0000
Subject: Bug #2117: odbc_exec and odbc_execute err out
Groups: php.dev 
Request: Send a blank email to php-dev+get-10041@lists.php.net to get a copy of this message
From: mike@crt.net Operating system: NT 4 Sp 4 PHP version: 3.0.11 PHP Bug Type: ODBC related Bug description: odbc_exec and odbc_execute err out I have a binary distribution of 3.0.11 which dies on a certain ODBC query. None of the other bug reports I found have helped me alleviate this problem. ODBC works fine on any basic query although it errors out on complex queries. This query runs perfectly on 3.0RC3 but fails miseralbly on 3.0.6 and 3.0.11 which leads me to believe there is a Php problem. I can also run this query directly on the server (MS SQL 6.5) or via Cold Fusion without any problems. My ODBC log tells me that it exits SQLFreeStmt fine, but returns an error from SQLExecute. My MS ODBC drivers are at the current version (3.5) Basic code: $conn = odbc_connect("<db>", "<username>", "<password>"); // returns positive connection id $result = odbc_exec($conn, $select_stmt); // errs out or $conn = odbc_connect("<db>", "<username>", "<password>"); // returns positive connection id $prepare_result = odbc_prepare($conn,$select_stmt); // returns positive result id $result = odbc_execute($prepare_result); // errs out Different values for $select_stmt and their corresponding results under 3.0.6 and 3.0.11: 1. Simple query $select_stmt="SELECT coupons.cpn_org_code, coupons.cpn_effective_through, coupons.cpn_url FROM Coupons WHERE Coupons.cpn_effective_start<=getDate() AND Coupons.cpn_effective_through>=getDate() ORDER BY Coupons.cpn_org_code"; No error! --- 2. Medium query $select_stmt="SELECT neworg.org_name, neworg.org_url, neworg.org_addr_1, neworg.org_addr_2, neworg.org_addr_3, neworg.org_city, neworg.org_state, neworg.org_zip, neworg.org_phone_1 FROM newtxt, neworg WHERE newtxt.txt_description LIKE '%test%' ORDER BY newtxt.txt_sequence"; Error: Warning: SQL error: [Microsoft][ODBC SQL Server Driver]Cursor type changed, SQL state 01S02 in SQLExecute in C:\public\phpdb.samsa.com\admin\maintorgs\dspcpnsch.php3 on line 72 --- 3. Complex query $select_stmt="SELECT coupons.cpn_org_code, coupons.cpn_effective_through, coupons.cpn_url, newtxt.txt_description, neworg.org_name, neworg.org_url, neworg.org_addr_1, neworg.org_addr_2, neworg.org_addr_3, neworg.org_city, neworg.org_state, neworg.org_zip, neworg.org_phone_1 FROM (Coupons INNER JOIN newtxt ON (coupons.cpn_org_code = newtxt.txt_org_code) AND (Coupons.cpn_sequence = newtxt.txt_sequence)) INNER JOIN neworg on coupons.cpn_org_code = neworg.org_code WHERE (coupons.cpn_active_='Y' AND Coupons.cpn_effective_start<=getDate() AND Coupons.cpn_effective_through>=getDate() AND newtxt.txt_type='CPN' AND newtxt.txt_description LIKE '%test%') ORDER BY Coupons.cpn_org_code, newtxt.txt_sequence"; Error: Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]WARNING - Fatal Error 602 occurred at Aug 20 1999 2:20PM. Please note the error and time, and contact your System Administrator., SQL state S1000 in SQLExecute in C:\public\phpdb.samsa.com\admin\maintorgs\dspcpnsch.php3 on line 65 Thanks in advance, Mike Reed

« previous php.dev (#10041) next »