From: Anthony Gorecki <agorecki@ectrolinux.com>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] DBD-mysql select failures with MySQL 4.1
Date: Sun, 26 Jun 2005 20:55:51 -0700 [thread overview]
Message-ID: <200506262055.54827.agorecki@ectrolinux.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
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?
--
Anthony Gorecki
Ectro-Linux Foundation
[-- Attachment #2: Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2005-06-27 4:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-27 3:55 Anthony Gorecki [this message]
2005-06-27 4:28 ` [gentoo-dev] DBD-mysql select failures with MySQL 4.1 Zac Medico
2005-06-27 4:34 ` Anthony Gorecki
2005-06-27 6:24 ` Francesco R
2005-06-27 6:35 ` Anthony Gorecki
2005-06-27 11:40 ` Michael Cummings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200506262055.54827.agorecki@ectrolinux.com \
--to=agorecki@ectrolinux.com \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox