From: Matt S Trout Date: Sat, 9 Oct 2010 17:08:41 +0000 (+0100) Subject: return add args if no return from the insert_one query in CRUD so RETURNING isn't... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=HEAD;p=dbsrgits%2FDBIx-Data-Store.git return add args if no return from the insert_one query in CRUD so RETURNING isn't required when all columns are passed in anyway --- diff --git a/lib/DBIx/Data/Store/CRUD.pm b/lib/DBIx/Data/Store/CRUD.pm index 143ed79..56f8394 100644 --- a/lib/DBIx/Data/Store/CRUD.pm +++ b/lib/DBIx/Data/Store/CRUD.pm @@ -36,7 +36,12 @@ sub replace { $self->_run('row','update_one', [ @{$_[1]}, @{$_[0]} ]); } -sub add { shift->_run('row','insert_one',@_) } +# returning args ($_[0]) if we don't get anything back saves us needing +# to emulate INSERT RETURNING in the case where no columns are supplied +# by the database. I think this is a feature. + +sub add { shift->_run('row','insert_one',@_)||$_[0] } + sub remove { shift->_run('row','delete_one',@_) } 1;