大前提
状態:試行錯誤中
閲覧数:1,944
投稿日:2013-08-10
更新日:2013-08-15
DB構成
DB構成
Active code page: 65001
C:\Users\Administrator>chcp
Active code page: 65001
C:\Users\Administrator>adb shell
# cd data/data/com.fc2.blog98.andromaker.housekeepingbook/databases
cd data/data/com.fc2.blog98.andromaker.housekeepingbook/databases
# ls
ls
output.txt
androidoutput.txt
c:dump.txt
C:output.txt
HousekeepingBook.db
# sqlite3 HousekeepingBook.db
sqlite3 HousekeepingBook.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .tables
.tables
2013-7 2013-7-22 2013-7-8 2013-8-8
2013-7-1 2013-7-23 2013-7-9 aaaa
2013-7-10 2013-7-24 2013-8 android_metadata
2013-7-11 2013-7-25 2013-8-1 item
2013-7-13 2013-7-26 2013-8-10 utiwake
2013-7-14 2013-7-27 2013-8-2
2013-7-16 2013-7-29 2013-8-5
2013-7-17 2013-7-7 2013-8-7
sqlite> .headers on
.headers on
sqlite> .show
.show
echo: off
explain: off
headers: on
mode: list
nullvalue: ""
output: stdout
separator: "|"
width:
sqlite> select * from aaaa;
select * from aaaa;
sqlite> select * from item;
select * from item;
_id|Item
1|ポロシャツ
2|飲食
3|
sqlite> select * from utiwake;
select * from utiwake;
_id|Utiwake
1|服
2|パスタ
3|
sqlite> select * from '2013-7';
select * from '2013-7';
_id|Item|Kingaku
1|ポロシャツ|1690
2|ポロシャツ|680
3|飲食|123
4|ポロシャツ|12
5|ポロシャツ|345
6|飲食|789
sqlite> select * from '2013-7-16';
select * from '2013-7-16';
_id|Item|Utiwake|Kingaku
1|ポロシャツ|パスタ|345
2|飲食|パスタ|789
sqlite> .exit
.exit
・テーブルスキーマ情報
sqlite> .schema aaaa
.schema aaaa
CREATE TABLE aaaa (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
sqlite> .schema item
.schema item
CREATE TABLE item (_id integer primary key,Item text not null);
sqlite> .schema utiwake
.schema utiwake
CREATE TABLE utiwake (_id integer primary key,Utiwake text not null);
sqlite> .schema '2013-7'
.schema '2013-7'
CREATE TABLE '2013-7' (_id integer primary key,Item text not null,Kingaku text);
sqlite> .schema '2013-7-16'
.schema '2013-7-16'
CREATE TABLE '2013-7-16' (_id integer primary key,Item text not null,Utiwake text,Kingaku text);
※トリガー利用形式なし
一覧
テーブル名 | 生成クラス名 | 生成メソッド名 | テーブル内容 | 呼出箇所 | |
---|---|---|---|---|---|
1 | aaaa | SubOpenHelper | onCreate | 空 | onCreateメソッド |
2 | item | Item | createTable | 項目 | onClickメソッド |
3 | utiwake | Item | createTable | 内訳 | onClickメソッド |
4 | 月 | HousekeepingBook | createMonthTable | 月 | onCreateメソッド |
5 | 日 | HousekeepingBook | createTable | 日 | onCreateメソッド |
テーブル構成
aaaaテーブル
・データ空
・実際には利用されていない
・SubOpenHelperクラスのonCreateメソッドは、データベースが一番最初に作られたときのみ(コンストラクタに渡されたDBファイル名が存在しない場合に)呼ばれる処理
itemテーブル
・ItemクラスのcreateTableメソッドは、「記入ボタン」クリックで呼出
_id | Item |
---|---|
1 | 服 |
2 | 飲食 |
utiwakeテーブル
・ItemクラスのcreateTableメソッドは、「記入ボタン」クリックで呼出
_id | Utiwake |
---|---|
1 | ポロシャツ |
2 | パスタ |
月テーブル'2013-7'
・HousekeepingBookクラスのcreateMonthTableメソッドは、インスタンス生成時点で呼出
_id | Item | Kingaku |
---|---|---|
1 | ポロシャツ | 1690 |
2 | ポロシャツ | 680 |
日テーブル'2013-7-16'
・HousekeepingBookクラスのcreateTableメソッドは、インスタンス生成時点で呼出
_id | Item | Utiwake | Kingaku |
---|---|---|---|
1 | 服 | ポロシャツ | 345 |
2 | 飲食 | パスタ | 789 |