~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

  • Committer: Jay Pipes
  • Date: 2009-10-20 16:11:52 UTC
  • mto: This revision was merged to the branch mainline in revision 1190.
  • Revision ID: jpipes@serialcoder-20091020161152-s1njvuyzn3qf01a0
Style and doxygen cleanup ONLY.  Moves method documentation from source into header files.  Removes TAB characters and cleans up indentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
257
257
   * check_transactional_lock() too.
258
258
   */
259
259
  bool placeholder();
 
260
  /**
 
261
   * Print table as it should be in join list.
 
262
   * 
 
263
   * @param str   string where table should be printed
 
264
   */
260
265
  void print(Session *session, String *str, enum_query_type query_type);
 
266
  /**
 
267
   * Sets insert_values buffer
 
268
   *
 
269
   * @param[in] memory pool for allocating
 
270
   *
 
271
   * @retval
 
272
   *  false - OK
 
273
   * @retval
 
274
   *  true - out of memory
 
275
   */
261
276
  bool set_insert_values(MEM_ROOT *mem_root);
 
277
  /**
 
278
   * Find underlying base tables (TableList) which represent given
 
279
   * table_to_find (Table)
 
280
   *
 
281
   * @param[in] table to find
 
282
   *
 
283
   * @retval
 
284
   *  NULL if table is not found
 
285
   * @retval
 
286
   *  Pointer to found table reference
 
287
   */
262
288
  TableList *find_underlying_table(Table *table);
 
289
  /**
 
290
   * Retrieve the first (left-most) leaf in a nested join tree with
 
291
   * respect to name resolution.
 
292
   *
 
293
   * @details
 
294
   *
 
295
   * Given that 'this' is a nested table reference, recursively walk
 
296
   * down the left-most children of 'this' until we reach a leaf
 
297
   * table reference with respect to name resolution.
 
298
   *
 
299
   * @retval
 
300
   *  If 'this' is a nested table reference - the left-most child of
 
301
   *  the tree rooted in 'this',
 
302
   *  else return 'this'
 
303
   */
263
304
  TableList *first_leaf_for_name_resolution();
 
305
  /**
 
306
   * Retrieve the last (right-most) leaf in a nested join tree with
 
307
   * respect to name resolution.
 
308
   *
 
309
   * @details
 
310
   *
 
311
   * Given that 'this' is a nested table reference, recursively walk
 
312
   * down the right-most children of 'this' until we reach a leaf
 
313
   * table reference with respect to name resolution.
 
314
   *
 
315
   * @retval
 
316
   *  If 'this' is a nested table reference - the right-most child of
 
317
   *  the tree rooted in 'this',
 
318
   *  else 'this'
 
319
   */
264
320
  TableList *last_leaf_for_name_resolution();
 
321
  /**
 
322
   * Test if this is a leaf with respect to name resolution.
 
323
   *
 
324
   * @details
 
325
   * 
 
326
   * A table reference is a leaf with respect to name resolution if
 
327
   * it is either a leaf node in a nested join tree (table, view,
 
328
   * schema table, subquery), or an inner node that represents a
 
329
   * NATURAL/USING join, or a nested join with materialized join
 
330
   * columns.
 
331
   *
 
332
   * @retval
 
333
   *  true if a leaf, false otherwise.
 
334
   */
265
335
  bool is_leaf_for_name_resolution();
266
336
  inline TableList *top_table()
267
337
  { return this; }
268
338
 
 
339
  /**
 
340
   * Return subselect that contains the FROM list this table is taken from
 
341
   *
 
342
   * @retval
 
343
   *  Subselect item for the subquery that contains the FROM list
 
344
   *  this table is taken from if there is any
 
345
   * @retval
 
346
   *  NULL otherwise
 
347
   */
269
348
  Item_subselect *containing_subselect();
270
349
 
271
350
  /**
272
351
   * Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
273
352
   * st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
274
353
   * st_table::force_index and st_table::covering_keys.
 
354
   *
 
355
   * @param the Table to operate on.
 
356
   *
 
357
   * @details
 
358
   *
 
359
   * The parser collects the index hints for each table in a "tagged list"
 
360
   * (TableList::index_hints). Using the information in this tagged list
 
361
   * this function sets the members Table::keys_in_use_for_query,
 
362
   * Table::keys_in_use_for_group_by, Table::keys_in_use_for_order_by,
 
363
   * Table::force_index and Table::covering_keys.
 
364
   *
 
365
   * Current implementation of the runtime does not allow mixing FORCE INDEX
 
366
   * and USE INDEX, so this is checked here. Then the FORCE INDEX list
 
367
   * (if non-empty) is appended to the USE INDEX list and a flag is set.
 
368
   * 
 
369
   * Multiple hints of the same kind are processed so that each clause
 
370
   * is applied to what is computed in the previous clause.
 
371
   * 
 
372
   * For example:
 
373
   *       USE INDEX (i1) USE INDEX (i2)
 
374
   *    is equivalent to
 
375
   *       USE INDEX (i1,i2)
 
376
   *    and means "consider only i1 and i2".
 
377
   *
 
378
   * Similarly
 
379
   *       USE INDEX () USE INDEX (i1)
 
380
   *    is equivalent to
 
381
   *       USE INDEX (i1)
 
382
   *    and means "consider only the index i1"
 
383
   *
 
384
   * It is OK to have the same index several times, e.g. "USE INDEX (i1,i1)" is
 
385
   * not an error.
 
386
   *
 
387
   * Different kind of hints (USE/FORCE/IGNORE) are processed in the following
 
388
   * order:
 
389
   *    1. All indexes in USE (or FORCE) INDEX are added to the mask.
 
390
   *    2. All IGNORE INDEX
 
391
   *       e.g. "USE INDEX i1, IGNORE INDEX i1, USE INDEX i1" will not use i1 at all
 
392
   *       as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1".
 
393
   *       As an optimization if there is a covering index, and we have
 
394
   *       IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part,
 
395
   *       then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
 
396
   *
 
397
   * @retval
 
398
   *   false no errors found
 
399
   * @retval
 
400
   *   true found and reported an error.
275
401
   */
276
402
  bool process_index_hints(Table *table);
 
403
  /**
 
404
   * Creates a table definition cache key for this table entry.
 
405
   *
 
406
   * @param[out] Create key here (must be of size MAX_DBKEY_LENGTH)
 
407
   *
 
408
   * @note
 
409
   *
 
410
   * The table cache_key is created from:
 
411
   *   db_name + \0
 
412
   *   table_name + \0
 
413
   *
 
414
   * if the table is a tmp table, we add the following to make each tmp table
 
415
   * unique on the slave:
 
416
   *
 
417
   * 4 bytes for master thread id
 
418
   * 4 bytes pseudo thread id
 
419
   *
 
420
   * @retval
 
421
   *  Length of key
 
422
   */
277
423
  uint32_t create_table_def_key(char *key);
278
424
};
279
425