sqlite: temporary table/view in a read-only db?

坚强是说给别人听的谎言 提交于 2019-12-07 06:49:25

问题


It seems that sqlite won't allow me to create a temporary view in a read-only db. Am I missing something? If it's TEMPORARY, I figured db connection mode shouldn't matter.

I even specified "PRAGMA temp_store = MEMORY" -- it didn't help.

Is there a reasonable alternative to using views?


回答1:


You can create a temporary view that references data in the main db.

CREATE VIEW temp.userview AS select userid, firstname, lastname from main.usertbl;

Then access the view like such...

SELECT * from temp.userview;


来源:https://stackoverflow.com/questions/3404572/sqlite-temporary-table-view-in-a-read-only-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!