datagen_modify.pl
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PL 代码 · 共 2,533 行 · 第 1/4 页
PL
2,533 行
#!/usr/bin/perlif ( (scalar(@ARGV) != 2 ) || ($ARGV[0] =~ /[^0-9]/i ) ){ if( $ARGV[0] =~ /[^0-9]/i ) { print "\n\nFirst parameter <Rowcount> should be an integer value. \n" } &printusage;}else{ # Case "InnoDB" if ( $ARGV[1] =~ /innodb/i ) { # First Table "tb1.txt" $file = 'innodb_tb1.txt'; open ( FILE_INPUT, ">$file"); $oldhandle = select(FILE_INPUT);#Data type declarations $s_int = 0; $u_int = 0; srand(); #Write data to file for ($count=0; $count < $ARGV[0]; $count++) { $u_int++; $char = &get_next_char($count); $char_0 = &get_next_char_0($count); $longtext = &get_next_longtext($count); $tinytext = &get_next_tinytext($count); $s_int = &get_next_s_int($count,$ARGV[0]); $decimal = $count. "\." .$count; print ($char_0); #char(0)## print ("\t",$char_0); #char binary(0)## print ("\t",$char_0); #char ascii(0)## print ("\t",$tinytext); #tiny text unicode## print ("\t",$tinytext); #text print ("\t",$longtext); #medium text print ("\t",$longtext); #long text print ("\t",$tinytext); #tiny blob print ("\t",$tinytext); #blob print ("\t",$longtext); #medium blob print ("\t",$longtext); #long blob print ("\t",$char); #binary print ("\t",&random(127)); #tiny int print ("\t",&random(255)); #tiny int unsigned print ("\t",&random(127)); #tiny int zerofill print ("\t",&random(255)); #tiny int unsigned zerofill print ("\t",&random(32767)); #smallint print ("\t",&random(65535)); #smallint unsigned print ("\t",&random(32767)); #smallint zerofill print ("\t",&random(65535)); #smallint unsigned zerofill print ("\t",$s_int); #mediumint print ("\t",$u_int); #mediumint unsigned print ("\t",$u_int); #mediumint zerofill print ("\t",$u_int); #mediumint unsigned zerofill print ("\t",$s_int); #int print ("\t",$u_int); #int unsigned print ("\t",$u_int); #int zerofill print ("\t",$u_int); #int unsigned zerofill print ("\t",$s_int); #bigint print ("\t",$u_int); #bigint unsigned print ("\t",$u_int); #bigint zerofill print ("\t",$u_int); #bigint unsigned zerofill print ("\t",$s_int); #decimal print ("\t",$u_int); #decimal unsigned print ("\t",$u_int); #decimal zerofill print ("\t",$u_int); #decimal unsigned zerofill not null print ("\t",$s_int); #decimal(0) not null print ("\t",$s_int); #decimal(254) not null print ("\t",$u_int); #decimal (0) unsigned not null print ("\t",$u_int); #decimal (254) unsigned not null print ("\t",$u_int); #decimal(0) zerofill not null print ("\t",$u_int); #decimal(254) zerofill not null print ("\t",$u_int); #decimal (0) unsigned zerofill not null print ("\t",$u_int); #decimal (254) unsigned zerofill not null print ("\t",$s_int); #decimal (0,0) not null print ("\t",$decimal); #decimal(253,253) not null print ("\t",$u_int); #decimal (0,0) unsigned not null print ("\t",$decimal); #decimal (253,253) unsigned not null print ("\t",$u_int); #decimal(0,0) zerofill not null print ("\t",$decimal); #decimal(253,253) zerofill not null print ("\t",$u_int); #decimal (0,0) unsigned zerofill not null print ("\t",$decimal); #decimal (253,253) unsigned zerofill not null print ("\t",$s_int); #numeric not null print ("\t",$u_int); #numeric unsigned not null print ("\t",$u_int); #numeric zerofill not null print ("\t",$u_int); #numeric unsigned zerofill not null print ("\t",$s_int); #numeric(0) not null print ("\t",$s_int); #numeric(254) not null print ("\n"); } select ($oldhandle); close (FILE_INPUT);# Second Table "tb2.txt" $file = 'innodb_tb2.txt'; open ( FILE_INPUT, ">$file"); $oldhandle = select(FILE_INPUT); $s_int = 0; $u_int = 0; $enum = 1; $set = 1; $int=0; $current_time = "838:59:59"; $s_time = "00:00:00"; $s_date = "1970-01-01"; $current_date = "1000-01-00"; $current_year = 1901; $u_current_float = 1.175494351e-38; $s_current_float = -1.175494351e-38; srand(); #Write data to file for ($count=0; $count < $ARGV[0]; $count++) { $u_int++; $char = &get_next_char($count); $s_int = &get_next_s_int($count,$ARGV[0]); $longtext = &get_next_longtext($count); $tinytext = &get_next_tinytext($count); $decimal = $count. "\." .$count; $int = &get_next_int($int); $enum = &get_next_enum($enum); $set = &get_next_set($set); $current_date = &get_next_date($current_date); $current_time = &get_next_time($current_time); $current_year = &get_next_year($current_year); $u_current_float = &get_next_float($u_current_float); $s_current_float = &get_next_float($s_current_float); $s_time = &get_next_s_time($s_time); $s_date = &get_next_s_date($s_date); $datetime = &get_next_datetime($s_date,$s_time); $timestamp = &get_next_timestamp($s_date,$s_time); print ($u_int); #numeric (0) unsigned print ("\t",$u_int); #numeric (254) unsigned print ("\t",$u_int); #numeric (0) zerofill print ("\t",$u_int); #numeric (254) zerofill print ("\t",$u_int); #numeric (0) unsigned zerofill print ("\t",$u_int); #numeric (254) unsigned zerofill print ("\t",$s_int); #numeric (0,0) print ("\t",$decimal); #numeric (253,253) print ("\t",$u_int); #numeric (0,0) unsigned print ("\t",$decimal); #numeric (253,253) unsigned print ("\t",$u_int); #numeric (0,0) zerofill print ("\t",$decimal); #numeric (253,253) zerofill print ("\t",$u_int); #numeric (0,0) unsigned zerofill print ("\t",$decimal); #numeric (253,253) unsigned zerofill print ("\t",$s_current_float); #real print ("\t",$u_current_float); #real unsigned print ("\t",$u_current_float); #real zerofill print ("\t",$u_current_float); #real unsigned zerofill print ("\t",$s_current_float); #double print ("\t",$u_current_float); #double unsigned print ("\t",$u_current_float); #double zerofill print ("\t",$u_current_float); #double unsigned zerofill print ("\t",$s_current_float); #float not null print ("\t",$u_current_float); #float unsigned not null print ("\t",$u_current_float); #float zerofill not null print ("\t",$u_current_float); #float unsigned zerofill not null print ("\t",$s_current_float); #float(0) not null print ("\t",$s_current_float); #float(23) not null print ("\t",$u_current_float); #float(0) unsigned not null print ("\t",$u_current_float); #float(23) unsigned not null print ("\t",$u_current_float); #float(0) zerofill not null print ("\t",$u_current_float); #float(23) zerofill not null print ("\t",$u_current_float); #float(0) unsigned zerofill not null print ("\t",$u_current_float); #float(23) unsigned zerofill not null print ("\t",$s_current_float); #float(24) not null print ("\t",$s_current_float); #float(53) not null print ("\t",$u_current_float); #float(24) unsigned not null print ("\t",$u_current_float); #float(53) unsigned not null print ("\t",$u_current_float); #float(24) zerofill not null print ("\t",$u_current_float); #float(53) zerofill not null print ("\t",$u_current_float); #float(24) unsigned zerofill not null print ("\t",$u_current_float); #float(53) unsigned zerofill not null print ("\t",$current_date); #date not null print ("\t",$current_time); #time not null print ("\t",$datetime); #datetime not null print ("\t",$timestamp); #timestamp not null print ("\t",$current_year); #year not null print ("\t",$current_year); #year(3) not null print ("\t",$current_year); #year(4) not null print ("\t",$enum); #enum("1enum","2enum") not null print ("\t",$set); #set("1set","2set") not null print ("\n"); } select ($oldhandle); close (FILE_INPUT);# Third Table "tb3.txt" $file = 'innodb_tb3.txt'; open ( FILE_INPUT, ">$file"); $oldhandle = select(FILE_INPUT); $u_int = 0; srand(); #Write data to file for ($count=0; $count < $ARGV[0]; $count++) { $u_int++; $char = &get_next_char($count); $longtext = &get_next_longtext($count); $tinytext = &get_next_tinytext($count); $s_int = &get_next_s_int($count,$ARGV[0]); $decimal = $count. "\." .$count; print ($char); #char not null print ("\t",$char); #char binary not null print ("\t",$char); #char ascii not null print ("\t",$tinytext); #tinytext not null print ("\t",$tinytext); #text not null print ("\t",$longtext); #mediumtext not null print ("\t",$longtext); #longtext not null unicode## print ("\t",$tinytext); #tinyblob not null print ("\t",$tinytext); #blob not null print ("\t",$longtext); #mediumblob not null print ("\t",$longtext); #longblob not null print ("\t",$char); #binary not null print ("\t",&random(127)); #tinyint not null print ("\t",&random(255)); #tinyint unsigned not null print ("\t",&random(127)); #tinyint zerofill not null print ("\t",&random(255)); #tinyint unsigned zerofill not null print ("\t",&random(32767)); #smallint not null print ("\t",&random(65535)); #smallint unsigned not null print ("\t",&random(32767)); #smallint zerofill not null print ("\t",&random(65535)); #smallint unsigned zerofill not null print ("\t",$s_int); #mediumint not null print ("\t",$u_int); #mediumint unsigned not null print ("\t",$u_int); #mediumint zerofill not null print ("\t",$u_int); #mediumint unsigned zerofill not null print ("\t",$s_int); #int not null print ("\t",$u_int); #int unsigned not null print ("\t",$u_int); #int zerofill not null print ("\t",$u_int); #int unsigned zerofill not null print ("\t",$s_int); #bigint not null print ("\t",$u_int); #bigint unsigned not null print ("\t",$u_int); #bigint zerofill not null print ("\t",$u_int); #bigint unsigned zerofill not null print ("\t",$s_int); #decimal not null print ("\t",$u_int); #decimal unsigned not null print ("\t",$u_int); #decimal zerofill not null print ("\t",$u_int); #decimal unsigned zerofill print ("\t",$s_int); #decimal(0) print ("\t",$s_int); #decimal(254) print ("\t",$u_int); #decimal (0) unsigned print ("\t",$u_int); #decimal (254) unsigned print ("\t",$u_int); #decimal(0) zerofill print ("\t",$u_int); #decimal(254) zerofill print ("\t",$u_int); #decimal (0) unsigned zerofill print ("\t",$u_int); #decimal (254) unsigned zerofill print ("\t",$s_int); #decimal (0,0) print ("\t",$decimal); #decimal(253,253) print ("\t",$u_int); #decimal (0,0) unsigned print ("\t",$decimal); #decimal (253,253) unsigned print ("\t",$u_int); #decimal(0,0) zerofill print ("\t",$decimal); #decimal(253,253) zerofill print ("\t",$u_int); #decimal (0,0) unsigned zerofill print ("\t",$decimal); #decimal (253,253) unsigned zerofill print ("\t",$s_int); #numeric print ("\t",$u_int); #numeric unsigned print ("\t",$u_int); #numeric zerofill print ("\t",$u_int); #numeric unsigned zerofill print ("\t",$s_int); #numeric(0) print ("\t",$s_int); #numeric(254) print ("\n"); } select ($oldhandle); close (FILE_INPUT);# Fourth Table "tb4.txt" $file = 'innodb_tb4.txt'; open ( FILE_INPUT, ">$file"); $oldhandle = select(FILE_INPUT); $enum = 1; $ret_bit = 1; $set = 1; $s_int = 0; $u_int = 0; $int=0; $s_time = "00:00:00"; $s_date = "1970-01-01"; $current_time = "838:59:59"; $current_date = "1000-01-00"; $current_year = 1901; $u_current_float = 1.175494351e-38; $s_current_float = -1.175494351e-38; srand(); #Write data to file for ($count=0; $count < $ARGV[0]; $count++) { $u_int++;# $bit = &get_next_bit(0); $char = &get_next_char($count); $char_0 = &get_next_char_0($count); $char_55 = &get_next_char_55($count); $char_90 = &get_next_char_90($count); $char_100 = &get_next_char_100($count); $char_255 = &get_next_char_255($count); $varchar_500 = &get_next_varchar_500($count); $longtext = &get_next_longtext($count); $tinytext = &get_next_tinytext($count); $s_int = &get_next_s_int($count,$ARGV[0]); $decimal = $count. "\." .$count; $int = &get_next_int($int); $enum = &get_next_enum($enum); $set = &get_next_set($set); $current_date = &get_next_date($current_date);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?