mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge with 4.0
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-compile-netware-standard: Delete: netware/BUILD/compile-netware-standard BitKeeper/deleted/.del-mwenv: Delete: netware/BUILD/mwenv BitKeeper/deleted/.del-nwbootstrap: Delete: netware/BUILD/nwbootstrap BitKeeper/deleted/.del-compile-AUTOTOOLS: Delete: netware/BUILD/compile-AUTOTOOLS BitKeeper/deleted/.del-compile-linux-tools: Delete: netware/BUILD/compile-linux-tools BitKeeper/deleted/.del-compile-netware-END: Delete: netware/BUILD/compile-netware-END BitKeeper/deleted/.del-compile-netware-START: Delete: netware/BUILD/compile-netware-START BitKeeper/deleted/.del-compile-netware-all: Delete: netware/BUILD/compile-netware-all BitKeeper/deleted/.del-compile-netware-debug: Delete: netware/BUILD/compile-netware-debug BitKeeper/deleted/.del-mwasmnlm~bc5746809d67feb5: Auto merged BitKeeper/deleted/.del-mwenv~35c8b56062f4b6aa: Auto merged BitKeeper/deleted/.del-mwccnlm~be63afd25a14c3f: Auto merged BitKeeper/deleted/.del-mwldnlm~efb26c57cba3c980: Auto merged BitKeeper/deleted/.del-netware.patch~f70a3a965f54d9ee: Auto merged Docs/internals.texi: Auto merged VC++Files/bdb/bdb.dsp: Auto merged VC++Files/bdb/build_win32/Berkeley_DB.dsw: Auto merged VC++Files/bdb/build_win32/db_archive.dsp: Auto merged VC++Files/bdb/build_win32/db_buildall.dsp: Auto merged VC++Files/bdb/build_win32/db_checkpoint.dsp: Auto merged VC++Files/bdb/build_win32/db_deadlock.dsp: Auto merged VC++Files/bdb/build_win32/db_dll.dsp: Auto merged VC++Files/bdb/build_win32/db_dump.dsp: Auto merged VC++Files/bdb/build_win32/db_java.dsp: Auto merged VC++Files/bdb/build_win32/db_load.dsp: Auto merged VC++Files/bdb/build_win32/db_printlog.dsp: Auto merged VC++Files/bdb/build_win32/db_recover.dsp: Auto merged VC++Files/bdb/build_win32/db_stat.dsp: Auto merged VC++Files/bdb/build_win32/db_static.dsp: Auto merged VC++Files/bdb/build_win32/db_static1.dsp: Auto merged VC++Files/bdb/build_win32/db_tcl.dsp: Auto merged VC++Files/bdb/build_win32/db_test.dsp: Auto merged VC++Files/bdb/build_win32/db_upgrade.dsp: Auto merged VC++Files/bdb/build_win32/db_verify.dsp: Auto merged VC++Files/bdb/build_win32/ex_access.dsp: Auto merged VC++Files/bdb/build_win32/ex_btrec.dsp: Auto merged VC++Files/bdb/build_win32/ex_env.dsp: Auto merged VC++Files/bdb/build_win32/ex_lock.dsp: Auto merged VC++Files/bdb/build_win32/ex_mpool.dsp: Auto merged VC++Files/bdb/build_win32/ex_tpcb.dsp: Auto merged VC++Files/bdb/build_win32/excxx_access.dsp: Auto merged VC++Files/bdb/build_win32/excxx_btrec.dsp: Auto merged VC++Files/bdb/build_win32/excxx_env.dsp: Auto merged VC++Files/bdb/build_win32/excxx_lock.dsp: Auto merged VC++Files/bdb/build_win32/excxx_mpool.dsp: Auto merged VC++Files/bdb/build_win32/excxx_tpcb.dsp: Auto merged VC++Files/client/mysql.dsp: Auto merged VC++Files/client/mysqladmin.dsp: Auto merged VC++Files/client/mysqlcheck.dsp: Auto merged VC++Files/client/mysqlclient.dsp: Auto merged VC++Files/client/mysqlclient.dsw: Auto merged VC++Files/client/mysqldump.dsp: Auto merged VC++Files/client/mysqlimport.dsp: Auto merged VC++Files/client/mysqlshow.dsp: Auto merged VC++Files/comp_err/comp_err.dsp: Auto merged VC++Files/contrib/asm386/zlibvc.dsp: Auto merged VC++Files/contrib/asm386/zlibvc.dsw: Auto merged VC++Files/contrib/minizip/zlibvc.dsp: Auto merged VC++Files/contrib/minizip/zlibvc.dsw: Auto merged VC++Files/dbug/dbug.dsp: Auto merged VC++Files/dbug/dbug.dsw: Auto merged VC++Files/heap/heap.dsp: Auto merged VC++Files/innobase/innobase.dsp: Auto merged VC++Files/isam/isam.dsp: Auto merged VC++Files/isam/isam.dsw: Auto merged VC++Files/isamchk/isamchk.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged VC++Files/libmysql/libmysql.dsw: Auto merged VC++Files/libmysqld/examples/test_libmysqld.dsp: Auto merged VC++Files/libmysqld/libmysqld.dsp: Auto merged VC++Files/libmysqltest/myTest.dsp: Auto merged VC++Files/libmysqltest/mytest.dsw: Auto merged VC++Files/merge/merge.dsp: Auto merged VC++Files/merge/merge.dsw: Auto merged VC++Files/my_print_defaults/my_print_defaults.dsp: Auto merged VC++Files/myisam/myisam.dsp: Auto merged VC++Files/myisamchk/myisamchk.dsp: Auto merged VC++Files/myisamlog/myisamlog.dsp: Auto merged VC++Files/myisammrg/myisammrg.dsp: Auto merged VC++Files/mysql.dsp: Auto merged VC++Files/mysql.dsw: Auto merged VC++Files/myisampack/myisampack.dsp: Auto merged VC++Files/mysqlbinlog/mysqlbinlog.dsp: Auto merged VC++Files/mysqlcheck/mysqlcheck.dsp: Auto merged VC++Files/mysqldemb/mysqldemb.dsp: Auto merged VC++Files/mysqlmanager/MySqlManager.dsp: Auto merged VC++Files/mysqlmanager/mysqlmanager.dsw: Auto merged VC++Files/mysqlserver/mysqlserver.dsp: Auto merged VC++Files/mysqlshutdown/myshutdown.dsp: Auto merged VC++Files/mysqlshutdown/mysqlshutdown.dsp: Auto merged VC++Files/mysqlwatch/mysqlwatch.dsp: Auto merged VC++Files/mysys/mysys.dsp: Auto merged VC++Files/mysys/mysys.dsw: Auto merged VC++Files/pack_isam/pack_isam.dsp: Auto merged VC++Files/perror/perror.dsp: Auto merged VC++Files/regex/regex.dsp: Auto merged VC++Files/regex/regex.dsw: Auto merged VC++Files/replace/replace.dsp: Auto merged VC++Files/sql/mysqld.dsw: Auto merged VC++Files/sql/mysqldmax.dsp: Auto merged VC++Files/sql/old/mysqld.dsw: Auto merged VC++Files/strings/MASM6x/strings.dsp: Auto merged VC++Files/strings/MASM6x/strings.dsw: Auto merged VC++Files/strings/backup/strings.dsp: Auto merged VC++Files/strings/backup/strings.dsw: Auto merged VC++Files/strings/noMASM/strings.dsp: Auto merged VC++Files/strings/noMASM/strings.dsw: Auto merged VC++Files/strings/strings.dsw: Auto merged VC++Files/test1/test1.dsp: Auto merged VC++Files/thr_insert_test/thr_insert_test.dsp: Auto merged VC++Files/thr_test/thr_test.dsp: Auto merged VC++Files/vio/vio.dsp: Auto merged VC++Files/zlib/zlib.dsp: Auto merged client/mysqlbinlog.cc: Auto merged client/mysqlshow.c: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/myisam.h: Auto merged include/thr_lock.h: Auto merged include/violite.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/os/os0file.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0sys.c: Auto merged libmysqld/lib_vio.c: Auto merged myisam/mi_create.c: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/rpl000001.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/t/auto_increment.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/func_like.test: Auto merged mysql-test/t/group_by.test: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/join.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged mysys/default.c: Auto merged mysys/thr_lock.c: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysqld_safe.sh: Auto merged sql/filesort.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/log_event.h: Auto merged sql/mf_iocache.cc: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/repl_failsafe.h: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_base.cc: Auto merged sql-bench/crash-me.sh: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/sql_class.h: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_update.cc: Auto merged sql/stacktrace.c: Auto merged sql/table.cc: Auto merged sql/unireg.h: Auto merged strings/ctype-tis620.c: Auto merged strings/t_ctype.h: Auto merged support-files/mysql.spec.sh: Auto merged tests/grant.res: Auto merged vio/viosocket.c: Auto merged
This commit is contained in:
@ -10,7 +10,7 @@ mysql_tableinfo - creates and populates information tables with
|
||||
the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS),
|
||||
SHOW COLUMNS and SHOW INDEX.
|
||||
|
||||
This is version 1.0.
|
||||
This is version 1.1.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@ -62,7 +62,7 @@ GetOptions( \%opt,
|
||||
"quiet|q",
|
||||
) or usage("Invalid option");
|
||||
|
||||
if ($opt{help}) {usage();}
|
||||
if ($opt{'help'}) {usage();}
|
||||
|
||||
my ($db_to_write,$db_like_wild,$tbl_like_wild);
|
||||
if (@ARGV==0)
|
||||
@ -74,6 +74,8 @@ $db_like_wild=($ARGV[0])?$ARGV[0]:"%"; shift @ARGV;
|
||||
$tbl_like_wild=($ARGV[0])?$ARGV[0]:"%"; shift @ARGV;
|
||||
if (@ARGV>0) { usage("Too many arguments"); }
|
||||
|
||||
$0 = $1 if $0 =~ m:/([^/]+)$:;
|
||||
|
||||
my $info_db="`".$opt{'prefix'}."db`";
|
||||
my $info_tbl="`".$opt{'prefix'}."tbl".
|
||||
(($opt{'tbl-status'})?"_status":"")."`";
|
||||
@ -84,11 +86,11 @@ my $info_idx="`".$opt{'prefix'}."idx`";
|
||||
# --- connect to the database ---
|
||||
|
||||
my $dsn = ";host=$opt{'host'}";
|
||||
$dsn .= ";port=$opt{port}" if $opt{port};
|
||||
$dsn .= ";mysql_socket=$opt{socket}" if $opt{socket};
|
||||
$dsn .= ";port=$opt{'port'}" if $opt{'port'};
|
||||
$dsn .= ";mysql_socket=$opt{'socket'}" if $opt{'socket'};
|
||||
|
||||
my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=perl",
|
||||
$opt{user}, $opt{password},
|
||||
$opt{'user'}, $opt{'password'},
|
||||
{
|
||||
RaiseError => 1,
|
||||
PrintError => 0,
|
||||
@ -104,20 +106,19 @@ if (!$opt{'quiet'})
|
||||
{
|
||||
print "\n!! This program is doing to do:\n\n";
|
||||
print "**DROP** TABLE ...\n" if ($opt{'clear'} or $opt{'clear-only'});
|
||||
print "**DELETE** FROM ... WHERE `Database LIKE $db_like_wild AND `Table` LIKE $tbl_like_wild
|
||||
print "**DELETE** FROM ... WHERE `Database` LIKE $db_like_wild AND `Table` LIKE $tbl_like_wild
|
||||
**INSERT** INTO ...
|
||||
|
||||
on the following tables :\n";
|
||||
my $i;
|
||||
foreach $i (($info_db, $info_tbl),
|
||||
(($opt{'col'})?$info_col:()),
|
||||
(($opt{'idx'})?$info_idx:()))
|
||||
|
||||
foreach (($info_db, $info_tbl),
|
||||
(($opt{'col'})?$info_col:()),
|
||||
(($opt{'idx'})?$info_idx:()))
|
||||
{
|
||||
print(" $db_to_write.$i\n");
|
||||
print(" $db_to_write.$_\n");
|
||||
}
|
||||
print "\nContinue (you can skip this confirmation step with --quiet) ? (y|n) [n]";
|
||||
my $answer=<STDIN>;
|
||||
unless ($answer =~ /^\s*y\s*$/i)
|
||||
if (<STDIN> !~ /^\s*y\s*$/i)
|
||||
{
|
||||
print "Nothing done!\n";exit;
|
||||
}
|
||||
@ -126,17 +127,16 @@ on the following tables :\n";
|
||||
if ($opt{'clear'} or $opt{'clear-only'})
|
||||
{
|
||||
#do not drop the $db_to_write database !
|
||||
my $i;
|
||||
foreach $i (($info_db, $info_tbl),
|
||||
(($opt{'col'})?$info_col:()),
|
||||
(($opt{'idx'})?$info_idx:()))
|
||||
foreach (($info_db, $info_tbl),
|
||||
(($opt{'col'})?$info_col:()),
|
||||
(($opt{'idx'})?$info_idx:()))
|
||||
{
|
||||
$dbh->do("DROP TABLE IF EXISTS $db_to_write.$i");
|
||||
$dbh->do("DROP TABLE IF EXISTS $db_to_write.$_");
|
||||
}
|
||||
if ($opt{'clear-only'})
|
||||
{
|
||||
print "Wrote to database $db_to_write .\n" unless ($opt{'quiet'});
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,14 +151,14 @@ $dbh->do("CREATE DATABASE IF NOT EXISTS $db_to_write");
|
||||
$dbh->do("USE $db_to_write");
|
||||
|
||||
#get databases
|
||||
$sth{db}=$dbh->prepare("SHOW DATABASES LIKE $db_like_wild");
|
||||
$sth{db}->execute;
|
||||
$sth{'db'}=$dbh->prepare("SHOW DATABASES LIKE $db_like_wild");
|
||||
$sth{'db'}->execute;
|
||||
|
||||
#create $info_db which will receive info about databases.
|
||||
#Ensure that the first column to be called "Database" (as SHOW DATABASES LIKE
|
||||
#returns a varying
|
||||
#column name (of the form "Database (%...)") which is not suitable)
|
||||
$extra_col_desc{db}=do_create_table("db",$info_db,undef,"`Database`");
|
||||
$extra_col_desc{'db'}=do_create_table("db",$info_db,undef,"`Database`");
|
||||
#we'll remember the type of the `Database` column (as returned by
|
||||
#SHOW DATABASES), which we will need when creating the next tables.
|
||||
|
||||
@ -166,55 +166,56 @@ $extra_col_desc{db}=do_create_table("db",$info_db,undef,"`Database`");
|
||||
$dbh->do("DELETE FROM $info_db WHERE `Database` LIKE $db_like_wild");
|
||||
|
||||
|
||||
while (@{$row{db}}=$sth{db}->fetchrow_array) #go through all databases
|
||||
while ($row{'db'}=$sth{'db'}->fetchrow_arrayref) #go through all databases
|
||||
{
|
||||
|
||||
#insert the database name
|
||||
$dbh->do("INSERT INTO $info_db VALUES("
|
||||
.join_quote(@{$row{db}}).")");
|
||||
.join(',' , ( map $dbh->quote($_), @{$row{'db'}} ) ).")" );
|
||||
|
||||
#for each database, get tables
|
||||
|
||||
$sth{tbl}=$dbh->prepare("SHOW TABLE"
|
||||
$sth{'tbl'}=$dbh->prepare("SHOW TABLE"
|
||||
.( ($opt{'tbl-status'}) ?
|
||||
" STATUS"
|
||||
: "S" )
|
||||
." from `${$row{db}}[0]` LIKE $tbl_like_wild");
|
||||
$sth{tbl}->execute;
|
||||
." from `$row{'db'}->[0]` LIKE $tbl_like_wild");
|
||||
$sth{'tbl'}->execute;
|
||||
unless ($done_create_table{$info_tbl})
|
||||
|
||||
#tables must be created only once, and out-of-date info must be
|
||||
#cleared once
|
||||
{
|
||||
$done_create_table{$info_tbl}=1;
|
||||
$extra_col_desc{table}=
|
||||
$extra_col_desc{'tbl'}=
|
||||
do_create_table("tbl",$info_tbl,
|
||||
#add an extra column (database name) at the left
|
||||
#and ensure that the table name will be called "Table"
|
||||
#(this is unncessesary with
|
||||
#SHOW TABLE STATUS, but necessary with SHOW TABLES (which returns a column
|
||||
#named "Tables_in_..."))
|
||||
"`Database` ".$extra_col_desc{db},"`Table`");
|
||||
"`Database` ".$extra_col_desc{'db'},"`Table`");
|
||||
$dbh->do("DELETE FROM $info_tbl WHERE `Database` LIKE $db_like_wild AND `Table` LIKE $tbl_like_wild");
|
||||
}
|
||||
|
||||
while (@{$row{tbl}}=$sth{tbl}->fetchrow_array)
|
||||
while ($row{'tbl'}=$sth{'tbl'}->fetchrow_arrayref)
|
||||
{
|
||||
$dbh->do("INSERT INTO $info_tbl VALUES("
|
||||
.$dbh->quote(${$row{db}}[0]).",".join_quote(@{$row{tbl}}).")");
|
||||
.$dbh->quote($row{'db'}->[0]).","
|
||||
.join(',' , ( map $dbh->quote($_), @{$row{'tbl'}} ) ).")");
|
||||
|
||||
#for each table, get columns...
|
||||
|
||||
if ($opt{'col'})
|
||||
{
|
||||
$sth{col}=$dbh->prepare("SHOW COLUMNS FROM `${$row{tbl}}[0]` FROM `${$row{db}}[0]`");
|
||||
$sth{col}->execute;
|
||||
$sth{'col'}=$dbh->prepare("SHOW COLUMNS FROM `$row{'tbl'}->[0]` FROM `$row{'db'}->[0]`");
|
||||
$sth{'col'}->execute;
|
||||
unless ($done_create_table{$info_col})
|
||||
{
|
||||
$done_create_table{$info_col}=1;
|
||||
do_create_table("col",$info_col,
|
||||
"`Database` ".$extra_col_desc{db}.","
|
||||
."`Table` ".$extra_col_desc{table}.","
|
||||
"`Database` ".$extra_col_desc{'db'}.","
|
||||
."`Table` ".$extra_col_desc{'tbl'}.","
|
||||
."`Seq_in_table` BIGINT(3)");
|
||||
#We need to add a sequence number (1 for the first column of the table,
|
||||
#2 for the second etc) so that users are able to retrieve columns in order
|
||||
@ -225,13 +226,13 @@ while (@{$row{db}}=$sth{db}->fetchrow_array) #go through all databases
|
||||
AND `Table` LIKE $tbl_like_wild");
|
||||
}
|
||||
my $col_number=0;
|
||||
while (@{$row{col}}=$sth{col}->fetchrow_array)
|
||||
while ($row{'col'}=$sth{'col'}->fetchrow_arrayref)
|
||||
{
|
||||
$dbh->do("INSERT INTO $info_col VALUES("
|
||||
.$dbh->quote(${$row{db}}[0]).","
|
||||
.$dbh->quote(${$row{tbl}}[0]).","
|
||||
.$dbh->quote($row{'db'}->[0]).","
|
||||
.$dbh->quote($row{'tbl'}->[0]).","
|
||||
.++$col_number.","
|
||||
.join_quote(@{$row{col}}).")");
|
||||
.join(',' , ( map $dbh->quote($_), @{$row{'col'}} ) ).")");
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,22 +240,22 @@ while (@{$row{db}}=$sth{db}->fetchrow_array) #go through all databases
|
||||
|
||||
if ($opt{'idx'})
|
||||
{
|
||||
$sth{idx}=$dbh->prepare("SHOW INDEX FROM `${$row{tbl}}[0]` FROM `${$row{db}}[0]`");
|
||||
$sth{idx}->execute;
|
||||
$sth{'idx'}=$dbh->prepare("SHOW INDEX FROM `$row{'tbl'}->[0]` FROM `$row{'db'}->[0]`");
|
||||
$sth{'idx'}->execute;
|
||||
unless ($done_create_table{$info_idx})
|
||||
{
|
||||
$done_create_table{$info_idx}=1;
|
||||
do_create_table("idx",$info_idx,
|
||||
"`Database` ".$extra_col_desc{db});
|
||||
"`Database` ".$extra_col_desc{'db'});
|
||||
$dbh->do("DELETE FROM $info_idx WHERE `Database`
|
||||
LIKE $db_like_wild
|
||||
AND `Table` LIKE $tbl_like_wild");
|
||||
}
|
||||
while (@{$row{idx}}=$sth{idx}->fetchrow_array)
|
||||
while ($row{'idx'}=$sth{'idx'}->fetchrow_arrayref)
|
||||
{
|
||||
$dbh->do("INSERT INTO $info_idx VALUES("
|
||||
.$dbh->quote(${$row{db}}[0]).","
|
||||
.join_quote(@{$row{idx}}).")");
|
||||
.$dbh->quote($row{'db'}->[0]).","
|
||||
.join(',' , ( map $dbh->quote($_), @{$row{'idx'}} ) ).")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,37 +264,30 @@ while (@{$row{db}}=$sth{db}->fetchrow_array) #go through all databases
|
||||
print "Wrote to database $db_to_write .\n" unless ($opt{'quiet'});
|
||||
exit;
|
||||
|
||||
sub join_quote
|
||||
{
|
||||
my (@list)=@_; my $i;
|
||||
foreach $i (@list) { $i=$dbh->quote($i); }
|
||||
return (join ',',@list);
|
||||
}
|
||||
|
||||
sub do_create_table
|
||||
{
|
||||
my ($sth_key,$target_tbl,$extra_col_desc,$first_col_name)=@_;
|
||||
my $create_table_query=$extra_col_desc;
|
||||
my ($i,$type,$first_col_desc,$col_desc);
|
||||
my ($i,$first_col_desc,$col_desc);
|
||||
|
||||
for ($i=0;$i<$sth{$sth_key}->{NUM_OF_FIELDS};$i++)
|
||||
{
|
||||
if ($create_table_query) { $create_table_query.=", "; }
|
||||
$type=$sth{$sth_key}->{mysql_type_name}->[$i];
|
||||
$col_desc=$type;
|
||||
if ($type =~ /char|int/i)
|
||||
$col_desc=$sth{$sth_key}->{mysql_type_name}->[$i];
|
||||
if ($col_desc =~ /char|int/i)
|
||||
{
|
||||
$col_desc.="($sth{$sth_key}->{PRECISION}->[$i])";
|
||||
}
|
||||
elsif ($type =~ /decimal|numeric/i) #(never seen that)
|
||||
elsif ($col_desc =~ /decimal|numeric/i) #(never seen that)
|
||||
{
|
||||
$col_desc.=
|
||||
"($sth{$sth_key}->{PRECISION}->[$i],$sth{$sth_key}->{SCALE}->[$i])";
|
||||
}
|
||||
elsif ($type !~ /date/i) #date and datetime are OK,
|
||||
elsif ($col_desc !~ /date/i) #date and datetime are OK,
|
||||
#no precision or scale for them
|
||||
{
|
||||
warn "unexpected column type '$type'
|
||||
warn "unexpected column type '$col_desc'
|
||||
(neither 'char','int','decimal|numeric')
|
||||
when creating $target_tbl, hope table creation will go OK\n";
|
||||
}
|
||||
@ -393,6 +387,10 @@ Caution: info tables contain certain columns (e.g.
|
||||
Database, Table, Null...) whose names, as they are MySQL reserved words,
|
||||
need to be backquoted (`...`) when used in SQL statements.
|
||||
|
||||
Caution: as information fetching and info tables filling happen at the
|
||||
same time, info tables may contain inaccurate information about
|
||||
themselves.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
@ -38,7 +38,12 @@ parse_arguments() {
|
||||
--basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
|
||||
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
|
||||
--pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
|
||||
--user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;;
|
||||
--user=*)
|
||||
if test $SET_USER -eq 0
|
||||
then
|
||||
user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1
|
||||
fi
|
||||
;;
|
||||
|
||||
# these two might have been set in a [mysqld_safe] section of my.cnf
|
||||
# they get passed via environment variables to mysqld_safe
|
||||
|
Reference in New Issue
Block a user