[Bug 20591] New: DBI->last_insert_id does not work as expected
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 Bug ID: 20591 Summary: DBI->last_insert_id does not work as expected Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Try the following code: use Koha::Database; use Koha::Cities; use Koha::AuthorisedValues; my $schema = Koha::Database->schema; $schema->storage->txn_begin; my $dbh = C4::Context->dbh; my $city = Koha::City->new({ city_name => 'name' })->store; say $city->cityid; say $dbh->last_insert_id( undef, undef, 'cities', undef ); say $dbh->last_insert_id( undef, undef, 'not_exist', undef ); say "==="; my $av = Koha::AuthorisedValue->new({category => 'LOC', authorised_value => 'just_a_test'})->store; say $av->id; say $dbh->last_insert_id( undef, undef, 'authorised_values', undef ); say $dbh->last_insert_id( undef, undef, 'cities', undef ); say $dbh->last_insert_id( undef, undef, 'not_exist', undef ); It will display: 12 12 12 === 401 401 401 401 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_18_05_candidate, | |RM_priority CC| |julian.maurice@biblibre.com | |, m.de.rooy@rijksmuseum.nl, | |tomascohen@gmail.com --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I do not have time to investigate this right now, but there is something scary. It could lead to very bad side-effects. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=20562 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal Keywords|rel_18_05_candidate, | |RM_priority | --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Sounds like the only place it is buggy is t/db_dependent/Circulation/issue.t No problematic occurrences found in controllers or modules. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> ---
From DBI POD:
""" * For some drivers the $catalog, $schema, $table, and $field parameters are required, for others they are ignored (e.g., mysql). """ -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #3)
From DBI POD:
""" * For some drivers the $catalog, $schema, $table, and $field parameters are required, for others they are ignored (e.g., mysql). """
Sounds like it's not an issue then? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Shouldn't we then remove the parameters? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #5)
Shouldn't we then remove the parameters?
Ahh I didn't realize we were using them. Yeah that would make sense. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org