- Dec 12, 2022
- 357
- 2
Hi,
Im am building a dictionary database using SQLite under B4J, and having problems getting an SQL statement usingt an ON CONFLICT clause to work.
Still getting used to B4J, and SQLite too, but it looks like a good pair of tools.
Note that in the code below I am just using SQL, then running it under B4J with the SQL command SQL.ExecNonQuery(query)
I know how to create the SQL strings using StringBuilder and the utilities in the DBUtils module
Table creation:
That works fine to create the table, note the UNIQUE command to limit insertions to unique words
Then if I do:
Insert to table:
That works fine.
But of course if I do the same INSERT again, it fails because of the UNIQUE constraint - that is what I want
However if I use
B4X:
Im am building a dictionary database using SQLite under B4J, and having problems getting an SQL statement usingt an ON CONFLICT clause to work.
Still getting used to B4J, and SQLite too, but it looks like a good pair of tools.
Note that in the code below I am just using SQL, then running it under B4J with the SQL command SQL.ExecNonQuery(query)
I know how to create the SQL strings using StringBuilder and the utilities in the DBUtils module
Table creation:
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
Then if I do:
Insert to table:
INSERT INTO tblWords (word,Length) VALUES ("test5",5)
That works fine.
But of course if I do the same INSERT again, it fails because of the UNIQUE constraint - that is what I want
However if I use
B4X:
INSERT INTO tblWords...
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید