Merge lp:~stewart/drizzle/cursor-warn-unused-result into lp:drizzle/7.0

Proposed by Stewart Smith
Status: Merged
Approved by: Brian Aker
Approved revision: 2060
Merged at revision: 2067
Proposed branch: lp:~stewart/drizzle/cursor-warn-unused-result
Merge into: lp:drizzle/7.0
Prerequisite: lp:~stewart/drizzle/bug588251-startScan-unused-result
Diff against target: 270 lines (+91/-27)
8 files modified
drizzled/cursor.cc (+6/-3)
drizzled/cursor.h (+5/-5)
drizzled/item/subselect.cc (+19/-2)
drizzled/records.cc (+11/-5)
drizzled/records.h (+4/-4)
drizzled/sql_delete.cc (+7/-1)
drizzled/sql_select.cc (+37/-6)
drizzled/sql_update.cc (+2/-1)
To merge this branch: bzr merge lp:~stewart/drizzle/cursor-warn-unused-result
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+45484@code.launchpad.net

Description of the change

http://hudson.drizzle.org/view/Drizzle-param/job/drizzle-param/699/

goes through more Cursor methods to make them warn_unused_result

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/cursor.cc'
--- drizzled/cursor.cc 2011-01-07 05:11:59 +0000
+++ drizzled/cursor.cc 2011-01-07 05:12:00 +0000
@@ -288,9 +288,12 @@
288 else288 else
289 {289 {
290 /* Find the first row through the primary key */290 /* Find the first row through the primary key */
291 (void) startIndexScan(primary_key, 0);291 error= startIndexScan(primary_key, 0);
292 error=index_first(buf);292 if (error == 0)
293 (void) endIndexScan();293 {
294 error=index_first(buf);
295 (void) endIndexScan();
296 }
294 }297 }
295 return error;298 return error;
296}299}
297300
=== modified file 'drizzled/cursor.h'
--- drizzled/cursor.h 2011-01-07 05:11:59 +0000
+++ drizzled/cursor.h 2011-01-07 05:12:00 +0000
@@ -232,7 +232,7 @@
232 /* ha_ methods: pubilc wrappers for private virtual API */232 /* ha_ methods: pubilc wrappers for private virtual API */
233233
234 int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);234 int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);
235 int startIndexScan(uint32_t idx, bool sorted);235 int startIndexScan(uint32_t idx, bool sorted) __attribute__ ((warn_unused_result));
236 int endIndexScan();236 int endIndexScan();
237 int startTableScan(bool scan) __attribute__ ((warn_unused_result));237 int startTableScan(bool scan) __attribute__ ((warn_unused_result));
238 int endTableScan();238 int endTableScan();
@@ -248,9 +248,9 @@
248 and doDeleteRecord() below.248 and doDeleteRecord() below.
249 */249 */
250 int ha_external_lock(Session *session, int lock_type);250 int ha_external_lock(Session *session, int lock_type);
251 int insertRecord(unsigned char * buf);251 int insertRecord(unsigned char * buf) __attribute__ ((warn_unused_result));
252 int updateRecord(const unsigned char * old_data, unsigned char * new_data);252 int updateRecord(const unsigned char * old_data, unsigned char * new_data) __attribute__ ((warn_unused_result));
253 int deleteRecord(const unsigned char * buf);253 int deleteRecord(const unsigned char * buf) __attribute__ ((warn_unused_result));
254 void ha_release_auto_increment();254 void ha_release_auto_increment();
255255
256 /** to be actually called to get 'check()' functionality*/256 /** to be actually called to get 'check()' functionality*/
@@ -350,7 +350,7 @@
350 const unsigned char * key,350 const unsigned char * key,
351 key_part_map keypart_map,351 key_part_map keypart_map,
352 enum ha_rkey_function find_flag);352 enum ha_rkey_function find_flag);
353 virtual int index_next(unsigned char *)353 virtual int index_next(unsigned char *) __attribute__ ((warn_unused_result))
354 { return HA_ERR_WRONG_COMMAND; }354 { return HA_ERR_WRONG_COMMAND; }
355 virtual int index_prev(unsigned char *)355 virtual int index_prev(unsigned char *)
356 { return HA_ERR_WRONG_COMMAND; }356 { return HA_ERR_WRONG_COMMAND; }
357357
=== modified file 'drizzled/item/subselect.cc'
--- drizzled/item/subselect.cc 2011-01-07 05:11:59 +0000
+++ drizzled/item/subselect.cc 2011-01-07 05:12:00 +0000
@@ -2498,7 +2498,16 @@
2498 return(scan_table());2498 return(scan_table());
24992499
2500 if (!table->cursor->inited)2500 if (!table->cursor->inited)
2501 table->cursor->startIndexScan(tab->ref.key, 0);2501 {
2502 error= table->cursor->startIndexScan(tab->ref.key, 0);
2503
2504 if (error != 0)
2505 {
2506 error= table->report_error(error);
2507 return (error != 0);
2508 }
2509 }
2510
2502 error= table->cursor->index_read_map(table->record[0],2511 error= table->cursor->index_read_map(table->record[0],
2503 tab->ref.key_buff,2512 tab->ref.key_buff,
2504 make_prev_keypart_map(tab->ref.key_parts),2513 make_prev_keypart_map(tab->ref.key_parts),
@@ -2611,7 +2620,15 @@
2611 return(scan_table());2620 return(scan_table());
26122621
2613 if (!table->cursor->inited)2622 if (!table->cursor->inited)
2614 table->cursor->startIndexScan(tab->ref.key, 1);2623 {
2624 error= table->cursor->startIndexScan(tab->ref.key, 1);
2625
2626 if (error != 0)
2627 {
2628 error= table->report_error(error);
2629 return(error != 0);
2630 }
2631 }
2615 error= table->cursor->index_read_map(table->record[0],2632 error= table->cursor->index_read_map(table->record[0],
2616 tab->ref.key_buff,2633 tab->ref.key_buff,
2617 make_prev_keypart_map(tab->ref.key_parts),2634 make_prev_keypart_map(tab->ref.key_parts),
26182635
=== modified file 'drizzled/records.cc'
--- drizzled/records.cc 2011-01-07 05:11:59 +0000
+++ drizzled/records.cc 2011-01-07 05:12:00 +0000
@@ -48,10 +48,10 @@
48 read_record= rr_sequential;48 read_record= rr_sequential;
49}49}
5050
51void ReadRecord::init_read_record_idx(Session *, 51int ReadRecord::init_read_record_idx(Session *,
52 Table *table_arg,52 Table *table_arg,
53 bool print_error_arg, 53 bool print_error_arg,
54 uint32_t idx)54 uint32_t idx)
55{55{
56 table_arg->emptyRecord();56 table_arg->emptyRecord();
57 table= table_arg;57 table= table_arg;
@@ -61,9 +61,15 @@
6161
62 table->status=0; /* And it's always found */62 table->status=0; /* And it's always found */
63 if (not table->cursor->inited)63 if (not table->cursor->inited)
64 table->cursor->startIndexScan(idx, 1);64 {
65 int error= table->cursor->startIndexScan(idx, 1);
66 if (error != 0)
67 return error;
68 }
65 /* read_record will be changed to rr_index in rr_index_first */69 /* read_record will be changed to rr_index in rr_index_first */
66 read_record= rr_index_first;70 read_record= rr_index_first;
71
72 return 0;
67}73}
6874
6975
7076
=== modified file 'drizzled/records.h'
--- drizzled/records.h 2011-01-07 05:11:59 +0000
+++ drizzled/records.h 2011-01-07 05:12:00 +0000
@@ -205,10 +205,10 @@
205 occurs (except for end-of-records error)205 occurs (except for end-of-records error)
206 @param idx index to scan206 @param idx index to scan
207 */207 */
208 void init_read_record_idx(Session *session, 208 int init_read_record_idx(Session *session,
209 Table *table,209 Table *table,
210 bool print_error, 210 bool print_error,
211 uint32_t idx);211 uint32_t idx) __attribute__ ((warn_unused_result));
212212
213 void init_reard_record_sequential();213 void init_reard_record_sequential();
214214
215215
=== modified file 'drizzled/sql_delete.cc'
--- drizzled/sql_delete.cc 2011-01-07 05:11:59 +0000
+++ drizzled/sql_delete.cc 2011-01-07 05:12:00 +0000
@@ -251,7 +251,13 @@
251 }251 }
252 else252 else
253 {253 {
254 info.init_read_record_idx(session, table, 1, usable_index);254 if ((error= info.init_read_record_idx(session, table, 1, usable_index)))
255 {
256 table->print_error(error, MYF(0));
257 delete select;
258 free_underlaid_joins(session, select_lex);
259 return true;
260 }
255 }261 }
256262
257 session->set_proc_info("updating");263 session->set_proc_info("updating");
258264
=== modified file 'drizzled/sql_select.cc'
--- drizzled/sql_select.cc 2011-01-07 05:11:59 +0000
+++ drizzled/sql_select.cc 2011-01-07 05:12:00 +0000
@@ -3053,7 +3053,15 @@
3053 table->emptyRecord();3053 table->emptyRecord();
3054 if (table->group && join->tmp_table_param.sum_func_count &&3054 if (table->group && join->tmp_table_param.sum_func_count &&
3055 table->getShare()->sizeKeys() && !table->cursor->inited)3055 table->getShare()->sizeKeys() && !table->cursor->inited)
3056 table->cursor->startIndexScan(0, 0);3056 {
3057 int tmp_error;
3058 tmp_error= table->cursor->startIndexScan(0, 0);
3059 if (tmp_error != 0)
3060 {
3061 table->print_error(tmp_error, MYF(0));
3062 return -1;
3063 }
3064 }
3057 }3065 }
3058 /* Set up select_end */3066 /* Set up select_end */
3059 Next_select_func end_select= setup_end_select_func(join);3067 Next_select_func end_select= setup_end_select_func(join);
@@ -3531,7 +3539,11 @@
35313539
3532 if (!table->cursor->inited)3540 if (!table->cursor->inited)
3533 {3541 {
3534 table->cursor->startIndexScan(tab->ref.key, tab->sorted);3542 error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
3543 if (error != 0)
3544 {
3545 table->print_error(error, MYF(0));
3546 }
3535 }3547 }
35363548
3537 /* TODO: Why don't we do "Late NULLs Filtering" here? */3549 /* TODO: Why don't we do "Late NULLs Filtering" here? */
@@ -3579,7 +3591,11 @@
35793591
3580 /* Initialize the index first */3592 /* Initialize the index first */
3581 if (!table->cursor->inited)3593 if (!table->cursor->inited)
3582 table->cursor->startIndexScan(tab->ref.key, tab->sorted);3594 {
3595 error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
3596 if (error != 0)
3597 return table->report_error(error);
3598 }
35833599
3584 /* Perform "Late NULLs Filtering" (see internals manual for explanations) */3600 /* Perform "Late NULLs Filtering" (see internals manual for explanations) */
3585 for (uint32_t i= 0 ; i < tab->ref.key_parts ; i++)3601 for (uint32_t i= 0 ; i < tab->ref.key_parts ; i++)
@@ -3613,7 +3629,11 @@
3613 Table *table= tab->table;3629 Table *table= tab->table;
36143630
3615 if (!table->cursor->inited)3631 if (!table->cursor->inited)
3616 table->cursor->startIndexScan(tab->ref.key, tab->sorted);3632 {
3633 error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
3634 if (error != 0)
3635 return table->report_error(error);
3636 }
3617 if (cp_buffer_from_ref(tab->join->session, &tab->ref))3637 if (cp_buffer_from_ref(tab->join->session, &tab->ref))
3618 return -1;3638 return -1;
3619 if ((error=table->cursor->index_read_last_map(table->getInsertRecord(),3639 if ((error=table->cursor->index_read_last_map(table->getInsertRecord(),
@@ -3762,7 +3782,14 @@
3762 }3782 }
37633783
3764 if (!table->cursor->inited)3784 if (!table->cursor->inited)
3765 table->cursor->startIndexScan(tab->index, tab->sorted);3785 {
3786 error= table->cursor->startIndexScan(tab->index, tab->sorted);
3787 if (error != 0)
3788 {
3789 table->report_error(error);
3790 return -1;
3791 }
3792 }
3766 if ((error=tab->table->cursor->index_first(tab->table->getInsertRecord())))3793 if ((error=tab->table->cursor->index_first(tab->table->getInsertRecord())))
3767 {3794 {
3768 if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)3795 if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@@ -3821,7 +3848,11 @@
3821 tab->read_record.index=tab->index;3848 tab->read_record.index=tab->index;
3822 tab->read_record.record=table->getInsertRecord();3849 tab->read_record.record=table->getInsertRecord();
3823 if (!table->cursor->inited)3850 if (!table->cursor->inited)
3824 table->cursor->startIndexScan(tab->index, 1);3851 {
3852 error= table->cursor->startIndexScan(tab->index, 1);
3853 if (error != 0)
3854 return table->report_error(error);
3855 }
3825 if ((error= tab->table->cursor->index_last(tab->table->getInsertRecord())))3856 if ((error= tab->table->cursor->index_last(tab->table->getInsertRecord())))
3826 return table->report_error(error);3857 return table->report_error(error);
38273858
38283859
=== modified file 'drizzled/sql_update.cc'
--- drizzled/sql_update.cc 2011-01-07 05:11:59 +0000
+++ drizzled/sql_update.cc 2011-01-07 05:12:00 +0000
@@ -368,7 +368,8 @@
368 }368 }
369 else369 else
370 {370 {
371 info.init_read_record_idx(session, table, 1, used_index);371 if ((error= info.init_read_record_idx(session, table, 1, used_index)))
372 goto err;
372 }373 }
373374
374 session->set_proc_info("Searching rows for update");375 session->set_proc_info("Searching rows for update");

Subscribers

People subscribed via source and target branches