Issue
result=$(sqlite3 sample.db "SELECT count(*) FROM table WHERE value='sample';")
echo $result
Result is 1
.
Because of "Database is locked" error I changed the code:
result=$(sqlite3 sample.db "pragma busy_timeout=20000; SELECT count(*) FROM table WHERE value='sample';")
echo $result
But now the result is:
20000 1
I don't want busy_timeout
value in the result.
I want the result to be 1
.
How can I do that by editing sqlit3
commands?
Solution
Thanks to @user4157124
Sqlite3 command must edit as below:
result=$(sqlite3 -cmd ".timeout 20000" sample.db "SELECT count(*) FROM table WHERE value='sample';")
It prevents Database is locked Error and the result varibale doesn't combine with the timeout value.
Answered By - Amin SZ Answer Checked By - Pedro (WPSolving Volunteer)