From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.105.134.102] (helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1Dms3Y-0007d0-GH for garchives@archives.gentoo.org; Mon, 27 Jun 2005 11:45:40 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j5RBih91004986; Mon, 27 Jun 2005 11:44:43 GMT Received: from lakermmtao08.cox.net (lakermmtao08.cox.net [68.230.240.31]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j5RBh6Q4006028 for ; Mon, 27 Jun 2005 11:43:07 GMT Received: from [172.16.1.202] (really [68.110.242.20]) by lakermmtao08.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050627114325.HJDM18139.lakermmtao08.cox.net@[172.16.1.202]> for ; Mon, 27 Jun 2005 07:43:25 -0400 From: Michael Cummings To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] DBD-mysql select failures with MySQL 4.1 Date: Mon, 27 Jun 2005 07:40:37 -0400 User-Agent: KMail/1.8 References: <200506262055.54827.agorecki@ectrolinux.com> In-Reply-To: <200506262055.54827.agorecki@ectrolinux.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart21548216.eiVuhVc2NG"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200506270740.37609.mcummings@gentoo.org> X-Archives-Salt: fcacbb7c-ccee-42af-b0e7-9bc6adf93e47 X-Archives-Hash: 462c1280818920c517fb46e575d043bd --nextPart21548216.eiVuhVc2NG Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Take this to gentoo-perl@gentoo.org (I'm just getting back from vacation, r= eal=20 responses delayed until we finish getting everything back in order at the=20 house). First recommendation is of course, don't try to assign something to= =20 $_ directly, but maybe that's just my personal take (I'd have used another= =20 var, any other var). On Sunday 26 June 2005 23:55, Anthony Gorecki wrote: > Hello, > > I've been encountering an unusual string of errors while attempting to > retrieve information from a database using DBD-mysql-2.9007 and > mysql-4.1.12. The database in question is of type InnoDB. Below is an > example: > > #!/usr/bin/perl -w > > use strict; > use DBI; > > my $db_conn =3D DBI->connect('DBI:mysql:infrastructure', 'system', > 'readonly'); if (!$db_conn) { > error('The program was unable to connect to the database.'); > } > > $_ =3D $db_conn->selectrow_array(" > SELECT \@user_id :=3D ( > SELECT user_id FROM users WHERE username =3D 'agorecki' LIMIT 1) > ); > "); > > if (!defined($_)) { > $db_conn->disconnect(); > error('It appears that the user account has disappeared since login '. > 'time...' > ); > } > > > The same query in MySQL will return the session variable, however DBD-mys= ql > returns undefined. Similarly, when I run: > > SELECT type > FROM svn_access > WHERE 'test' REGEXP REPLACE(path_regex, '\$USERNAME\$', 'agorecki') =3D 1 > AND (user_id =3D @user_id > OR group_id =3D ANY (SELECT group_id FROM group_memberships WHERE > user_id =3D @user_id) > OR (user_id IS NULL AND group_id IS NULL) > ) > ORDER BY type DESC LIMIT 1; > > > through selectrow_array (properly encoded for use in a PERL script), I al= so > receive an undefined result. The above query correctly returns one row wh= en > input into a MySQL console and executed. > > The only thing that actually managed to execute and return a value > successfully was: > $_ =3D $db_conn->selectrow_array("SELECT 'hello';"); > > Any thoughts? =2D-=20 =2D----o()o--------------------------------------------- Michael Cummings | #gentoo-dev, #gentoo-perl Gentoo Perl Dev | on irc.freenode.net=20 =2D----o()o--------------------------------------------- --nextPart21548216.eiVuhVc2NG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCv+W1q1ztTp5/Ti4RApi9AKCDGqce/85fqGV/fDrjFcLz1ydw6wCdFyok r0Np1tt1aK+TgSJIYlAx5rA= =2JzH -----END PGP SIGNATURE----- --nextPart21548216.eiVuhVc2NG-- -- gentoo-dev@gentoo.org mailing list