Hi Shane,
I would figure out how to use the sqLite external. The commands it needs are the same as those you are trying to run from the shell. You just will have to tell the external where to find the files. It will take some reading in the docs. Just search for "datab" (without quotes) in the dictionary.
shell("sqlite3 testxx2.db "select * from test"")
A Revolution shell command starts end ends with a quote. These aren't part of the command but they delimit the string that is parsed by Revolution before it is executed.
So, your command is
sqlite3 testxx2.db "select * from test"
where sqlite3 is the executable, testxx2.db is a parameter containing a reference to a file and the remaining parameter contains a string that can be interpreted and executed by sqlite3.
Now we have to turn this into a string. First, replace the quotes with the constant "quote" (without quotes ;-) )
"sqlite3 testxx2.db" && quote & "select * from test" & quote
If you put this into the message box:
put "sqlite3 testxx2.db" && quote & "select * from test" & quote
you should get the original string, meaning that you did it right.
Now you can put the entire string into a variable and execute it using the shell command:
Code: Select all
put "sqlite3 testxx2.db" && quote & "select * from test" & quote into myCommand
put shell(myCommand) into myData
-- do something with myData
You could also have used
Code: Select all
put revOpenDatabase("sqlite","testxx2.db",,,,) into myDatabaseID -- need this line only once
put "sqlite3 testxx2.db" && quote & "select * from test" & quote into myQuery
put revDataFromQuery(,,myDatabaseID,myQuery) into myData
Note that you may have to replace "testxx2.db" with the complete path to that file.
I agree that using the shell may be easier, but using the external is more efficient. Dumping the data to a file before using it in Rev is very inefficient.
The book you've got still applies, you just execute the queries using revDataFromQuery or revQueryDatabase.
Best,
Mark