If I got your code right, it is amazing that anything works. In
‘SELECT * FROM Clients WHERE Type = ‘Client’’
the inner string marks around client need to be escaped. If typed the way you did here, the shell argument ends with “.Type = '”
Have a look at the following apple script code:
set arg to “SELECT * FROM Clients WHERE rowID=‘1’”
quoted form of arg
The result is
“‘SELECT * FROM Clients WHERE rowID=’\‘‘1’\’‘’”
Difficult to read since this is a combination of escaping for the shell and escaping for AppleScript. But using “quoted form” this way should help:
set prog to "sqlite3"
set arg1 to "/Users/MSPS/DataBases/SQLite/Clients/Clients.db"
set arg2 to "SELECT * FROM Clients WHERE Type = 'Client'"
set cmd to prog & " " & quoted form of arg1 & " " & quoted form of arg2
do shell script cmd
(The entire AppleScript string for cmd here is: ““sqlite3 ‘/Users/MSPS/DataBases/SQLite/Clients/Clients.db’ ‘SELECT * FROM Clients WHERE Type = ‘\’‘Client’\’‘’””)