mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into mysql.com:/opt/local/work/mysql-5.0-root
This commit is contained in:
59
sql/table.cc
59
sql/table.cc
@ -349,7 +349,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
|
||||
char *buff;
|
||||
if (!(buff= alloc_root(&outparam->mem_root, n_length)))
|
||||
goto err;
|
||||
if (my_pread(file, buff, n_length, record_offset + share->reclength,
|
||||
if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
|
||||
MYF(MY_NABP)))
|
||||
goto err;
|
||||
share->connect_string.length= uint2korr(buff);
|
||||
@ -1691,6 +1691,63 @@ db_type get_table_type(THD *thd, const char *name)
|
||||
DBUG_RETURN(ha_checktype(thd,(enum db_type) (uint) *(head+3),0,0));
|
||||
}
|
||||
|
||||
/*
|
||||
Create Item_field for each column in the table.
|
||||
|
||||
SYNPOSIS
|
||||
st_table::fill_item_list()
|
||||
item_list a pointer to an empty list used to store items
|
||||
|
||||
DESCRIPTION
|
||||
Create Item_field object for each column in the table and
|
||||
initialize it with the corresponding Field. New items are
|
||||
created in the current THD memory root.
|
||||
|
||||
RETURN VALUE
|
||||
0 success
|
||||
1 out of memory
|
||||
*/
|
||||
|
||||
bool st_table::fill_item_list(List<Item> *item_list) const
|
||||
{
|
||||
/*
|
||||
All Item_field's created using a direct pointer to a field
|
||||
are fixed in Item_field constructor.
|
||||
*/
|
||||
for (Field **ptr= field; *ptr; ptr++)
|
||||
{
|
||||
Item_field *item= new Item_field(*ptr);
|
||||
if (!item || item_list->push_back(item))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
Reset an existing list of Item_field items to point to the
|
||||
Fields of this table.
|
||||
|
||||
SYNPOSIS
|
||||
st_table::fill_item_list()
|
||||
item_list a non-empty list with Item_fields
|
||||
|
||||
DESCRIPTION
|
||||
This is a counterpart of fill_item_list used to redirect
|
||||
Item_fields to the fields of a newly created table.
|
||||
The caller must ensure that number of items in the item_list
|
||||
is the same as the number of columns in the table.
|
||||
*/
|
||||
|
||||
void st_table::reset_item_list(List<Item> *item_list) const
|
||||
{
|
||||
List_iterator_fast<Item> it(*item_list);
|
||||
for (Field **ptr= field; *ptr; ptr++)
|
||||
{
|
||||
Item_field *item_field= (Item_field*) it++;
|
||||
DBUG_ASSERT(item_field != 0);
|
||||
item_field->reset_field(*ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
calculate md5 of query
|
||||
|
Reference in New Issue
Block a user