Question to SQlite extension from Taifun

Hello,
i have a question to the Forum. Maybe somebofy can tell what I’m doing wrong.

I’ll start with the table in SQLite…

I make the following query on the database

SELECT db_AppValue,db_AppSecure,db_AppSecLevel
FROM easybase
where db_AppVar = “gAppMode”

the blocks to do so…

I expect as result : FirstRun, trrue, 1
( or 1 for true because internal it is represented as 1)

Bur what I got is : FirstRun, 0, 1

Taifun I asked for. Answer me with this screen and ask me to post it in forum.

What am I doing wrong?

regards Franz

Sqlite does not support types of Boolean fields so it returns 0 and 1, then you manage it from the block editor.

https://www.sqlite.org/faq.html#q2

just i’ve said

I expect as result : FirstRun, trrue, 1
( or 1 for true because internal it is represented as 1)

The result of “FirstRun, 1, 1” wolud be also ok . But I get a Zero ???

You’re right, but are you sure that the data in the database that you showed in the first image, are the same as in the table? I imagine that the database you show in the first image is a database managed on a PC, how did you reproduce it on the device? Have you exported the db from pc and imported it into the device?

Hi Enzo,
That was exactly my first question I asked myself. I end up using the wrong database. So I checked this, and yes there are multiple databases in…

  • /storage/emulated/0/EasyInvent
    my private appfolder…

  • /storage/emulated/0/Makeroid/assets
    as expected

  • /storage/emulated/0/Appinventor/assets
    cause I start developing with Appinventor

But in any cases thers is true == 1 in the database

Do this test: insert a new row in the db of the pc (maybe with the value a true on the field concerned), export the db, import it into the device and first check that that new row is present and then the value of the interested field. I hope I explained myself.

No the DB on the PC is only a copy made by filetransfer.

I will now change the db to integer to go on. But the question still remains ?

How did you export the database from pc to device. The one on PC doesn’t seem to be a Sqlite database, I think there was a conversion, it may be that the conversion changed that value from checked to 0 for some strange reason. If so, the problem is not in Kodular or in the Sqlite extension.

If you actually exported that db to Sqlite you can try the file produced on Sqlite manager online and see what it puts you in that field, so in the meantime you understand if it can be a problem related to Kodular or not.

I am close to despair. Because I executed the respective value with the SQLite Editor app, i.e. directly on the device.

I don’t understand what you mean.

See here this a screenshot of my mobile app.


Apart from that, this app recognizes very well that the field is Boolean ???

I am getting the impression that the Taifun extension has a problem with that.

Now i changed the table from boolean to int

The SQL Command on PC work as expected…

Download the db to Mobile and run in Companion.

grafik

I get crazy…

My doubt is that you have two databases on the device, the one that reads the app (an old version) and the one imported afterwards. To eliminate doubts, try to write new information and reimport it and see as a companion if you see that new information

No I have overwritten all 3 DB on the mobile

So have you tried adding new information (e.g. a new line) on the database managed by PC and imported it into the device database? If yes, do you see the new information in the device database?

Meanwhile I have deleted the db 's in the Assetsfolders now there is only the db in my Appfolder an the result is the same.
@Taifun I think ist on time to give your comment to this Problem or not ?

you have to import your initial database on firstrun of the app (Import method), see again the example project how to do it
https://puravidaapps.com/sqlite.php

and you have to upload the initial database in the media section of the designer, so it is available as asset in the app

and as Kodular does not follow the App Inventor logic for the assets directory, please also read Q11 from the Q&A section App Inventor Extensions: SQlite | Pura Vida Apps

Taifun

That means in Others words, is Not enough to replace the Database in the folderstructure. I have Import the DB also ?

SUCCESS
After many more tests I have now managed to address the right values, or rather the right database. Taifun was of course right with his tip from Q11, but unfortunately this change did not help me either and nothing has changed. Then I also had the path displayed from the standard module. And lo and behold, there was a completely different data path (see picture line 3).


From now on it was clear to me where the problem was. To prove my guess, I renamed my database and copied it into the assets and application directory. And lo and behold … the expected values were suddenly there.

reason

I had previously worked with this database using the standard tool (storage … sqlite). Then I switched to the Typhoon tool. However, the access was still carried out on the DATABASE.sqlite, it seems.

In my view, possible reasons are

  • Kodular has a problem with the standard search path and therefore always pulls the old standard DB.

  • Kodular does not remove everything when deleting in the asettes. First of all, it doesn’t seem like the temporary file.

  • When taking over projects from AppInventor, Kodular also takes over parts that you do not need yourself.

There are many possible sources of error …

My personal tip to avoid this problem is.

When importing a project or changing to another SQL extension, renaming the database name so that access is clear.

this is the default location of the sqlite database
it seems to be, you use the GetPath method from the built in sqlite component

it seems to be, you forgot to import the initial database as mentioned earlier…
to remove the old database from the companion app, alternatively you also could reinstall the companion app or use the Clear Database method from the built in sqlite component
https://docs.kodular.io/components/storage/sqlite/#clear-database

Kodular accesses the database on the default path and you have to make sure to import your initial database

most probably you are talking about the database, which was not removed… the database is stored in folder /database and not /assets, so deleting the assets will not remove the database
to remove the old database from the companion app, you could reinstall the companion app or use the Clear Database method from the built in sqlite component
https://docs.kodular.io/components/storage/sqlite/#clear-database

sorry, I do not understand what you are talking about

I’m glad, that your issues are resolved now…
Taifun