Closed kiwiroy closed 5 years ago
Note: "most recent successful insert". It is not designed to indicate success and I don't wish to introduce further complications/slowdowns to do so. (The LAST_INSERT_ID() function in most databases functions the same way.) Unless I'm mistaken the returned value of the insert or ignore
query should indicate the number of rows inserted (also available as $result->rows
).
A case of RTFM. Thanks for your time.
@Grinnz I'd appreciate your thoughts/insight on this patch.
I have some code that does some
insert or ignore
, the table has a unique index, for which I'd like to simply count the successful inserts. Testing for truth of$result->last_insert_id
seemed obvious. Having read the following I didn't expect most recent to survivefailed
inserts...https://github.com/Grinnz/Mojo-SQLite/blob/9dffe657ff073f1c353a199e006cdbaa980f132b/lib/Mojo/SQLite/Results.pm#L196-L197
I expected an insert query to clear the
last_insert_id
as is the intent in this patch.The same can be achieved with
localised
hash, but there's no interface for this, or by comparing to previous value oflast_insert_id
.Thanks.