Closed moovida closed 3 years ago
I need this feature too!
You can retrieve the primary key like this:
final primaryKeyName = 'id';
final res = await yourConnection.query('INSERT INTO $tableName ($keys) VALUES ($values) RETURNING $primaryKeyName;');
final lastInsertedId = res.last[0] as int;
Hi there, great library!
I was wondering if there is the possibility to get the last inserted id from an insert query that has an auto-incrementing primary key. Thank you.