偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

MySQL導(dǎo)出 XLS 數(shù)據(jù)庫工具的實(shí)際操作

數(shù)據(jù)庫 MySQL
此文章主要描述的是從MySQL導(dǎo)出 XLS 數(shù)據(jù)庫工具,我前兩天在相關(guān)網(wǎng)站看見MySQL導(dǎo)出 XLS 數(shù)據(jù)庫工具的資料,覺得挺不錯(cuò)的,拿出來和大家分享。

以下的文章主要介紹的是從MySQL導(dǎo)出 XLS 數(shù)據(jù)庫工具的介紹,XLS 數(shù)據(jù)庫工具之所以能在很短的時(shí)間內(nèi)被人們廣泛的應(yīng)用,原因也是因?yàn)樗?dú)特的功能。以下的文章主要介紹的是MySQL導(dǎo)出 XLS 數(shù)據(jù)庫工具的實(shí)際應(yīng)用。

 

 

  1. warn "write to: $ARGV[0]/n";  

生成GB2312編碼系統(tǒng)

 

  1. my $map = Unicode::Map->new("gb2312");  

產(chǎn)生報(bào)表

my $report = Spreadsheet::WriteExcel::Big->new("$ARGV[0]") || die "不能生成報(bào)表文件:$!";

創(chuàng)建報(bào)表的工作表

 

  1. my $sheet = $report->add_worksheet('data_report');  

創(chuàng)建格式

 

  1. my $title_style = $report->add_format(); $title_style->set_size(11); $title_style->set_bold(); $title_style->set_align('center');  

初始化數(shù)據(jù)指針

 

  1. my $sheet_col = 0;  

從MySQL中導(dǎo)出XLS數(shù)據(jù)庫工具中創(chuàng)建表格

 

  1. for (my $i=0;$i<=$cols_name ;$i++) {   
  2. $sheet->set_column($cols[$i], length($cols_name[$i])+4);   
  3. $sheet->write_unicode($sheet_col,$i,$map->to_unicode($cols_name[$i]),$title_style);   
  4. }   

 

$sheet->freeze_panes(1, 0);凍結(jié)行

 

  1. while (my @row = $sth->fetchrow_array) {   
  2. $sheet_col++;   
  3. for (my $i=0;$i<=$cols_name ;$i++) {   
  4. next if ($row[$i] eq '');   
  5. $sheet->write_unicode($sheet_col,$i,$map->to_unicode($row[$i]));   
  6. }   
  7. }   
  8. warn "all done!!!/n";   

 

結(jié)束

 

  1. END {   
  2. $report->close() if ($report);   
  3. $dbh->disconnect();   
  4. warn "write to: $ARGV[0]/n";   

 

生成GB2312編碼系統(tǒng)

 

  1. my $map = Unicode::Map->new("gb2312");  

產(chǎn)生報(bào)表

my $report = Spreadsheet::WriteExcel::Big->new("$ARGV[0]") || die "不能生成報(bào)表文件:$!";

創(chuàng)建報(bào)表的工作表

 

  1. my $sheet = $report->add_worksheet('data_report');  

創(chuàng)建格式

 

  1. my $title_style = $report->add_format(); $title_style->set_size(11); $title_style->set_bold(); $title_style->set_align('center');  

初始化數(shù)據(jù)指針

 

  1. my $sheet_col = 0;  

創(chuàng)建表格

 

  1. for (my $i=0;$i<=$cols_name ;$i++) {   
  2. $sheet->set_column($cols[$i], length($cols_name[$i])+4);   
  3. $sheet->write_unicode($sheet_col,$i,$map->to_unicode($cols_name[$i]),$title_style);   
  4. }   

 

$sheet->freeze_panes(1, 0);凍結(jié)行

 

  1. while (my @row = $sth->fetchrow_array) {   
  2. $sheet_col++;   
  3. for (my $i=0;$i<=$cols_name ;$i++) {   
  4. next if ($row[$i] eq '');   
  5. $sheet->write_unicode($sheet_col,$i,$map->to_unicode($row[$i]));   
  6. }   
  7. }   
  8. warn "all done!!!/n";   

 

結(jié)束

 

  1. END {   
  2. $report->close() if ($report);   
  3. $dbh->disconnect();   
  4. }   

 

以上的相關(guān)內(nèi)容就是對(duì)從MySQL導(dǎo)出XLS數(shù)據(jù)庫工具的介紹,望你能有所收獲。

【編輯推薦】

  1. MySQL使用方法的經(jīng)驗(yàn)大匯總
  2. MySQL mysqldump命令的正確應(yīng)用
  3. 實(shí)現(xiàn)MySQL 用戶密碼的設(shè)置步驟
  4. MySQL數(shù)據(jù)庫安全設(shè)置的操作流程
  5. MySQL基本操作,新手入門寶典
責(zé)任編輯:佚名 來源: cnblogs
相關(guān)推薦

2010-05-19 15:12:32

導(dǎo)入MySQL

2010-05-20 17:56:43

2010-05-27 14:55:40

簡單備份MySQL

2010-06-12 09:53:19

2010-05-17 10:11:11

導(dǎo)入Mysql

2010-05-19 16:31:38

MySQL數(shù)據(jù)庫

2010-05-13 10:19:54

2010-05-28 13:48:07

MySQL數(shù)據(jù)庫密碼

2010-06-01 10:17:01

重啟MySQL數(shù)據(jù)庫

2010-06-01 17:45:57

MySQL數(shù)據(jù)庫

2010-05-20 16:35:12

2010-05-20 10:10:30

MySQL數(shù)據(jù)庫同步

2010-05-31 16:17:56

MySQL數(shù)據(jù)庫性能

2010-06-02 13:58:30

MySQL數(shù)據(jù)庫性能

2010-05-27 10:17:24

連接MySQL

2010-05-31 18:16:48

MySQL數(shù)據(jù)庫備份

2010-06-04 10:59:54

MySQL數(shù)據(jù)庫返回影

2010-05-18 11:18:16

MySql 新建

2010-06-01 13:58:24

遠(yuǎn)程連接MySQL

2010-05-14 16:49:43

MySQL 數(shù)據(jù)庫
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)