bigpresh / bigpresh/Dancer-Plugin-Database

Wishlist: Return last insert ID after quick_insert.

Open
#93 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
39
Forks
36
PR merge metrics
No merged PRs in 30d

Description

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});`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the existing quick_insert, last_insert_id, and quick_select calls in the plugin. Compare the proposed return forms and determine which behavior should be supported consistently across the database interface. Done means quick_insert can provide the requested primary-key value without the separate lookup, with coverage for the chosen API behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.