#13809 [Fbk->NoF]: Openlink 3.2 and 4.0 odbc_do and single quotes

From: Date: Tue, 04 Feb 2003 07:00:04 +0000
Subject: #13809 [Fbk->NoF]: Openlink 3.2 and 4.0 odbc_do and single quotes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32041@lists.php.net to get a copy of this message
ID: 13809 Updated by: php-bugs@lists.php.net Reported By: Grant.Walters@walters.co.nz -Status: Feedback +Status: No Feedback Bug Type: ODBC related Operating System: SCO Openserver 5.0.5 & RH Lnux 7 PHP Version: 4.0.6 New Comment: No feedback was provided for this bug for over 2 weeks, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". Previous Comments: ------------------------------------------------------------------------ [2003-01-19 19:00:14] kalowsky@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Removing ahill assigned to status, and asking to try a newer version ------------------------------------------------------------------------ [2002-05-22 15:22:24] kalowsky@php.net Assigning to Andrew ------------------------------------------------------------------------ [2002-05-13 18:18:18] kalowsky@php.net did some examination on this, and I believe it lies in the OpenLink software... as I see the same problem here, but not on my Windows emulation. Andrew any chance you can take a look into this further? ------------------------------------------------------------------------ [2001-10-24 05:19:44] Grant.Walters@walters.co.nz Came across this issue when doing my data conversions. If the fields have single quotes in them, odbc_do fails. I have tested this against the Openlink 3.2 and 4.1 SDK's and found that using odbc_prepare works fine. Basic Script ------------ <? $conn = odbc_connect("$dsn","","","$cursor"); $sql="SELECT ID,Category,description FROM card_type WHERE description='IMPEYS'"; echo "<BR><b>SQL:</b> $sql<BR>"; $results = odbc_do($conn,$sql); if ($results) { while (odbc_fetch_into($results,$row)) { echo $row[0]." ".$row[1]." ".$row[2]."\n"; } } $sql="SELECT ID,Category,description FROM card_type WHERE description LIKE '%PEP%'"; echo "<BR><b>SQL:</b> $sql<BR>"; $results = odbc_do($conn,$sql); if ($results) { while (odbc_fetch_into($results,$row)) { echo $row[0]." ".$row[1]." ".$row[2]."\n"; } } $sql='SELECT ID,Category,description FROM card_type WHERE description LIKE "%PEP%"'; echo "<BR><b>SQL:</b> $sql<BR>"; $results = odbc_do($conn,$sql); if ($results) { while (odbc_fetch_into($results,$row)) { echo $row[0]." ".$row[1]." ".$row[2]."\n"; } } $sql='SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL\'S"'; echo "<BR><b>SQL:</b> $sql<BR>"; $results = odbc_do($conn,$sql); if ($results) { while (odbc_fetch_into($results,$row)) { echo $row[0]." ".$row[1]." ".$row[2]."\n"; } } $sql="SELECT ID,Category,description FROM card_type WHERE description=\"PEPPERELL'S\""; echo "<BR><b>SQL:</b> $sql<BR>"; $results = odbc_do($conn,$sql); if ($results) { while (odbc_fetch_into($results,$row)) { echo $row[0]." ".$row[1]." ".$row[2]."\n"; } } /* Output ------ SQL: SELECT ID,Category,description FROM card_type WHERE description='IMPEYS' 355 Other Item IMPEYS SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE '%PEP%' 177 Other Item PEPPERELL'S SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE "%PEP%" Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect in /usr/local/.WWW/WEBS/_odbc/test.php3 on line 42 SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S" Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect in /usr/local/.WWW/WEBS/_odbc/test.php3 on line 50 SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S" Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in SQLExecDirect in /usr/local/.WWW/WEBS/_odbc/test.php3 on line 58 */ ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=13809&edit=1

« previous php.bugs (#32041) next »