SQLite does not work correctly in Kodular, autoincrement column

I am trying to create a database in kodular and after running the app in the companion it closes.
I have an SQLite database when initializing Screen1, I have the create table creation block and it doesn’t work:
When Screen1.Initialize
do call .Single SQL
sql “CREATE TABLE products (product_id INTEGER PRIMARY KEY AUTOINCREMENT, product_name VARCHAR NOT NULL, quantity INTEGER NOT NULL DEFAULT 0);”

This statement is copied from the sqlite website.
When you run the application, it closes. KODULAR FAIL
Any ideas?
Thank you

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

See also

Taifun

Attachment sent the block capture
thanksblocks

Your sql looks right to me. What other blocks gets executed after this?

None.
When you run the app, it automatically closes when you run.
Only the table is created

@Norba_TIC Please post here simple .aia that demonstrates this issue.
Also, is this happening with companion or .apk? If apk, need your apk to test

@Norba_TIC I just tried creating a simple .aia with your sql-query and it worked with no issue.

Pruebas.aia (1.6 KB)

I attached the aia file. I run it with Kodular companion on Xiaomi (Android 10)

@Norba_TIC You are correct and I confirmed it. The reason it was not happening for me is due to fact that I was using a companion that I had built that includes some updates to SQLite component. This issue will be addressed in next release.

Issue: The issue is with Toast property (below). You had this unchecked. For now, enable it (Supress Toast) and all should be okay. Use Event blocks to get runtime-result / status:
image

Indeed, it works by doing what you told me.
Thank you very much

1 Like

Glad its resolved now :+1: . We’ll address the Toast issue in upcoming release

A post was split to a new topic: SQlite component, invalid sql statement