Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashref bind values in insert() no longer cause a warning #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/SQL/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,7 @@ sub _insert_value {
push @all_bind, @bind;
},

# THINK: anything useful to do with a HASHREF ?
HASHREF => sub { # (nothing, but old SQLA passed it through)
#TODO in SQLA >= 2.0 it will die instead
belch "HASH ref as bind value in insert is not supported";
HASHREF => sub {
push @values, '?';
push @all_bind, $self->_bindtype($column, $v);
},
Expand Down
5 changes: 2 additions & 3 deletions t/01generate.t
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,12 @@ my @tests = (
stmt_q => 'SELECT * FROM `test` WHERE ( `a` < to_date(?, \'MM/DD/YY\') AND `b` = ? )',
bind => ['02/02/02', 8],
},
{ #TODO in SQLA >= 2.0 it will die instead (we kept this just because old SQLA passed it through)
{
func => 'insert',
args => ['test', {a => 1, b => 2, c => 3, d => 4, e => { answer => 42 }}],
stmt => 'INSERT INTO test (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)',
stmt_q => 'INSERT INTO `test` (`a`, `b`, `c`, `d`, `e`) VALUES (?, ?, ?, ?, ?)',
bind => [qw/1 2 3 4/, { answer => 42}],
warns => qr/HASH ref as bind value in insert is not supported/i,
bind => [qw/1 2 3 4/, { answer => 42}]
},
{
func => 'update',
Expand Down