status update
Jay Buffington
jaybuffington at gmail.com
Thu Jan 11 00:45:06 UTC 2007
I'm already struggling with
step 0: make sure 'make test' succeeds with mysql before adding Oracle support
As a side note, I had to edit the code to get DBD::mysql to use a
remote database. Is there an easier way? Maybe I'll add
MOG_TEST_DB_DSN, MOG_TEST_DB_USER, MOG_TEST_DB_PASS environment
variables.
All the failing tests are failing because of $dbh->last_insert_id()
problems, which I'm not sure I'm going to be able to get to work with
Oracle anyway. This script demonstrates my problem:
#!/usr/bin/perl
use warnings;
use strict;
use DBD::mysql;
my $dsn = "DBI:mysql:host=sips.imagestation.com;port=3306";
my $user = 'root';
my $password = 'xxx';
my $dbh = DBI->connect($dsn, $user, $password);
# table looks like this:
# CREATE TABLE `test_last_insert_id` (
# `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
# `greeting` VARCHAR( 32 ) NOT NULL ,
# PRIMARY KEY ( `id` )
# ) TYPE = MYISAM ;
$dbh->do( "insert into test.test_last_insert_id (greeting) values
('hello')" ) or die $dbh->errstr();
my $id = $dbh->last_insert_id( undef, undef, undef, undef ) or die
"Couldn't get last insert id: " . $dbh->errstr();
print "Inserted row with id " . $id;
------
That script dies like this:
jay at webdev:~/mgd/mogilefs/trunk/server$ perl ~/t.pl
Use of uninitialized value in concatenation (.) or string at
/home/jay/t.pl line 21.
Couldn't get last insert id: at /home/jay/t.pl line 21.
I'm using MySQL 4.1.7-standard as my mysql server.
Any ideas?
I think I'm going to give up on this and get around it by creating a
MogileFS::Store::last_insert_id() method. In the oracle
implementation, that won't call the DBD function by the same name, it
will return the last sequence that was selected, which was stored as a
class variable.
Jay
More information about the mogilefs
mailing list