Skip Menu |

This queue is for tickets about the DBD-Firebird CPAN distribution.

Report information
The Basics
Id: 101393
Status: new
Priority: 0/
Queue: DBD-Firebird

People
Owner: Nobody in particular
Requestors: dwheeler [...] cpan.org
Cc:
AdminCc:

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



Subject: Prepared Update does not work with read protected access
Date: Wed, 7 Jan 2015 22:03:09 -0800
To: bug-DBD-Firebird [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Given this script: ~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/env perl use v5.10; use warnings; use DBI; use DBD::Firebird; use Test::More tests => 2; my $db = '/tmp/test.fdb'; my $user = 'SYSDBA'; my $pass = 'masterkey'; DBD::Firebird->create_database({ db_path => $db, user => $user, password => $pass, character_set => 'UTF8', page_size => 16384, }); my $dsn = "dbi:Firebird:dbname=$db;ib_dialect=3;ib_charset=UTF8"; my $dbh = DBI->connect($dsn, $user, $pass, { PrintError => 0, RaiseError => 1, AutoCommit => 1, ib_enable_utf8 => 1, FetchHashKeyName => 'NAME_lc', }); END { $dbh->func('ib_drop_database') } $dbh->do(q{ CREATE TABLE foo ( id VARCHAR(10) PRIMARY KEY, hash VARCHAR(10) UNIQUE ) }); $dbh->do(q{INSERT INTO foo VALUES ('11111', '8888888888')}); my $sth = $dbh->prepare('UPDATE foo SET hash = ? WHERE id = ?'); $dbh->func( -lock_resolution => 'no_wait', -reserving => { foo => { lock => 'read', access => 'protected', }, }, 'ib_set_tx_param' ); $dbh->begin_work; $sth->execute('12345', '11111'); $dbh->commit; is $dbh->selectcol_arrayref( 'SELECT hash FROM foo WHERE id = ?', undef, '11111' )->[0], '12345', 'Prepared update should have worked'; $dbh->begin_work; $dbh->do( 'UPDATE foo SET hash = ? WHERE id = ?', undef, '12345', '11111', ); $dbh->commit; is $dbh->selectcol_arrayref( 'SELECT hash FROM foo WHERE id = ?', undef, '11111' )->[0], '12345', 'Inline DO UPDATE should have worked'; ~~~~~~~~~~~~~~~~~~~~~~~~~ The output is: 1..2 not ok 1 - Prepared update should have worked # Failed test 'Prepared update should have worked' # at /home/dwheeler/bin/try line 55. # got: '8888888888' # expected: '12345' ok 2 - Inline DO UPDATE should have worked # Looks like you failed 1 test of 2. For some reason, the update via the prepared statement fail to update the row, while the update executed via do() does update the row. Seems like they both ought to update the row. Best, David