mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Fix for LP#588251: doStartTableScan() result not checked.
The issue was that we didn't always check result of ha_rnd_init() which caused a problem for handlers that returned an error in this code. - Changed prototype of ha_rnd_init() to ensure that we get a compile warning if result is not checked. - Added ha_rnd_init_with_error() that prints error on failure. - Checked all usage of ha_rnd_init() and ensure we generate an error message on failures. - Changed init_read_record() to return 1 on failure. sql/create_options.cc: Fixed wrong printf sql/event_db_repository.cc: Check result from init_read_record() sql/events.cc: Check result from init_read_record() sql/filesort.cc: Check result from ha_rnd_init() sql/ha_partition.cc: Check result from ha_rnd_init() sql/ha_partition.h: Fixed compiler warning sql/handler.cc: Added ha_rnd_init_with_error() Check result from ha_rnd_init() sql/handler.h: Added ha_rnd_init_with_error() Changed prototype of ha_rnd_init() to ensure that we get a compile warning if result is not checked sql/item_subselect.cc: Check result from ha_rnd_init() sql/log.cc: Check result from ha_rnd_init() sql/log_event.cc: Check result from ha_rnd_init() sql/log_event_old.cc: Check result from ha_rnd_init() sql/mysql_priv.h: init_read_record() now returns error code on failure sql/opt_range.cc: Check result from ha_rnd_init() sql/records.cc: init_read_record() now returns error code on failure Check result from ha_rnd_init() sql/sql_acl.cc: Check result from init_read_record() sql/sql_cursor.cc: Print error if ha_rnd_init() fails sql/sql_delete.cc: Check result from init_read_record() sql/sql_help.cc: Check result from init_read_record() sql/sql_plugin.cc: Check result from init_read_record() sql/sql_select.cc: Check result from ha_rnd_init() Print error if ha_rnd_init() fails. sql/sql_servers.cc: Check result from init_read_record() sql/sql_table.cc: Check result from init_read_record() sql/sql_udf.cc: Check result from init_read_record() sql/sql_update.cc: Check result from init_read_record() storage/example/ha_example.cc: Don't return error on rnd_init() storage/ibmdb2i/ha_ibmdb2i.cc: Removed not relevant comment
This commit is contained in:
@ -182,11 +182,14 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields,
|
||||
SQL_SELECT *select, List<String> *names,
|
||||
String *name, String *description, String *example)
|
||||
{
|
||||
DBUG_ENTER("search_topics");
|
||||
int count= 0;
|
||||
|
||||
READ_RECORD read_record_info;
|
||||
init_read_record(&read_record_info, thd, topics, select, 1, 0, FALSE);
|
||||
DBUG_ENTER("search_topics");
|
||||
|
||||
/* Should never happen. As this is part of help, we can ignore this */
|
||||
if (init_read_record(&read_record_info, thd, topics, select, 1, 0, FALSE))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
while (!read_record_info.read_record(&read_record_info))
|
||||
{
|
||||
if (!select->cond->val_int()) // Doesn't match like
|
||||
@ -222,11 +225,13 @@ int search_topics(THD *thd, TABLE *topics, struct st_find_field *find_fields,
|
||||
int search_keyword(THD *thd, TABLE *keywords, struct st_find_field *find_fields,
|
||||
SQL_SELECT *select, int *key_id)
|
||||
{
|
||||
DBUG_ENTER("search_keyword");
|
||||
int count= 0;
|
||||
|
||||
READ_RECORD read_record_info;
|
||||
init_read_record(&read_record_info, thd, keywords, select, 1, 0, FALSE);
|
||||
DBUG_ENTER("search_keyword");
|
||||
/* Should never happen. As this is part of help, we can ignore this */
|
||||
if (init_read_record(&read_record_info, thd, keywords, select, 1, 0, FALSE))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
while (!read_record_info.read_record(&read_record_info) && count<2)
|
||||
{
|
||||
if (!select->cond->val_int()) // Dosn't match like
|
||||
@ -347,10 +352,11 @@ int search_categories(THD *thd, TABLE *categories,
|
||||
Field *pcat_id= find_fields[help_category_help_category_id].field;
|
||||
int count= 0;
|
||||
READ_RECORD read_record_info;
|
||||
|
||||
DBUG_ENTER("search_categories");
|
||||
|
||||
init_read_record(&read_record_info, thd, categories, select,1,0,FALSE);
|
||||
/* Should never happen. As this is part of help, we can ignore this */
|
||||
if (init_read_record(&read_record_info, thd, categories, select,1,0,FALSE))
|
||||
DBUG_RETURN(0);
|
||||
while (!read_record_info.read_record(&read_record_info))
|
||||
{
|
||||
if (select && !select->cond->val_int())
|
||||
@ -381,10 +387,13 @@ int search_categories(THD *thd, TABLE *categories,
|
||||
void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
|
||||
SQL_SELECT *select, List<String> *res)
|
||||
{
|
||||
READ_RECORD read_record_info;
|
||||
DBUG_ENTER("get_all_items_for_category");
|
||||
|
||||
READ_RECORD read_record_info;
|
||||
init_read_record(&read_record_info, thd, items, select,1,0,FALSE);
|
||||
/* Should never happen. As this is part of help, we can ignore this */
|
||||
if (init_read_record(&read_record_info, thd, items, select,1,0,FALSE))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
while (!read_record_info.read_record(&read_record_info))
|
||||
{
|
||||
if (!select->cond->val_int())
|
||||
|
Reference in New Issue
Block a user