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 1DmlIM-0001hw-Ux for garchives@archives.gentoo.org; Mon, 27 Jun 2005 04:32:31 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j5R4VDM8014605; Mon, 27 Jun 2005 04:31:13 GMT Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j5R4SdEH018384 for ; Mon, 27 Jun 2005 04:28:39 GMT Received: by zproxy.gmail.com with SMTP id 8so162537nzo for ; Sun, 26 Jun 2005 21:28:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=c/9zJlsse2J11AxzVx1ve7F9Wu60Z4j6nvKV6LoaP0sTQtxGVjT2RxX9JkP9thIJBEz3YoCe5CRK/Rsgz73X56qrBVnSjTtp4Bk51WXRPnbQyW8BYaajZQODjQf23fg3Ixv96wo2ZiuedaylQhQmus8kp4xeXgFgqvrskWe8s1k= Received: by 10.36.222.46 with SMTP id u46mr4188807nzg; Sun, 26 Jun 2005 21:28:55 -0700 (PDT) Received: from ?192.168.0.2? ([68.101.114.219]) by mx.gmail.com with ESMTP id c12sm867462nzc.2005.06.26.21.28.52; Sun, 26 Jun 2005 21:28:55 -0700 (PDT) Message-ID: <42BF8085.1010206@gmail.com> Date: Sun, 26 Jun 2005 21:28:53 -0700 From: Zac Medico User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050624) X-Accept-Language: en-us, en 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 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] DBD-mysql select failures with MySQL 4.1 References: <200506262055.54827.agorecki@ectrolinux.com> In-Reply-To: <200506262055.54827.agorecki@ectrolinux.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: ccf7fba0-113f-4b76-b76c-9e97e3c9b7e2 X-Archives-Hash: 8ae3f0203f18669a402aeb2f8fc9bb15 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 = DBI->connect('DBI:mysql:infrastructure', 'system', 'readonly'); > if (!$db_conn) { > error('The program was unable to connect to the database.'); > } > > $_ = $db_conn->selectrow_array(" > SELECT \@user_id := ( > SELECT user_id FROM users WHERE username = '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-mysql > returns undefined. Similarly, when I run: > > SELECT type > FROM svn_access > WHERE 'test' REGEXP REPLACE(path_regex, '\$USERNAME\$', 'agorecki') = 1 > AND (user_id = @user_id > OR group_id = ANY (SELECT group_id FROM group_memberships WHERE > user_id = @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 also > receive an undefined result. The above query correctly returns one row when > input into a MySQL console and executed. > > The only thing that actually managed to execute and return a value > successfully was: > $_ = $db_conn->selectrow_array("SELECT 'hello';"); > > Any thoughts? > > Have you checked the DBI error status? See the parts about $DBI::err, $DBI::errstr, and RaiseError here: http://search.cpan.org/~timb/DBI-1.48/DBI.pm Zac -- gentoo-dev@gentoo.org mailing list