-
-
Save Rahiche/e6611787dbb9d3aa80a48152c6155d9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newClient(Client newClient) async { | |
final db = await database; | |
//get the biggest id in the table | |
var table = await db.rawQuery("SELECT MAX(id)+1 as id FROM Client"); | |
int id = table.first["id"]; | |
//insert to the table using the new id | |
var raw = await db.rawInsert( | |
"INSERT Into Client (id,first_name,last_name,blocked)" | |
" VALUES (?,?,?,?)", | |
[id, newClient.firstName, newClient.lastName, newClient.blocked]); | |
return raw; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment