I have problem with saving data to sqldelight 1.4 in Android app.
I created table:
CREATE TABLE myTable(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT
);
In repo class I have insert function with myTable object as an argument
fun insert(item: myTable) {
myTableQueries.insert(
name = item.name
)
}
And in some action i try to create new object Table with name but without id, as id is auto incremented. I had not found any info how to do that. Which is the best solution?
- Create a new class (myTablexpress) with the same parameters as the data class (myTable), use this object in the argument of the insert function in the repo class, and use these parameters?
- Not create a new myTable instance in action class, but use insert function and put string value as parameter?
myTableViewModel.insert(name)
- Create new class myTable without id
@Parcelize
class myTable(val name: String) : Parcelable
and in viewmodel use params?
- none of them
Thanks
')', ',', <column constraint real>, ASC, DESC or ON expected, got 'AUTOINCREMENT'
– Glossator