Below is the list of changes that have just been committed into a local
5.0 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1970 05/11/03 16:28:20 jani@stripped +8 -0
Merge jamppa@stripped:/home/bk/mysql-5.0
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
sql/table.cc
1.208 05/11/03 16:28:11 jani@stripped +0 -0
Auto merged
sql/sql_view.h
1.11 05/11/03 16:28:11 jani@stripped +0 -0
Auto merged
sql/sql_view.cc
1.75 05/11/03 16:28:11 jani@stripped +0 -0
Auto merged
sql/sql_table.cc
1.280 05/11/03 16:28:11 jani@stripped +0 -0
Auto merged
sql/sql_show.cc
1.293 05/11/03 16:28:11 jani@stripped +0 -0
Auto merged
sql/sql_delete.cc
1.169 05/11/03 16:28:10 jani@stripped +0 -0
Auto merged
sql/sql_base.cc
1.317 05/11/03 16:28:10 jani@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.364 05/11/03 16:28:10 jani@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jani
# Host: ua141d10.elisa.omakaista.fi
# Root: /home/my/bk/mysql-5.0/RESYNC
--- 1.363/sql/mysql_priv.h 2005-10-28 00:18:10 +03:00
+++ 1.364/sql/mysql_priv.h 2005-11-03 16:28:10 +02:00
@@ -1297,7 +1297,6 @@
int readfrm(const char *name, const void** data, uint* length);
int writefrm(const char* name, const void* data, uint len);
int closefrm(TABLE *table);
-db_type get_table_type(THD *thd, const char *name);
int read_string(File file, gptr *to, uint length);
void free_blobs(TABLE *table);
int set_zone(int nr,int min_zone,int max_zone);
--- 1.316/sql/sql_base.cc 2005-11-03 13:20:07 +02:00
+++ 1.317/sql/sql_base.cc 2005-11-03 16:28:10 +02:00
@@ -1193,10 +1193,11 @@
*/
{
char path[FN_REFLEN];
+ db_type not_used;
strxnmov(path, FN_REFLEN, mysql_data_home, "/", table_list->db, "/",
table_list->table_name, reg_ext, NullS);
(void) unpack_filename(path, path);
- if (mysql_frm_type(path) == FRMTYPE_VIEW)
+ if (mysql_frm_type(thd, path, ¬_used) == FRMTYPE_VIEW)
{
TABLE tab;// will not be used (because it's VIEW) but have to be passed
table= &tab;
--- 1.168/sql/sql_delete.cc 2005-10-28 00:24:03 +03:00
+++ 1.169/sql/sql_delete.cc 2005-11-03 16:28:10 +02:00
@@ -833,7 +833,8 @@
if (!dont_send_ok)
{
db_type table_type;
- if ((table_type=get_table_type(thd, path)) == DB_TYPE_UNKNOWN)
+ mysql_frm_type(thd, path, &table_type);
+ if (table_type == DB_TYPE_UNKNOWN)
{
my_error(ER_NO_SUCH_TABLE, MYF(0),
table_list->db, table_list->table_name);
--- 1.292/sql/sql_show.cc 2005-10-28 12:00:48 +03:00
+++ 1.293/sql/sql_show.cc 2005-11-03 16:28:11 +02:00
@@ -2006,6 +2006,7 @@
Security_context *sctx= thd->security_ctx;
uint derived_tables= lex->derived_tables;
int error= 1;
+ db_type not_used;
Open_tables_state open_tables_state_backup;
DBUG_ENTER("get_all_tables");
@@ -2117,7 +2118,7 @@
else
{
my_snprintf(end, len, "/%s%s", file_name, reg_ext);
- switch (mysql_frm_type(path)) {
+ switch (mysql_frm_type(thd, path, ¬_used)) {
case FRMTYPE_ERROR:
table->field[3]->store("ERROR", 5, system_charset_info);
break;
--- 1.279/sql/sql_table.cc 2005-11-03 13:20:07 +02:00
+++ 1.280/sql/sql_table.cc 2005-11-03 16:28:11 +02:00
@@ -218,6 +218,7 @@
String wrong_tables;
int error;
bool some_tables_deleted=0, tmp_table_deleted=0, foreign_key_error=0;
+
DBUG_ENTER("mysql_rm_table_part2");
if (lock_table_names(thd, tables))
@@ -229,6 +230,8 @@
for (table= tables; table; table= table->next_local)
{
char *db=table->db;
+ db_type table_type= DB_TYPE_UNKNOWN;
+
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
if (!close_temporary_table(thd, db, table->table_name))
{
@@ -256,7 +259,8 @@
if (drop_temporary ||
(access(path,F_OK) &&
ha_create_table_from_engine(thd,db,alias)) ||
- (!drop_view && mysql_frm_type(path) != FRMTYPE_TABLE))
+ (!drop_view &&
+ mysql_frm_type(thd, path, &table_type) != FRMTYPE_TABLE))
{
// Table was not found on disk and table can't be created from engine
if (if_exists)
@@ -269,7 +273,8 @@
else
{
char *end;
- db_type table_type= get_table_type(thd, path);
+ if (table_type == DB_TYPE_UNKNOWN)
+ mysql_frm_type(thd, path, &table_type);
*(end=fn_ext(path))=0; // Remove extension for delete
error= ha_delete_table(thd, table_type, path, table->table_name,
!dont_log_query);
@@ -2617,6 +2622,8 @@
char *src_table= table_ident->table.str;
int err;
bool res= TRUE;
+ db_type not_used;
+
TABLE_LIST src_tables_list;
DBUG_ENTER("mysql_create_like_table");
src_db= table_ident->db.str ? table_ident->db.str : thd->db;
@@ -2664,7 +2671,7 @@
/*
create like should be not allowed for Views, Triggers, ...
*/
- if (mysql_frm_type(src_path) != FRMTYPE_TABLE)
+ if (mysql_frm_type(thd, src_path, ¬_used) != FRMTYPE_TABLE)
{
my_error(ER_WRONG_OBJECT, MYF(0), src_db, src_table, "BASE TABLE");
goto err;
--- 1.207/sql/table.cc 2005-11-03 13:20:07 +02:00
+++ 1.208/sql/table.cc 2005-11-03 16:28:11 +02:00
@@ -1694,29 +1694,6 @@
}
/*
-** Get type of table from .frm file
-*/
-
-db_type get_table_type(THD *thd, const char *name)
-{
- File file;
- uchar head[4];
- int error;
- DBUG_ENTER("get_table_type");
- DBUG_PRINT("enter",("name: '%s'",name));
-
- if ((file=my_open(name,O_RDONLY, MYF(0))) < 0)
- DBUG_RETURN(DB_TYPE_UNKNOWN);
- error=my_read(file,(byte*) head,4,MYF(MY_NABP));
- my_close(file,MYF(0));
- if (error || head[0] != (uchar) 254 || head[1] != 1 ||
- (head[2] != FRM_VER && head[2] != FRM_VER+1 &&
- (head[2] < FRM_VER+3 || head[2] > FRM_VER+4)))
- DBUG_RETURN(DB_TYPE_UNKNOWN);
- DBUG_RETURN(ha_checktype(thd,(enum db_type) (uint) *(head+3),0,0));
-}
-
-/*
Create Item_field for each column in the table.
SYNPOSIS
--- 1.74/sql/sql_view.cc 2005-11-01 15:54:16 +02:00
+++ 1.75/sql/sql_view.cc 2005-11-03 16:28:11 +02:00
@@ -1171,6 +1171,7 @@
char path[FN_REFLEN];
TABLE_LIST *view;
bool type= 0;
+ db_type not_used;
for (view= views; view; view= view->next_local)
{
@@ -1178,7 +1179,8 @@
view->table_name, reg_ext, NullS);
(void) unpack_filename(path, path);
VOID(pthread_mutex_lock(&LOCK_open));
- if (access(path, F_OK) || (type= (mysql_frm_type(path) != FRMTYPE_VIEW)))
+ if (access(path, F_OK) ||
+ (type= (mysql_frm_type(thd, path, ¬_used) != FRMTYPE_VIEW)))
{
char name[FN_REFLEN];
my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name);
@@ -1225,24 +1227,36 @@
FRMTYPE_VIEW view
*/
-frm_type_enum mysql_frm_type(char *path)
+frm_type_enum mysql_frm_type(THD *thd, char *path, db_type *dbt)
{
File file;
- char header[10]; //"TYPE=VIEW\n" it is 10 characters
- int length;
+ uchar header[10]; //"TYPE=VIEW\n" it is 10 characters
+ int error;
DBUG_ENTER("mysql_frm_type");
+ *dbt= DB_TYPE_UNKNOWN;
+
if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
- {
DBUG_RETURN(FRMTYPE_ERROR);
- }
- length= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME));
+ error= my_read(file, (byte*) header, sizeof(header), MYF(MY_WME | MY_NABP));
my_close(file, MYF(MY_WME));
- if (length == (int) MY_FILE_ERROR)
+
+ if (error)
DBUG_RETURN(FRMTYPE_ERROR);
- if (length < (int) sizeof(header) ||
- !strncmp(header, "TYPE=VIEW\n", sizeof(header)))
+ if (!strncmp((char*) header, "TYPE=VIEW\n", sizeof(header)))
DBUG_RETURN(FRMTYPE_VIEW);
+
+ /*
+ This is just a check for DB_TYPE. We'll return default unknown type
+ if the following test is true (arg #3). This should not have effect
+ on return value from this function (default FRMTYPE_TABLE)
+ */
+ if (header[0] != (uchar) 254 || header[1] != 1 ||
+ (header[2] != FRM_VER && header[2] != FRM_VER+1 &&
+ (header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
+ DBUG_RETURN(FRMTYPE_TABLE);
+
+ *dbt= ha_checktype(thd, (enum db_type) (uint) *(header + 3), 0, 0);
DBUG_RETURN(FRMTYPE_TABLE); // Is probably a .frm table
}
--- 1.10/sql/sql_view.h 2005-11-01 15:54:16 +02:00
+++ 1.11/sql/sql_view.h 2005-11-03 16:28:11 +02:00
@@ -27,7 +27,7 @@
bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view);
-frm_type_enum mysql_frm_type(char *path);
+frm_type_enum mysql_frm_type(THD *thd, char *path, db_type *dbt);
int view_checksum(THD *thd, TABLE_LIST *view);
| Thread |
|---|
| • bk commit into 5.0 tree (jani:1.1970) | jani | 3 Nov |