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
1=== modified file 'drizzled/cursor.cc'
2--- drizzled/cursor.cc 2011-01-07 05:11:59 +0000
3+++ drizzled/cursor.cc 2011-01-07 05:12:00 +0000
4@@ -288,9 +288,12 @@
5 else
6 {
7 /* Find the first row through the primary key */
8- (void) startIndexScan(primary_key, 0);
9- error=index_first(buf);
10- (void) endIndexScan();
11+ error= startIndexScan(primary_key, 0);
12+ if (error == 0)
13+ {
14+ error=index_first(buf);
15+ (void) endIndexScan();
16+ }
17 }
18 return error;
19 }
20
21=== modified file 'drizzled/cursor.h'
22--- drizzled/cursor.h 2011-01-07 05:11:59 +0000
23+++ drizzled/cursor.h 2011-01-07 05:12:00 +0000
24@@ -232,7 +232,7 @@
25 /* ha_ methods: pubilc wrappers for private virtual API */
26
27 int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);
28- int startIndexScan(uint32_t idx, bool sorted);
29+ int startIndexScan(uint32_t idx, bool sorted) __attribute__ ((warn_unused_result));
30 int endIndexScan();
31 int startTableScan(bool scan) __attribute__ ((warn_unused_result));
32 int endTableScan();
33@@ -248,9 +248,9 @@
34 and doDeleteRecord() below.
35 */
36 int ha_external_lock(Session *session, int lock_type);
37- int insertRecord(unsigned char * buf);
38- int updateRecord(const unsigned char * old_data, unsigned char * new_data);
39- int deleteRecord(const unsigned char * buf);
40+ int insertRecord(unsigned char * buf) __attribute__ ((warn_unused_result));
41+ int updateRecord(const unsigned char * old_data, unsigned char * new_data) __attribute__ ((warn_unused_result));
42+ int deleteRecord(const unsigned char * buf) __attribute__ ((warn_unused_result));
43 void ha_release_auto_increment();
44
45 /** to be actually called to get 'check()' functionality*/
46@@ -350,7 +350,7 @@
47 const unsigned char * key,
48 key_part_map keypart_map,
49 enum ha_rkey_function find_flag);
50- virtual int index_next(unsigned char *)
51+ virtual int index_next(unsigned char *) __attribute__ ((warn_unused_result))
52 { return HA_ERR_WRONG_COMMAND; }
53 virtual int index_prev(unsigned char *)
54 { return HA_ERR_WRONG_COMMAND; }
55
56=== modified file 'drizzled/item/subselect.cc'
57--- drizzled/item/subselect.cc 2011-01-07 05:11:59 +0000
58+++ drizzled/item/subselect.cc 2011-01-07 05:12:00 +0000
59@@ -2498,7 +2498,16 @@
60 return(scan_table());
61
62 if (!table->cursor->inited)
63- table->cursor->startIndexScan(tab->ref.key, 0);
64+ {
65+ error= table->cursor->startIndexScan(tab->ref.key, 0);
66+
67+ if (error != 0)
68+ {
69+ error= table->report_error(error);
70+ return (error != 0);
71+ }
72+ }
73+
74 error= table->cursor->index_read_map(table->record[0],
75 tab->ref.key_buff,
76 make_prev_keypart_map(tab->ref.key_parts),
77@@ -2611,7 +2620,15 @@
78 return(scan_table());
79
80 if (!table->cursor->inited)
81- table->cursor->startIndexScan(tab->ref.key, 1);
82+ {
83+ error= table->cursor->startIndexScan(tab->ref.key, 1);
84+
85+ if (error != 0)
86+ {
87+ error= table->report_error(error);
88+ return(error != 0);
89+ }
90+ }
91 error= table->cursor->index_read_map(table->record[0],
92 tab->ref.key_buff,
93 make_prev_keypart_map(tab->ref.key_parts),
94
95=== modified file 'drizzled/records.cc'
96--- drizzled/records.cc 2011-01-07 05:11:59 +0000
97+++ drizzled/records.cc 2011-01-07 05:12:00 +0000
98@@ -48,10 +48,10 @@
99 read_record= rr_sequential;
100 }
101
102-void ReadRecord::init_read_record_idx(Session *,
103- Table *table_arg,
104- bool print_error_arg,
105- uint32_t idx)
106+int ReadRecord::init_read_record_idx(Session *,
107+ Table *table_arg,
108+ bool print_error_arg,
109+ uint32_t idx)
110 {
111 table_arg->emptyRecord();
112 table= table_arg;
113@@ -61,9 +61,15 @@
114
115 table->status=0; /* And it's always found */
116 if (not table->cursor->inited)
117- table->cursor->startIndexScan(idx, 1);
118+ {
119+ int error= table->cursor->startIndexScan(idx, 1);
120+ if (error != 0)
121+ return error;
122+ }
123 /* read_record will be changed to rr_index in rr_index_first */
124 read_record= rr_index_first;
125+
126+ return 0;
127 }
128
129
130
131=== modified file 'drizzled/records.h'
132--- drizzled/records.h 2011-01-07 05:11:59 +0000
133+++ drizzled/records.h 2011-01-07 05:12:00 +0000
134@@ -205,10 +205,10 @@
135 occurs (except for end-of-records error)
136 @param idx index to scan
137 */
138- void init_read_record_idx(Session *session,
139- Table *table,
140- bool print_error,
141- uint32_t idx);
142+ int init_read_record_idx(Session *session,
143+ Table *table,
144+ bool print_error,
145+ uint32_t idx) __attribute__ ((warn_unused_result));
146
147 void init_reard_record_sequential();
148
149
150=== modified file 'drizzled/sql_delete.cc'
151--- drizzled/sql_delete.cc 2011-01-07 05:11:59 +0000
152+++ drizzled/sql_delete.cc 2011-01-07 05:12:00 +0000
153@@ -251,7 +251,13 @@
154 }
155 else
156 {
157- info.init_read_record_idx(session, table, 1, usable_index);
158+ if ((error= info.init_read_record_idx(session, table, 1, usable_index)))
159+ {
160+ table->print_error(error, MYF(0));
161+ delete select;
162+ free_underlaid_joins(session, select_lex);
163+ return true;
164+ }
165 }
166
167 session->set_proc_info("updating");
168
169=== modified file 'drizzled/sql_select.cc'
170--- drizzled/sql_select.cc 2011-01-07 05:11:59 +0000
171+++ drizzled/sql_select.cc 2011-01-07 05:12:00 +0000
172@@ -3053,7 +3053,15 @@
173 table->emptyRecord();
174 if (table->group && join->tmp_table_param.sum_func_count &&
175 table->getShare()->sizeKeys() && !table->cursor->inited)
176- table->cursor->startIndexScan(0, 0);
177+ {
178+ int tmp_error;
179+ tmp_error= table->cursor->startIndexScan(0, 0);
180+ if (tmp_error != 0)
181+ {
182+ table->print_error(tmp_error, MYF(0));
183+ return -1;
184+ }
185+ }
186 }
187 /* Set up select_end */
188 Next_select_func end_select= setup_end_select_func(join);
189@@ -3531,7 +3539,11 @@
190
191 if (!table->cursor->inited)
192 {
193- table->cursor->startIndexScan(tab->ref.key, tab->sorted);
194+ error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
195+ if (error != 0)
196+ {
197+ table->print_error(error, MYF(0));
198+ }
199 }
200
201 /* TODO: Why don't we do "Late NULLs Filtering" here? */
202@@ -3579,7 +3591,11 @@
203
204 /* Initialize the index first */
205 if (!table->cursor->inited)
206- table->cursor->startIndexScan(tab->ref.key, tab->sorted);
207+ {
208+ error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
209+ if (error != 0)
210+ return table->report_error(error);
211+ }
212
213 /* Perform "Late NULLs Filtering" (see internals manual for explanations) */
214 for (uint32_t i= 0 ; i < tab->ref.key_parts ; i++)
215@@ -3613,7 +3629,11 @@
216 Table *table= tab->table;
217
218 if (!table->cursor->inited)
219- table->cursor->startIndexScan(tab->ref.key, tab->sorted);
220+ {
221+ error= table->cursor->startIndexScan(tab->ref.key, tab->sorted);
222+ if (error != 0)
223+ return table->report_error(error);
224+ }
225 if (cp_buffer_from_ref(tab->join->session, &tab->ref))
226 return -1;
227 if ((error=table->cursor->index_read_last_map(table->getInsertRecord(),
228@@ -3762,7 +3782,14 @@
229 }
230
231 if (!table->cursor->inited)
232- table->cursor->startIndexScan(tab->index, tab->sorted);
233+ {
234+ error= table->cursor->startIndexScan(tab->index, tab->sorted);
235+ if (error != 0)
236+ {
237+ table->report_error(error);
238+ return -1;
239+ }
240+ }
241 if ((error=tab->table->cursor->index_first(tab->table->getInsertRecord())))
242 {
243 if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
244@@ -3821,7 +3848,11 @@
245 tab->read_record.index=tab->index;
246 tab->read_record.record=table->getInsertRecord();
247 if (!table->cursor->inited)
248- table->cursor->startIndexScan(tab->index, 1);
249+ {
250+ error= table->cursor->startIndexScan(tab->index, 1);
251+ if (error != 0)
252+ return table->report_error(error);
253+ }
254 if ((error= tab->table->cursor->index_last(tab->table->getInsertRecord())))
255 return table->report_error(error);
256
257
258=== modified file 'drizzled/sql_update.cc'
259--- drizzled/sql_update.cc 2011-01-07 05:11:59 +0000
260+++ drizzled/sql_update.cc 2011-01-07 05:12:00 +0000
261@@ -368,7 +368,8 @@
262 }
263 else
264 {
265- info.init_read_record_idx(session, table, 1, used_index);
266+ if ((error= info.init_read_record_idx(session, table, 1, used_index)))
267+ goto err;
268 }
269
270 session->set_proc_info("Searching rows for update");

Subscribers

People subscribed via source and target branches