1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
monty@mashka.mysql.fi
2002-09-03 15:44:25 +03:00
parent a5f9e95a93
commit a01a0840dc
24 changed files with 131 additions and 53 deletions

View File

@ -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