バッチ処理結果をカスタマイズする。
–html HTMLフォーマット出力 (-H)
–xml XMLフォーマット出力 (-X)
–verbose 詳細表示(-v , -vv, -vvv) (-v)
–table TABLE形式で出力 (-t)
–skip-column-names カラムを表示しない (-N)
–columun-names カラムを表示
–execute=name 指定したクエリーを実行する (-e)
–force エラーを無視して続行 (-f)
[root@colinux ~]# ls
backupfiles mysql–help.txt select_batch1.sql
[root@colinux ~]# mysql test < select_batch1.sql -p --html > select_batch1.html
Enter password:
[root@colinux ~]# cat select_batch1.html
id | name | comment |
---|---|---|
1 | < TD>SHOW WARINtest update | |
2 | SHOW WARIN | 22222222222 |
3 | select_lim | test 20090117 |
4 | select_lim | test 20090117 |
5 | s elect_lim | test 20090117 |
6 | select_lim | te st 20090117 |
7 | select_lim | test 20090117 |
8 | select_lim | test 20090117 |
9 | s elect_lim | test 20090117 |
[root@colinux ~]#
[root@colinux ~]# mysql test < select_batch1.sql -p --table > select_batch1.txt
Enter password:
[root@colinux ~]# cat select_batch1.txt
+—-+————+—————+
| id | name | comment |
+—-+————+—————+
| 1 | SHOW WARIN | test update |
| 2 | SHOW WARIN | 22222222222 |
| 3 | select_lim | test 20090117 |
| 4 | select_lim | test 20090117 |
| 5 | select_lim | test 20090117 |
| 6 | select_lim | test 20090117 |
| 7 | select_lim | test 20090117 |
| 8 | select_lim | test 20090117 |
| 9 | select_lim | test 20090117 |
+—-+————+—————+
[root@colinux ~]#
[root@colinux ~]# mysql test < select_batch1.sql -p -vvv
Enter password:
--------------
select * from test.T1
--------------
+----+------------+---------------+
| id | name | comment |
+----+------------+---------------+
| 1 | SHOW WARIN | test update |
| 2 | SHOW WARIN | 22222222222 |
| 3 | select_lim | test 20090117 |
| 4 | select_lim | test 20090117 |
| 5 | select_lim | test 20090117 |
| 6 | select_lim | test 20090117 |
| 7 | select_lim | test 20090117 |
| 8 | select_lim | test 20090117 |
| 9 | select_lim | test 20090117 |
+----+------------+---------------+
9 rows in set (0.00 sec)
Bye
[root@colinux ~]#
[root@colinux ~]# mysql test < select_batch1.sql -p --skip-column-names
Enter password:
1 SHOW WARIN test update
2 SHOW WARIN 22222222222
3 select_lim test 20090117
4 select_lim test 20090117
5 select_lim test 20090117
6 select_lim test 20090117
7 select_lim test 20090117
8 select_lim test 20090117
9 select_lim test 20090117
[root@colinux ~]#
■HTMLフォーマット
■テーブルフォーマット
■Colums無し (他のバッチ連携などに便利)