Using sqlite3 command line "Dot" commands


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.

Thank you,

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?

Thank you

Are-you using Ventura ?


I’m running Monterey 12.3 on a MacBook Pro M1 .
SQLite3 3.37.
Xojo 2022 1.1.


What dou you REALLY want to do ?

Do you simply want to import from / export to csv ?

Do you have outside requirements ?

More information about csv can be found here:

What computer are-you using ?

For example, the following text can be saved as .csv:

this is a tab file1
this is a tab file2
this is a tab file3
this is a tab file4
this is a tab file5

and looks as (in macOS):

But you may have to add surrounding quotes to some or all data (“cell”).
You mlust have to use comma instead of tab (as I use tab above)…


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?

Thank you

Sorry, I never used it.

Do you mean to extract sql from a database? Such as:

If TargetWin32 Then
DoeBatch="echo .dump | “+chr(34)+startFI.NativePath+“Sqlite3\sqlite3.exe”+chr(34)+” “+chr(34)+_
HDBdatabaseFI.NativePath+chr(34)+” > “+chr(34)+HDBrepairFI.NativePath+chr(34)
DoeBatch=“echo .dump | “+chr(34)+startFI.NativePath+”/Sqlite3/sqlite3”+chr(34)+” “+chr(34)+_
HDBdatabaseFI.NativePath+chr(34)+” > "+chr(34)+HDBrepairFI.NativePath+chr(34)
end if

1 Like

Please check SQLite in MBS Plug-in:

We have the dump code from SQLite there to export database content. Maybe it helps?


Thanks very much for your time and trouble.



That looks promising. It’s a little above my head, but I can identify enough of it to break it down into sections and start playing with it.

I’ll let you know when I either blow something up or get a readable file.

Thank you,


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.

Thank you,

Assuming that by “Xojo shell”, you mean as in:

Var  sh as new Shell

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.


This method has the advantage of simplicity. I got a multiline script to work with this approach. Now to make it export some .csv.

I’ll keep this thread posted on how I’m doing. The answer above from Josina looks good, but it will take me a while to unravel.

Thank you very much for your trouble. I didn’t even know you could do that -init thing to read a file into sqlite3. Very cool.


I didn’t either, but I went to my macOS Terminal window and typed “man sqlite3” which listed a lot of things. Some may be useful for your case.