SQLite - problem

Then your database is not loading correctly

or your table is not called tblSynopsa

Try using the TableNames block, what does that return ?

image

Well returned it (android_metadata)

therefore no table called tblSynopsa is present in the database you have open.

Suggest you use the importDatabase block to setup your database.

Strange, because I didn't have to do this, I just set the DBName and then used the openDatabase block

You also have the databaseExists block, to ensure you are using the correct path.

Hello.
I imported a database.
Unfortunately, the table name lists the same ....
(android_metadata)

Ondrej

Check you file path to the database.

Be aware that if no database is present, sqlite will either create one, or use an in-memory database.

In the MIT development environment, in the Media section, I have the Synopsa-ev.db database.
I imported:


blocks(9)

Try this:

  1. Remove the importDatabase blocks (this just makes a copy)
  2. Set DBName to //Synospa.db
  3. OpenDatabase

Does this now work ? (remember you will only be able to "read" from a database file in the assets.)

If not you may have to copy your db file to your ASD/private storage or sdcard - somewhere that has a "proper" path, and use that path in DBName.

are you using an Android 10 or 11 device for your tests?
it might be, that the extension was not updated and still uses the old location for the assets
the assets directory for the companion app is now in the ASD - Applicaiton Specific Directory

my sqlite extension correctly can load databases from the assets also for Android 10 and 11 devices...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Yes, Taifun is correct there. For Android <10 the path needs to be clarified to the MIT provided path for assets in Companion or for ASD (application specific directory) when compiled.

In companion, to load myhtml.db file:

Good day.
After a long time, I returned to the project with SQLite.
I'm testing it on a mobile with Android 6.0.
I'm trying to find out if the db was imported correctly, but the table name from the db doesn't show me, so it's probably wrong ...
It will only show me this on my mobile:

DB vymazaná....
DB importovaná...
DB existuje....
(android_metadata)
/storage/emulated/0/Android/data/edu.mit.
appinventor.aicompanion3/files/assets/
Synopsa-ev.db

Where am I making a mistake?
Thanks.
Ondrej

  1. Why so complicated ?
  2. You cannot delete a file in the assets
  3. Try this (using your database file in assets):

image

image

Hello.
I did it this way.
I also added a list of open tables ...
Number of lists:
1
But Call.SQlite1.TableNames only prints:
(android_metadata)

Ondrej

Can you share your db file: Synopsa-ev.db for testing here?

You can send it by private message if you do not want to place on the open forum.

OK.
What email can I send that database to?
Ondrej

Send private message on this community/forum

  1. Click on your icon top right
  2. Click on the envelope
  3. Click on the Down Arrow bar at the bottom of the list

(or for 2&3 just double click the envelope)

  1. Click on New Message, select/type user etc. attach file (you may need to rename the extension to .txt

remember: that path is only valid for the companion app...
Taifun

Yep, we have not progressed beyond that stage yet :wink:

Hello.
Can anyone advise?
Is there a difference in using SQLite depending on the development environment in which the db is created?
I created the first db in SQLiteStudio, I created the second db in DB Browser (SQlite).
In neither case does the command want to work for me: call SQLite1 TableNames. Only show there (android_metadata).
Can't you send me your training db myhtml.db to try it out?
This time I tried to run it through BlueStacks.
Thanks.
Ondrej

I will make up a couple of example sqlite databases to test with....