[Bug 20591] New: DBI->last_insert_id does not work as expected

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 20591] New: DBI->last_insert_id does not work as expected

bugzilla-daemon
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: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

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.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 20591] DBI->last_insert_id does not work as expected

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591

Jonathan Druart <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rel_18_05_candidate,
                   |                            |RM_priority
                 CC|                            |[hidden email]
                   |                            |, [hidden email],
                   |                            |[hidden email]

--- Comment #1 from Jonathan Druart <[hidden email]> ---
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.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 20591] DBI->last_insert_id does not work as expected

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591

Jonathan Druart <[hidden email]> 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.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 20591] DBI->last_insert_id does not work as expected

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591

Jonathan Druart <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
           Keywords|rel_18_05_candidate,        |
                   |RM_priority                 |

--- Comment #2 from Jonathan Druart <[hidden email]> ---
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.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 20591] DBI->last_insert_id does not work as expected

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591

--- Comment #3 from Jonathan Druart <[hidden email]> ---
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.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/