summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-05 20:18:49 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-05 20:18:49 +0200
commite3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4 (patch)
treece42417ba1ab6dac8c367a9ae180ea377956e95a /sql/ha_berkeley.cc
parent79fba6da8f099566bbf711b592aab60909b1f66d (diff)
downloadmariadb-git-e3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4.tar.gz
A lot of portability fixes.
Added rename table for BDB. This fixes a bug in ALTER TABLE with BDB tables. BUILD/SETUP.sh: Enabled uninitalized warnings for debug builds. Build-tools/Do-compile: Added options --no-mysqltest and --no-benchmarks Log time before each stage Removed warnings on some OS (at least hpux11) acinclude.m4: Fixed call to wrong function configure.in: Don't use -O3 as compiler option with aCC innobase/include/univ.i: Removed compiler warning (on Hpux11) innobase/os/os0file.c: Removed compiler warning (on Hpux11) innobase/trx/trx0sys.c: Removed compiler warning (on Hpux11) innobase/trx/trx0trx.c: Removed compiler warning (on Hpux11) innobase/ut/ut0ut.c: Removed compiler warning (with gcc) myisam/mi_check.c: Added missing 'static' myisam/mi_test1.c: Added missing 'static' mysys/my_getopt.c: Added missing 'static' sql/ha_berkeley.cc: Added rename table. This fixes a bug in ALTER TABLE with BDB tables. Fixed compilation problem on OSF1 sql/ha_berkeley.h: Added rename table. This fixes a bug in ALTER TABLE with BDB tables. sql/mini_client.cc: Added reinterpret cast to avoid some warnings. sql/sql_parse.cc: Added reinterpret cast to avoid some warnings. Removed usage of strnlen() as this gave portability problems. sql/sql_union.cc: Added reinterpret cast to avoid some warnings. sql/table.cc: Added reinterpret cast to avoid some warnings. tools/mysqlmanager.c: Added missing 'static'
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 06acf4fa2e3..2154fbd7a32 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -1921,6 +1921,26 @@ int ha_berkeley::delete_table(const char *name)
DBUG_RETURN(error);
}
+int ha_berkeley::rename_table(const char * from, const char * to)
+{
+ int error;
+ char from_buff[FN_REFLEN];
+ char to_buff[FN_REFLEN];
+
+ if ((error= db_create(&file, db_env, 0)))
+ my_errno= error;
+ else
+ {
+ /* On should not do a file->close() after rename returns */
+ error= file->rename(file,
+ fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4),
+ NULL, fn_format(to_buff, to, "", ha_berkeley_ext,
+ 2 | 4), 0);
+ }
+ return error;
+}
+
+
/*
How many seeks it will take to read through the table
This is to be comparable to the number returned by records_in_range so
@@ -2080,7 +2100,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
- if (key_file[i]->stat(key_file[i], (void*) &stat, 0, 0))
+ if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0, 0))
goto err; /* purecov: inspected */
share->rec_per_key[i]= (stat->bt_ndata /
(stat->bt_nkeys ? stat->bt_nkeys : 1));
@@ -2093,7 +2113,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
- if (file->stat(file, (void*) &stat, 0, 0))
+ if ((file->stat)(file, (void*) &stat, 0, 0))
goto err; /* purecov: inspected */
}
pthread_mutex_lock(&share->mutex);