Important: Please read the Qt Code of Conduct -

creating temporary view in a read-only database

  • i'm testing my application, where i create a temporary view in the application.
    i tried to make the database file (sqlite) read-only: chmod 444 ~/path/to/db.
    however, still got no error and the views were created successfully and all data from the views were retrieved.
    how come this is possible?

  • probably because you didn't recursively change the permissions on all the files and folders within that path. Looks like you only changed the permissions on the DB directory...which IIRC would make it impossible to chdir into that directory as 444 because the (x) bit needs to be set on directories to make them the cdir.

    I'd strongly suggest learning to use the other form of chmod "o-w,g-w,u-w" to prohibit writes without affecting other bits and using the recursive -R option.

  • @kent-dorfman
    i only changed the permissions of the database FILE, sorry for confusion.

  • The views are temporary, right? so they are probably only created in the memory (cache) of the currect DB connection. I'd wager that if you close the connection and reopen it without recreating the views then they no longer exist.

Log in to reply