MCPcopy Create free account
hub / github.com/MariaDB/server / get_share

Method get_share

storage/sequence/sequence.cc:305–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305Sequence_share *ha_seq::get_share()
306{
307 Sequence_share *tmp_share;
308 lock_shared_ha_data();
309 if (!(tmp_share= static_cast<Sequence_share*>(get_ha_share_ptr())))
310 {
311 bool reverse;
312 ulonglong from, to, step;
313
314 parse_table_name(table_share->table_name.str,
315 table_share->table_name.length, &from, &to, &step);
316
317 if ((reverse = from > to))
318 {
319 if (step > from - to)
320 to = from;
321 else
322 swap_variables(ulonglong, from, to);
323 /*
324 when keyread is allowed, optimizer will always prefer an index to a
325 table scan for our tables, and we'll never see the range reversed.
326 */
327 table_share->keys_for_keyread.clear_all();
328 }
329
330 to= (to - from) / step * step + step + from;
331
332 tmp_share= new Sequence_share(Lex_ident_table(table_share->normalized_path),
333 from, to, step, reverse);
334
335 if (!tmp_share)
336 goto err;
337 set_ha_share_ptr(static_cast<Handler_share*>(tmp_share));
338 }
339err:
340 unlock_shared_ha_data();
341 return tmp_share;
342}
343
344
345static int discover_table(handlerton *hton, THD *thd, TABLE_SHARE *share)

Callers

nothing calls this directly

Calls 3

parse_table_nameFunction · 0.85
Lex_ident_tableClass · 0.85
clear_allMethod · 0.80

Tested by

no test coverage detected