Skip Menu |

This queue is for tickets about the DBIx CPAN distribution.

Report information
The Basics
Id: 79832
Status: new
Priority: 0/
Queue: DBIx

Owner: Nobody in particular
Requestors: Warren.Lumsden [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: database not included when using resultset
Date: Mon, 24 Sep 2012 14:20:10 -0400
To: <bug-DBIx [...]>
From: "Lumsden Warren" <Warren.Lumsden [...]>
Download (untitled) / with headers
text/plain 1.4k
Distribution: DBIx-Class-0.08200 Perl: 5.10.0 Platform: Darwin Kernel version 10.8.0; xnu-1504.15.3~1/RELEASE_I386 i386 Problem: I have (many) a class that is defined to contain the database in the table name: e.g. package db::Schema::Result::Process; use base qw/DBIx::Class::Core/; __PACKAGE__->table( 'cluster.process' ); When using something like this that performs a command on the resultset: $schema->resultset( 'Process' )->search( { host => 'test', name => 'test' }->delete(); ...the table name does not appear in the query. error: DBIx::Class::ResultSet::delete(): DBI Exception: DBD::mysql::st execute failed: No database selected [for Statement "DELETE FROM process WHERE ( ( host = ? AND name = ? ) )" with ParamValues: 0='test', 1='test'] at .... I can do the following, and it does work fine, and apparently includes the dbname with the table, i.e., 'cluster.process'; my @procs = $schema->resultset( 'Process' )->search( { host => 'test', name => 'test' } ); for my $proc ( @procs ) { $proc->delete(); } I would prefer the first way, since it is cleaner code using it as a conversation, and should actually work according to documentation. So in essence, there is a workaround. and this probably only effects those that don't connect to a specific dbname. We connect to 3 seperate dbname's within a db, which allows for more flexibility for replication. I'm pretty sure, that we are not alone in this practice.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to