Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wishlist: Return last insert ID after quick_insert. #93

@jahagirdar

Description

@jahagirdar

Everywhere in my code I end up doing the following.

 database->quick_insert($table,$data);
     $data->{id}=database->last_insert_id(undef,undef,undef,$pk);
     if ($data->{id}==0){
        my $data=database->quick_select($table,$data);
                }

it would be much cleaner to replace the above with either one of the following

$data=database->quick_insert($table,$data,{return=>$pk});
OR
$data->{id}=database->quick_insert($table,$data,{return=>$pk});
OR
$data->{id}=database->quick_insert_with_id($table,$data,{return=>$pk});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions