https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Srijit Saha

03/18/2023, 12:47 PM
Hey guys, i was trying out sqldelight 2.0.0-alpha-05, facing some issue and when i try to generate the SqlDelight interface from gradle task it gives me an error, anyone else faced this ?
h

hfhbd

03/18/2023, 12:50 PM
Any details about the error?
s

Srijit Saha

03/18/2023, 12:51 PM
Screenshot 2023-03-18 at 6.21.06 PM.png
this happens when i uncomment the insert query
h

hfhbd

03/18/2023, 12:53 PM
Can you paste the query?
s

Srijit Saha

03/18/2023, 12:55 PM
Copy code
insert:
INSERT OR REPLACE INTO transactions (transactionAmount, partyName, isExpendeiture)
VALUES ?;
this is all i got because it doesn't generate anything
h

hfhbd

03/18/2023, 1:03 PM
I mean the whole file with the table
s

Srijit Saha

03/18/2023, 1:04 PM
Copy code
CREATE TABLE IF NOT EXISTS transactions (
    transactionId INTEGER PRIMARY KEY ASC ,
    transactionAmount TEXT,
    partyName TEXT,
    isExpendeiture INTEGER DEFAULT 0 NOT NULL
);

insert:
INSERT OR REPLACE INTO transactions (transactionAmount, partyName, isExpendeiture)
VALUES ?;

selectAll:
SELECT * FROM transactions;
--
-- selectParticular:
-- SELECT * FROM Transactions WHERE transactionId == ?;
--
-- deleteAll:
-- DELETE FROM Transactions;
h

hfhbd

03/18/2023, 1:09 PM
ahhh, you cant use 'insert' as name, it is a reserved SQL keyword
s

Srijit Saha

03/18/2023, 1:10 PM
gives the same error when i change the query name
Copy code
putInValue:
INSERT OR REPLACE INTO transactions (transactionAmount, partyName, isExpendeiture)
VALUES ?;
h

hfhbd

03/18/2023, 1:19 PM
there is no insert or replace in mysql: https://dev.mysql.com/doc/refman/8.0/en/insert.html
s

Srijit Saha

03/18/2023, 1:41 PM
thanks it worked 😄
8 Views