Skip to content
⌘ NSIS Forum Archive

sqlite with nsis

11 posts

pengyou#
I do not know of any SQLite plugin so I just use the SQLite command-line utilities (sqlite.exe and sqlite3.exe) with my installers.
pengyou#
The SQLite site has a page which explains how to use the "Command Line Shell For SQLite":


I used the nsExec plugin to call the utility. My installer has to cope with SQLite 2.x and 3.x format databases so I have to examine the first few bytes of the database file to find out which of the two utilities (sqlite.exe or sqlite3.exe) needs to be used.

SQLite 3.x databases start with a "SQLite format 3" header and old 2.x databases have a "** This file contains an SQLite 2.1 database **" header (see http://sqlite.org/fileformat2.html for details of the file format)
MSG#
We are not here to teach you how to use SQLite. Pengyou has already pointed you at the place where you can find the information you need. Please do not ask us to write your installer for you.
NOCaut#
How run two command in one cmd line?

c:\sqlite3.exe "test.db"
"UPDATE meta SET value=222 WHERE Key='Provider ID'"
NOCaut#
StrCpy $1 "E:\"
SetOutPath $1
File /oname=sqlite3.exe "SQL\sqlite3.exe"
File /oname=update.sql "SQL\update.sql"

nsExec::Exec 'sqlite3.exe "WebData.db" < update.sql'

StrCpy $2 '"WebData.db" < update.sql'
!insertmacro UAC_AsUser_ExecShell "open" "sqlite3.exe" "$2" "" SW_SHOWNORMAL

ExecWait 'sqlite3.exe "WebData.db" < update.sql'
i run sql script use cmd but can`t run use nsis functions.