バッチ処理結果をカスタマイズする。

–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

< TD>SHOW WARIN
idnamecomment
1test update
2SHOW WARIN
22222222222
3select_limtest 20090117
4select_limtest 20090117
5s
elect_lim
test 20090117
6select_limte
st 20090117
7select_limtest 20090117
8select_limtest 20090117
9s
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フォーマット batch_html

■テーブルフォーマット
batch_table_format

■Colums無し (他のバッチ連携などに便利)
batch_no_colum

Comments are closed.

Post Navigation