⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crash-me

📁 开启mysql的远程连接的方法 mysql-noinstall-5.1.6-alpha-win32.zip
💻
📖 第 1 页 / 共 3 页
字号:
#!/usr/bin/perl# -*- perl -*-# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB## This library is free software; you can redistribute it and/or# modify it under the terms of the GNU Library General Public# License as published by the Free Software Foundation; either# version 2 of the License, or (at your option) any later version.## This library is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU# Library General Public License for more details.## You should have received a copy of the GNU Library General Public# License along with this library; if not, write to the Free# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,# MA 02111-1307, USA# Written by Monty for the TCX/Monty Program/Detron benchmark suite.# Empress and PostgreSQL patches by Luuk de Boer# Extensions for ANSI SQL and Mimer by Bengt Gunne# Some additions and corrections by Matthias Urlich## This programs tries to find all limits for a sql server# It gets the name from what it does to most servers :)## Be sure to use --help before running this!## If you want to add support for another server, add a new package for the# server in server-cfg.  You only have to support the 'new' and 'version'# functions. new doesn't need to have any limits if one doesn't want to# use the benchmarks.## TODO:# CMT includes types and functions which are synonyms for other types# and functions, including those in SQL9x. It should label those synonyms# as such, and clarify ones such as "mediumint" with comments such as# "3-byte int" or "same as xxx".$version="1.61";use Cwd;use DBI;use Getopt::Long;use POSIX;$pwd = cwd(); $pwd = "." if ($pwd eq '');require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";$opt_server="mysql"; $opt_host="localhost"; $opt_database="test";$opt_dir="limits";$opt_user=$opt_password="";$opt_verbose=1;$opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0;$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=$opt_version=0;$opt_db_start_cmd="";           # the db server start command$opt_check_server=0;		# Check if server is alive before each query$opt_sleep=10;                  # time to sleep while starting the db server$limit_changed=0;               # For configure file$reconnect_count=0;$opt_suffix="";$opt_comment=$opt_config_file=$opt_log_queries_to_file="";$limits{'crash_me_safe'}='yes';$prompts{'crash_me_safe'}='crash me safe';$limits{'operating_system'}= machine();$prompts{'operating_system'}='crash-me tested on';$retry_limit=3;GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s","batch-mode","config-file=s","log-queries-to-file=s","check-server","version","verbose!" => \$opt_verbose) || usage();usage() if ($opt_help || $opt_Information);version() && exit(0) if ($opt_version);$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0);$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg"  if (length($opt_config_file) == 0);$log_prefix='   ###';  # prefix for log lines in result file$safe_query_log='';$safe_query_result_log='';$log{"crash-me"}="";#!!!if ($opt_fix_limit_file){  print "Fixing limit file for $opt_server\n";  read_config_data();  $limit_changed=1;  save_all_config_data();  exit 0;}$server=get_server($opt_server,$opt_host,$opt_database);$opt_server=$server->{'cmp_name'};$|=1;                           # For debuggingprint "Running $0 $version on '",($server_version=$server->version()),"'\n\n";print "I hope you didn't have anything important running on this server....\n";read_config_data();if ($limit_changed)             # Must have been restarted{  save_config_data('crash_me_safe','no',"crash me safe");}if (!$opt_force && !$opt_batch_mode){  server_info();}else{  print "Using --force.  I assume you know what you are doing...\n";}print "\n";save_config_data('crash_me_version',$version,"crash me version");if ($server_version){  save_config_data('server_version',$server_version,"server version");}if (length($opt_comment)){  save_config_data('user_comment',$opt_comment,"comment");}$opt_log=0;if (length($opt_log_queries_to_file)){  open(LOG,">$opt_log_queries_to_file") ||     die "Can't open file $opt_log_queries_to_file\n";  $opt_log=1;}## Set up some limits that's regared as unlimited# We don't want to take up all resources from the server...#$max_connections="+1000";       # Number of simultaneous connections$max_buffer_size="+16000000";   # size of communication buffer.$max_string_size="+8000000";    # Enough for this test$max_name_length="+512";        # Actually 256, but ...$max_keys="+64";                # Probably too big.$max_join_tables="+64";         # Probably too big.$max_columns="+8192";           # Probably too big.$max_row_length=$max_string_size;$max_key_length="+8192";        # Big enough$max_order_by="+64";		# Big enough$max_expressions="+10000";$max_big_expressions="+100";$max_stacked_expressions="+2000";$query_size=$max_buffer_size;$longreadlen=16000000;		# For retrieval buffer## First do some checks that needed for the rest of the benchmark#use sigtrap;		       # Must be removed with perl5.005_2 on Win98$SIG{PIPE} = 'IGNORE';$problem_counter=0;$SIG{SEGV} = sub {  $problem_counter +=1;  if ($problem_counter >= 100) {    die("Too many problems, try to restart");  } else {    warn('SEGFAULT');  };    };$dbh=safe_connect();## Test if the database require RESTRICT/CASCADE after DROP TABLE## Really remove the crash_me table$prompt="drop table require cascade/restrict";$drop_attr="";$dbh->do("drop table crash_me");$dbh->do("drop table crash_me cascade");if (!safe_query_l('drop_requires_cascade',         ["create table crash_me (a integer not null)",		 "drop table crash_me"])){  $dbh->do("drop table crash_me cascade");    if (safe_query_l('drop_requires_cascade',        ["create table crash_me (a integer not null)",		  "drop table crash_me cascade"]))  {    save_config_data('drop_requires_cascade',"yes","$prompt");    $drop_attr="cascade";  }  else  {    die "Can't create and drop table 'crash_me'\n";  }}else{  save_config_data('drop_requires_cascade',"no","$prompt");  $drop_attr="";}# Remove tables from old runs$dbh->do("drop table crash_me $drop_attr");$dbh->do("drop table crash_me2 $drop_attr");$dbh->do("drop table crash_me3 $drop_attr");$dbh->do("drop table crash_q $drop_attr");$dbh->do("drop table crash_q1 $drop_attr");$prompt="Tables without primary key";if (!safe_query_l('no_primary_key',      ["create table crash_me (a integer not null,b char(10) not null)",		 "insert into crash_me (a,b) values (1,'a')"])){  if (!safe_query_l('no_primary_key',      ["create table crash_me (a integer not null,b char(10) not null".        ", primary key (a))",	 "insert into crash_me (a,b) values (1,'a')"]))  {    die "Can't create table 'crash_me' with one record: $DBI::errstr\n";  }  save_config_data('no_primary_key',"no",$prompt);}else{  save_config_data('no_primary_key',"yes",$prompt);}##  Define strings for character NULL and numeric NULL used in expressions#$char_null=$server->{'char_null'};$numeric_null=$server->{'numeric_null'};if ($char_null eq ''){  $char_null="NULL";}if ($numeric_null eq ''){  $numeric_null="NULL";}print "$prompt: $limits{'no_primary_key'}\n";report("SELECT without FROM",'select_without_from',"select 1");if ($limits{'select_without_from'} ne "yes"){  $end_query=" from crash_me";  $check_connect="select a from crash_me";}else{  $end_query="";  $check_connect="select 1";}assert($check_connect);assert("select a from crash_me where b<'b'");report("Select constants",'select_constants',"select 1 $end_query");report("Select table_name.*",'table_wildcard',       "select crash_me.* from crash_me");report("Allows \' and \" as string markers",'quote_with_"',       'select a from crash_me where b<"c"');check_and_report("Double '' as ' in strings",'double_quotes',[],		 "select 'Walker''s' $end_query",[],"Walker's",1);check_and_report("Multiple line strings","multi_strings",[],		 "select a from crash_me where b < 'a'\n'b'",[],"1",0);check_and_report("\" as identifier quote (ANSI SQL)",'quote_ident_with_"',[],		 'select "A" from crash_me',[],"1",0);check_and_report("\` as identifier quote",'quote_ident_with_`',[],		 'select `A` from crash_me',[],"1",0);check_and_report("[] as identifier quote",'quote_ident_with_[',[],		 'select [A] from crash_me',[],"1",0);report('Double "" in identifiers as "','quote_ident_with_dbl_"',        'create table crash_me1 ("abc""d" integer)',	'drop table crash_me1');		 report("Column alias","column_alias","select a as ab from crash_me");report("Table alias","table_alias","select b.a from crash_me as b");report("Functions",'functions',"select 1+1 $end_query");report("Group functions",'group_functions',"select count(*) from crash_me");report("Group functions with distinct",'group_distinct_functions',       "select count(distinct a) from crash_me");report("Group functions with several distinct",'group_many_distinct_functions',       "select count(distinct a), count(distinct b) from crash_me");report("Group by",'group_by',"select a from crash_me group by a");report("Group by position",'group_by_position',       "select a from crash_me group by 1");report("Group by alias",'group_by_alias',       "select a as ab from crash_me group by ab");report("Group on unused column",'group_on_unused',       "select count(*) from crash_me group by a");report("Order by",'order_by',"select a from crash_me order by a");report("Order by position",'order_by_position',       "select a from crash_me order by 1");report("Order by function","order_by_function",       "select a from crash_me order by a+1");report("Order by on unused column",'order_on_unused',       "select b from crash_me order by a");# little bit deprecated#check_and_report("Order by DESC is remembered",'order_by_remember_desc',#		 ["create table crash_q (s int,s1 int)",#		  "insert into crash_q values(1,1)",#		  "insert into crash_q values(3,1)",#		  "insert into crash_q values(2,1)"],#		 "select s,s1 from crash_q order by s1 DESC,s",#		 ["drop table crash_q $drop_attr"],[3,2,1],7,undef(),3);report("Compute",'compute',       "select a from crash_me order by a compute sum(a) by a");report("INSERT with Value lists",'insert_multi_value',       "create table crash_q (s char(10))",       "insert into crash_q values ('a'),('b')",       "drop table crash_q $drop_attr");report("INSERT with set syntax",'insert_with_set',       "create table crash_q (a integer)",       "insert into crash_q SET a=1",       "drop table crash_q $drop_attr");report("INSERT with DEFAULT","insert_with_default",       "create table crash_me_q (a int)",       "insert into crash_me_q (a) values (DEFAULT)",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -