Re: Weird result set from PEAR's DB

From: Date: Tue, 29 Mar 2005 22:52:14 +0000
Subject: Re: Weird result set from PEAR's DB
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36970@lists.php.net to get a copy of this message
The only thing differing between the two is one is PPC and the other is x86. I can reproduce the bug by copying and pasting the query into my x86 mysql terminal client as well. PPC: jstump@Joseph-Stumps-Computer enotes$ mysql --version mysql Ver 14.7 Distrib 4.1.10a, for apple-darwin7.7.0 (powerpc) jstump@Joseph-Stumps-Computer enotes$ uname -a Darwin Joseph-Stumps-Computer.local 7.8.0 Darwin Kernel Version 7.8.0: Wed Dec 22 14:26:17 PST 2004; root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC Power Macintosh powerpc x86: noc@poweredge:~$ mysql --version mysql Ver 14.7 Distrib 4.1.7, for pc-linux (i686) noc@poweredge:~$ uname -a Linux poweredge 2.4.26-bf2.4 #1 SMP Wed May 26 08:34:11 PDT 2004 i686 GNU/Linux noc@poweredge:~$ Oddly enough, if I remove \n's from the query string it works fine: $sql = "SELECT *
	    FROM users
	    WHERE username='foo@example.com'";
to: $sql = "SELECT * FROM users WHERE username='foo@example.com'"; That fixes the problem as well as adding the DB name before the table (eg. users -> mydb.users). Very odd stuff here. --Joe -- Joseph C. Stump joe@joestump.net http://www.joestump.net On Mar 29, 2005, at 12:52 PM, Justin Patrin wrote:
On Tue, 29 Mar 2005 11:57:15 -0800, Joe Stump <joe@joestump.net> wrote:
BTW, to anyone who cares. I can copy and past the query from echo '<pre>'.$sql.'</pre> into my mysql terminal and it returns boned results in both the linux and OSX client. This appears to be a strange mysql bug of some sort. To add to the oddness my query doesn't show any out of the ordinary characters in it when I open it in bvi. Also, this query fails: SELECT *
                 FROM users
                 WHERE userID='0'
While this query written into the term by hand works: select * from users where userID='0' *VERY* odd ...
Sounds like perhaps your client library doesn't match the version of the server. If your server is 4.1 and the client is 4.0 something like this could possibly happen...
--Joe -- Joseph C. Stump joe@joestump.net http://www.joestump.net On Mar 29, 2005, at 11:34 AM, Joe Stump wrote:
There is no error. The array I showed you is the result of my $result->fetchRow(). Everything works fine, except that the keys are completely boned. I've tracked the problem down further and found that the raw response from the line in DB_mysql::fetchInto() is returning a boned array:
            $arr = @mysql_fetch_array($result, MYSQL_ASSOC);
A print_r on $arr gives me this: Array (
    [@] => 1
    [
@] => joe@joestump.net
    [] => 1
    [ @] => 1
) Other queries work just fine. It's quite strange. --Joe -- Joseph C. Stump joe@joestump.net http://www.joestump.net On Mar 29, 2005, at 11:03 AM, Daniel Convissor wrote:
On Tue, Mar 29, 2005 at 10:58:37AM -0800, Joe Stump wrote:
Oddly enough changing the query from: SELECT * FROM users WHERE username='foo@example.com' to: SELECT * FROM mydb.users WHERE username='foo@example.com'
And what happens when you check the result for errors? $res =& $db->query("SELECT * FROM users WHERE username='foo@example.com'"); if (DB::isError($res)) {
    echo $res->getDebugInfo() . "\n";
} else {
    echo "The query ran fine\n";
} --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.dev (#36970) next »