Revision history for DBIx::Class
+ * Fixes
+ - Fix horrible oversight in the Oracle sqlmaker when dealing with
+ queries updating blobs (RT#69829)
+
0.08194 2011-07-20 16:10 (UTC)
* Fixes
- Fix $rs->populate([]) to be a no-op rather than an exception
$self->throw_exception('Update with complex WHERE clauses currently not supported')
if $sql =~ /\bWHERE\b .+ \bWHERE\b/xs;
- ($final_sql, $sql) = $sql =~ /^ (.+?) ( \bWHERE\b .+) /xs;
+ my $where_sql;
+ ($final_sql, $where_sql) = $sql =~ /^ (.+?) ( \bWHERE\b .+) /xs;
if (my $set_bind_count = $final_sql =~ y/?//) {
keys %$lob_bind_indices
};
}
+
+ # if we got that far - assume the where SQL is all we got
+ # (the first part is already shoved into $final_sql)
+ $sql = $where_sql;
}
elsif ($op ne 'select' and $op ne 'delete') {
$self->throw_exception("Unsupported \$op: $op");
lives_ok {
$rs->search({ id => $id, blob => "blob:$str", clob => "clob:$str" })
->update({ blob => 'updated blob', clob => 'updated clob' });
- } 'blob UPDATE with WHERE clause survived';
+ } 'blob UPDATE with blobs in WHERE clause survived';
@objs = $rs->search({ blob => "updated blob", clob => 'updated clob' })->all;
is @objs, 1, 'found updated row';
ok (try { $objs[0]->clob }||'' eq "updated clob", 'clob updated/retrieved correctly');
lives_ok {
- $rs->search({ blob => "updated blob", clob => "updated clob" })
+ $rs->search({ id => $id })
+ ->update({ blob => 're-updated blob', clob => 're-updated clob' });
+ } 'blob UPDATE without blobs in WHERE clause survived';
+
+ @objs = $rs->search({ blob => 're-updated blob', clob => 're-updated clob' })->all;
+ is @objs, 1, 'found updated row';
+ ok (try { $objs[0]->blob }||'' eq 're-updated blob', 'blob updated/retrieved correctly');
+ ok (try { $objs[0]->clob }||'' eq 're-updated clob', 'clob updated/retrieved correctly');
+
+ lives_ok {
+ $rs->search({ blob => "re-updated blob", clob => "re-updated clob" })
->delete;
} 'blob DELETE with WHERE clause survived';
- @objs = $rs->search({ blob => "updated blob", clob => 'updated clob' })->all;
+ @objs = $rs->search({ blob => "re-updated blob", clob => 're-updated clob' })->all;
is @objs, 0, 'row deleted successfully';
}