https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
k

krzysztof

06/23/2022, 1:16 PM
Hey, Using sqldelight, I’m trying to create a query that would insert variant number of key-value pairs into the table:
Copy code
CREATE TABLE IF NOT EXISTS example_table(
    key TEXT NOT NULL UNIQUE PRIMARY KEY,
    value TEXT
);
In sql, you can do something like
Copy code
INSERT INTO example_table (key, value)
VALUES ("k1", "v1"), ("k2", "v2")
How can I create such query, so that I can pass a list of my
key-value
entries? Such as
db.insertMany(listOf(Entry(k1, v1), Entry(k2, v2)))
?
1
planned for 2.0
for now, best to just run the insert multiple times in a transaction
k

krzysztof

06/23/2022, 1:28 PM
Nice, thanks Alec 👍
6 Views