Android Question sqlite_schema

Dey

Active Member
Licensed User
Longtime User
Hello everybody
How can I do this select in RDC2

sql.select_schema = SELECT sql \
FROM sqlite_schema \
WHERE name =?

i need to select table schema
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
Something like this?

SQL:
SELECT
  name, type
FROM
  sqlite_master
WHERE
  type in ('table', 'view')
AND
  name not like 'sqlite?_%' escape '?'
 
Upvote 0

Dey

Active Member
Licensed User
Longtime User
Something like this?

SQL:
SELECT
  name, type
FROM
  sqlite_master
WHERE
  type in ('table', 'view')
AND
  name not like 'sqlite?_%' escape '?'
hello MicroDrie
Thanks for the reply

I have to take table schema with RDC2 Remote Database Connector (RDC2)
I put this command in the config.properties file

sql.select_schema = SELECT sql \
FROM sqlite_schema \
WHERE name =?

Codice B4A:
Dim req As DBRequestManagerRS = CreateRequest
        Dim cmd As DBCommand = CreateCommand("select_schema", Array(nameTable))
        Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
        If j.Success Then
            req.HandleJobAsync(j, "req")
            Wait For (req) req_Result(res As DBResult)
            Dim r As Int = 0
            Dim schema As StringBuilder
            schema.Initialize
            For Each row() As Object In res.Rows
                schema.Append(row(r)): r= r +1
            Next
            j.Release

        Else
            Starter.SaveLog($"${nameModule}.Select_Schema job.error: ${j.ErrorMessage}"$)
        End If
error
(SQLiteException) org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: sqlite_schema)
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
In the SQLite documentation I read that you can create sqlite_schema. When I send the specified Query to a database with DB Browser for SQLite Version 3.12.2 I get an error:

Execution finished with errors.
Result: object name reserved for internal use: sqlite_schema
At line 1:
CREATE TABLE sqlite_schema(

Also query the sqlite_schema doesn't give a result

Execution finished with errors.
Result: no such table: sqlite_schema
At line 1:
SELECT * FROM sqlite_schema;
My conclusion is that the current security rules do not allow access to the sqlite_schema table. The documentation say:

I'm afraid only using sqlite_master table is left to use to find the table names.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…