This has been mentioned in passing (someone wanted to do something with the Xojo sqlite3 db driver without using the “dot” commands but no examples were given of how to use the “dot” commands). Has anybody used the “dot” commands from the shell? If so, what’s the syntax? It seems that the period is just tacked onto the beginning of a new database file when I try to use them from the Xojo shell, because the sqlite3 utility thinks we’re trying to create a new database, and the period is taken for the beginning of a text string.
I’m guessing maybe the period can be escaped. Anybody have any luck with this?
FYI, my goal is to export/import csv files from the shell. Yes, I know there is a video out describing a list to csv conversion, and some Xojo pro wrote a cool (and arcane) utility and posted it on GitHub, but there’s no documentation whatsoever and it’s far above my pay grade. It seems like the shell would be more straightforward with my present meagre Xojo skills.
The dot commands are used in the sqlite3 executable program. They are not SQL commands, but commands to the program. You run the program from a Terminal window on macOS and similar on other platforms. On my machine at the Terminal prompt it looks like this:
Third-Mini% sqlite3
SQLite version 3.39.0 2022-06-25 14:57:57
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .help
(here it lists all the commands and their arguments)
I am familiar with the sqlite3 command line utility and I know the dot commands are not part of the sql standard. What I’m trying to do is see if I can run these dot commands from the Xojo shell. I know I can run the sqlite3 program from the Xojo shell and I know the Xojo sqlite3 driver doesn’t support the dot commands in the sqlite3 command line executable.
Since the dot commands support creating a csv file and since I don’t know how to make the sqlite3 utility do that any other way, I’m stuck (so far) creating a csv file from this utility. From the utility, it’s easy to do. Now I’m trying to replicate that behavior from the Xojo shell in a Xojo application.
Is this possible, and, if so, how do I write the dot commands in the Xojo shell program?
To simplify my inquiry and break my dilemma into digestible pieces, I would like to control the sqlite3 command line utility with the Xojo shell command, specifically using the dot syntax. To your knowledge, can that be done? If so, how?
I have been to your site many times and I am considering a purchase by and by. I just bought Xojo and I’m still getting my feet wet, but your plug-ins are obviously worth considering down the road a bit.
then I don’t see why the command you give this shell shouldn’t be “/path/to/sqlite3 -init myfile mydatabase” and the dot commands would then be in myfile.