summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-09-03 15:44:25 +0300
committerunknown <monty@mashka.mysql.fi>2002-09-03 15:44:25 +0300
commit0f2ab68c6f6bc6243c2f8fe7580316f48ffafac6 (patch)
tree14062338992e5b5bda3d4e4cc498b6dd65a5a9c0 /sql/sql_table.cc
parente360f20f73ef48d80fe697f5c4f495ce9b852f17 (diff)
downloadmariadb-git-0f2ab68c6f6bc6243c2f8fe7580316f48ffafac6.tar.gz
Some trivial optimzations
Check if AND/OR expression can be NULL; Fixed bug in GROUP BY and-or-expression where expression could be NULL Bug fix for SHOW OPEN TABLES when user didn't have privilege to access all open tables. Better fix for ALTER TABLE on BDB tables. Docs/manual.texi: Changelog client/mysql.cc: Simple optimization libmysql/libmysql.c: Removed initialization of varibles that are already set to zero myisam/myisamchk.c: Fixed comment for extend-check mysql-test/r/bdb-alter-table-1.result: Updated results mysql-test/r/bdb-alter-table-2.result: Updated results mysql-test/r/distinct.result: Updated results after bug fix mysql-test/r/handler.result: Updated results mysql-test/r/innodb_handler.result: Updated results mysql-test/r/select.result: Updated results mysql-test/r/varbinary.result: Updated results mysql-test/t/bdb-alter-table-1.test: Added comments mysql-test/t/bdb-alter-table-2.test: Added comments mysql-test/t/select.test: Remove OPTION in SET OPTION Added tests for ORDER BY key LIMIT sql/item_cmpfunc.cc: Check if AND/OR expression can be NULL sql/mysqld.cc: mysqld --help now shows value of datadir sql/share/english/errmsg.txt: Better error message for syntax error sql/sql_base.cc: Bug fix for SHOW OPEN TABLES sql/sql_class.cc: Moved virtual function to .cc file to avoid that we have to include assert.h everywhere. sql/sql_class.h: Moved virtual function to .cc file to avoid that we have to include assert.h everywhere. sql/sql_parse.cc: Removed old dead code from 3.23 sql/sql_select.cc: Improved optimization of ORDER BY key LIMIT sql/sql_table.cc: More comments, Better fix for ALTER TABLE on BDB tables.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc46
1 files changed, 39 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0ff0a6b3ac8..95132111313 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -20,6 +20,9 @@
#include "mysql_priv.h"
#include <hash.h>
#include <myisam.h>
+#ifdef HAVE_BERKELEY_DB
+#include <ha_berkeley.h>
+#endif
#include <assert.h>
#ifdef __WIN__
@@ -258,10 +261,32 @@ static int sort_keys(KEY *a, KEY *b)
}
-/*****************************************************************************
- * Create a table.
- * If one creates a temporary table, this is automaticly opened
- ****************************************************************************/
+/*
+ Create a table
+
+ SYNOPSIS
+ mysql_create_table()
+ thd Thread object
+ db Database
+ table_name Table name
+ create_info Create information (like MAX_ROWS)
+ fields List of fields to create
+ keys List of keys to create
+ tmp_table Set to 1 if this is a temporary table
+ no_log Don't log the query to binary log.
+
+ DESCRIPTION
+ If one creates a temporary table, this is automaticly opened
+
+ no_log is needed for the case of CREATE ... SELECT,
+ as the logging will be done later in sql_insert.cc
+ select_field_count is also used for CREATE ... SELECT,
+ and must be zero for standard create of table.
+
+ RETURN VALUES
+ 0 ok
+ -1 error
+*/
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
@@ -1883,9 +1908,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef HAVE_BERKELEY_DB
if (old_db_type == DB_TYPE_BERKELEY_DB)
{
- extern bool berkeley_flush_logs(void);
- (void)berkeley_flush_logs();
- table=open_ltable(thd,table_list,TL_READ);
+ (void) berkeley_flush_logs();
+ /*
+ For the alter table to be properly flushed to the logs, we
+ have to open the new table. If not, we get a problem on server
+ shutdown.
+ */
+ if (!open_tables(thd, table_list)) // Should always succeed
+ {
+ close_thread_table(thd, &table_list->table);
+ }
}
#endif
table_list->table=0; // For query cache