[Dbix-class] txn_do on a custom ResultSource gets unbound placeholder exception

Matt S Trout dbix-class at trout.me.uk
Fri Feb 1 13:48:28 GMT 2008


On Fri, Feb 01, 2008 at 01:28:07PM +0100, Cedric Boudin wrote:
> Dear members of the list.
> 
> I have a custom resultsource calling a db function with 4 input
> parameters returning a set of rowtypes.
> 
> This resultsource is build as described in 
> DBIx::Class::Manual::Cookbook
> Arbitrary SQL through a custom ResultSource
> 
> case a)
> When I use this resultsource to get a resultset executing the function,
> everything works as expected.
> The function does what it is supposed to do and returns the expected
> values.
> These values are accessible through the normal methods/accessors.
> Everything is fine.
> 
> 
> as the function throws an exception when something goes wrong I want to
> catch it, so then I do as explained in
> DBIx/Class/Storage.pm#txn_do
> case b)
> and wrap the call to the method calling the db function in a sub.
> I pass the sub's coderef to txn_do.
> The call to the method is exactly the same in case a as in case b.
> 
> But in this case I end up with an unbound placeholder exception.
> 
> Stepping through the code execution with the debugger I come to the
> conclusion that the call to
> 
> DBIx::Class::Storage::DBI::_execute
> in case a
> the parameter $extra_bind contains the values given in the bind=>[ arg1,
> arg2,arg3...] argument used to call the custom resultsource
> 
> in case b the the extra_bind is desperatedly empty.
> 
> is this an expected behaviour or did I hit some bug?

txn_do is really just

begin; try { $sub->(); commit; } catch ($e) { rollback; rethrow($3); }

so it shouldn't make any difference at all.

Time to get digging, either there's something odd in your codebase or
in ours.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list