SQLite Forum

C api sqlite3_db_readonly returns -1
Login
The sqlite3_db_readonly call takes two arguments.  

The sqlite3 connection handle and the database schema name ('main', 'temp', etc).

Passing the connection handle and the database file name is an error, hence you get an error returned.

<https://sqlite.org/c3ref/db_readonly.html>