When I try to get data from a SQLIte table, I get the right result and I store it in a global variable, but after this, the variable rotaServidor only contains SQL command completed. It's very strange... or where am I wrong?
I have had a look at my extension code. You should only get that output "SQL command completed" when a query returns 0 (zero) rows (e.g. when you CREATE or DELETE, or there is no data returned)
Again, look at your blocks, see where you might be calling this ?
Yes you are right. Ok, let's see: I initialize the global variable rotaServidor this way:
The idea is to have a table in SQLite called configuracoes, where I have all links to both dev and prod, which are filled by a table from MariaDB remote database. The table is filled correctly, as you can see the Do-It result in my first post. What I don't understand is that even returning the right link from the SQLite table, the variable does not receive this result. If I do this manually, it works...
Another point is that I made CREATEs on the SQLite database, but just in the beginning, in order to fill the tables (including the table configuracoes) and it works well, but the rotaServidor variable is not used in this context.
This looks to me like a case of trying to do everything at once (which AI2 likes to do....) so the tables and data may not be created and in place when you call the query. SQLite is quick, but maybe not that quick!
You will need a "chain of events" to overcome this:
open the database and test if table exists
if it does then create your tables and data
test that all tables and data, or your one specific table and data, are created and in place. You could do this by running the table exists query again....if it doesn't exist then send out the table exists query to a clock timer until it does.
query the data
You may instead want to move your query to the end of the criarTabelas procedure, or call a clock timer at the end to then run the query after a certain period of time.
What I did now was this: I am dropping the table configuracoes and the other tables just to force the test of the non-existence of tables in SQLite and to get the rotaServidor variable with the correct content.
But nothing changed. The message is still the same.