Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default values for .mode and .headers to control output format in SQLite?

Tags:

sqlite

Normally I use these settings to have SQLite output pretty structure:

sqlite> .mode column
sqlite> .headers on

But how to make them default settings?

like image 403
Lai Yu-Hsuan Avatar asked Jan 18 '12 14:01

Lai Yu-Hsuan


People also ask

How do I change the default value in SQLite?

To set default value for a column in SQLite, use DEFAULT :CREATE TABLE customers ( id INTEGER PRIMARY KEY, store_code TEXT DEFAULT "store1" NOT NULL, name TEXT );

What is the default mode in SQLite?

The . mode command sets the output mode. This determines how the output data is formatted and presented. The optional table name is only used by the insert mode. The default mode is list .

Does SQLite support a BLOB type?

(10) Does SQLite support a BLOB type? SQLite allows you to store BLOB data in any column, even columns that are declared to hold some other type. BLOBs can even be used as PRIMARY KEYs.


1 Answers

From the man page.

If the file ~/.sqliterc exists, it is processed first. can be found in the user's home directory, it is read and processed. It should generally only contain meta-commands.

So put them into ~/.sqliterc.

like image 155
greut Avatar answered Oct 19 '22 04:10

greut