shell使用sql脚本进行sqlite3数据库更新

来源:互联网 发布:it监控 编辑:程序博客网 时间:2024/05/19 14:39

转载请注明出处!


1. 编写sql脚本upgradeDB.sql,其中就是普通sql语句

update tablename set colname=value where ID=value;

2. 编写shell脚本

#!/bin/shsqlite3 -init upgradeDB.sql crane.db << EOF.quitEOF


说明:直接使用“sqlite3 -init upgradeDB.sql”语句会进入sqlite3命令行,需在shell中使用重定向(<< EOF),输入“.quit”退出


原创粉丝点击