Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite .dump command from SQLiteConnection object

Tags:

c#

sqlite

Using SQLite from .net, Is there a way to access the .dump command or something equivalent from the SQLiteConnection class?

like image 429
Stefan Rusek Avatar asked Dec 01 '08 22:12

Stefan Rusek


People also ask

What is the usage of .dump command in SQLite?

The . dump command converts the entire structure and data of an SQLite database into a single text file.

What is SQLiteConnection?

SQLiteConnection is a single connection to sqlite database. It wraps the sqlite3* database handle from SQLite C Interface. Unless otherwise specified, methods are confined to the thread that was used to open the connection.

What is the uses of DOT dump command?

dump command dumps the total database. The above example shows a specific table table1 have been used along with . dump command to dump only the specific table.


1 Answers

The .dump command is part of the sqlite command line program (shell.c), not part of the sqlite library. So, it is unlikely to be provided by a .net connection class.

However, since the source code for the sqlite command line program is in the public domain, and uses the same library as the .net wrapper, it would be possible to translate the C code for the .dump command to C#. See the function do_meta_command in this file.

like image 126
Doug Currie Avatar answered Sep 28 '22 00:09

Doug Currie