カテゴリー:
アプリ ソースコード
閲覧数:436 配信日:2013-07-08 07:14
テーブル設定
sqlite> .show
.show
echo: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdout
separator: "|"
width:
コマンド一覧
sqlite> .help
.help
.bail ON|OFF Stop after hitting an error. Default OFF
.databases List names and files of attached databases
.dump ?TABLE? ... Dump the database in an SQL text format
.echo ON|OFF Turn command echo on or off
.exit Exit this program
.explain ON|OFF Turn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFF Turn display of headers on or off
.help Show this message
.import FILE TABLE Import data from FILE into TABLE
.indices TABLE Show names of all indices on TABLE
.load FILE ?ENTRY? Load an extension library
.mode MODE ?TABLE? Set output mode where MODE is one of:
csv Comma-separated values
column Left-aligned columns. (See .width)
html HTML <table> code
insert SQL insert statements for TABLE
line One value per line
list Values delimited by .separator string
tabs Tab-separated values
tcl TCL list elements
.nullvalue STRING Print STRING in place of NULL values
.output FILENAME Send output to FILENAME
.output stdout Send output to the screen
.prompt MAIN CONTINUE Replace the standard prompts
.quit Exit this program
.read FILENAME Execute SQL in FILENAME
.schema ?TABLE? Show the CREATE statements
.separator STRING Change separator used by output mode and .import
.show Show the current values for various settings
.tables ?PATTERN? List names of tables matching a LIKE pattern
.timeout MS Try opening locked tables for MS milliseconds
.timer ON|OFF Turn the CPU timer measurement on or off
.width NUM NUM ... Set column widths for "column" mode
dumpデータ取得
・処理されているっぽいけど、どこに出力されるか不明
sqlite> .dump ?item?
.dump ?item?
BEGIN TRANSACTION;
COMMIT;
・違うやん。こうか
sqlite> .dump item
.dump item
BEGIN TRANSACTION;
CREATE TABLE item (_id integer primary key,Item text not null);
INSERT INTO "item" VALUES(1,'繝昴Ο繧キ繝」繝・);
INSERT INTO "item" VALUES(2,'鬟イ鬟・);
COMMIT;
・テーブル単位ではなくDB単位で取得する際は、DB名を指定するのではなく省略!
sqlite> .dump
.dump
BEGIN TRANSACTION;
CREATE TABLE android_metadata (locale TEXT);
INSERT INTO "android_metadata" VALUES('ja_JP');
CREATE TABLE aaaa (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
CREATE TABLE '2013-7-7' (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
INSERT INTO "2013-7-7" VALUES(1,'繝昴Ο繧キ繝」繝・,'譛・
','680');
INSERT INTO "2013-7-7" VALUES(2,'鬟イ鬟・,'繝代せ繧ソ','123');
CREATE TABLE '2013-7' (_id integer primary key,Item text not null,Kingaku text);
INSERT INTO "2013-7" VALUES(1,'繝昴Ο繧キ繝」繝・,'1690');
INSERT INTO "2013-7" VALUES(2,'繝昴Ο繧キ繝」繝・,'680');
INSERT INTO "2013-7" VALUES(3,'鬟イ鬟・,'123');
CREATE TABLE item (_id integer primary key,Item text not null);
INSERT INTO "item" VALUES(1,'繝昴Ο繧キ繝」繝・);
INSERT INTO "item" VALUES(2,'鬟イ鬟・);
CREATE TABLE utiwake (_id integer primary key,Utiwake text not null);
INSERT INTO "utiwake" VALUES(1,'譛・
');
INSERT INTO "utiwake" VALUES(2,'繝代せ繧ソ');
INSERT INTO "utiwake" VALUES(3,'');
CREATE TABLE '2013-7-10' (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
CREATE TABLE '2013-7-8' (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
INSERT INTO "2013-7-8" VALUES(1,'繝昴Ο繧キ繝」繝・,'譛・
','1690');
CREATE TABLE '2013-7-9' (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
COMMIT;
dumpデータ出力失敗
ダンプは通常ファイルなどに対し行います。出力先を指定するオプションはありませんので、「.output」コマンドを使って出力先をstdoutからファイルに事前に変更しておき、その後でダンプを行って下さい
・ところが、実際に試すと出力先を指定できない
can't write
.output ./data/dump.txt
can't write to "./data/dump.txt"
.output c://output.txt
can't write to "c://output.txt"
.output /output.txt
can't write to "/output.txt"
指定できるが、出力先パスが不明
sqlite> .output output.txt
.output output.txt
sqlite> .dump
.dump
sqlite> .output androidoutput.txt
.output androidoutput.txt
sqlite> .dump
.dump
sqlite> .output c:dump.txt
.output c:dump.txt
sqlite> .dump
.dump
sqlite> .output C:\output.txt
.output C:\output.txt
sqlite> .dump
.dump
sqlite> .exit
.exit
# ls
ls
C:output.txt
c:dump.txt
androidoutput.txt
output.txt
HousekeepingBook.db
・コマンドプロンプトから「adb shell」遷移先の、Windows全体におけるパスがどこにあるかが不明
・「ls」でファイル存在は確認できるのが、実ファイルがどこにあるか不明
・環境によってパスが異なる?
・確認する方法?
・出力ファイル名で、Windows検索しても見つからないのは、どういうこと?
・Android「adb shell」パスを知りたい
・ローカルファイルの保存先について
・「C:\Users\Administrator\.android\avd\Android1.6.avd」これなの?
SQLite終了
.exit