21
21
#include "config.h"
22
22
#include <drizzled/join_table.h>
23
23
#include <drizzled/field/blob.h>
24
#include <drizzled/sql_select.h>
29
int JoinTable::join_read_const_table(optimizer::Position *pos)
32
Table *Table= this->table;
35
Table->status=STATUS_NO_RECORD;
37
if (this->type == AM_SYSTEM)
39
if ((error=join_read_system(this)))
40
{ // Info for DESCRIBE
41
this->info="const row not found";
42
/* Mark for EXPLAIN that the row was not found */
44
pos->clearRefDependMap();
45
if (! Table->maybe_null || error > 0)
51
if (! Table->key_read &&
52
Table->covering_keys.test(this->ref.key) &&
53
! Table->no_keyread &&
54
(int) Table->reginfo.lock_type <= (int) TL_READ_WITH_SHARED_LOCKS)
57
Table->cursor->extra(HA_EXTRA_KEYREAD);
58
this->index= this->ref.key;
60
error=join_read_const(this);
64
Table->cursor->extra(HA_EXTRA_NO_KEYREAD);
68
this->info="unique row not found";
69
/* Mark for EXPLAIN that the row was not found */
71
pos->clearRefDependMap();
72
if (!Table->maybe_null || error > 0)
76
if (*this->on_expr_ref && !Table->null_row)
78
if ((Table->null_row= test((*this->on_expr_ref)->val_int() == 0)))
79
Table->mark_as_null_row();
84
/* Check appearance of new constant items in Item_equal objects */
85
Join *Join= this->join;
87
update_const_equal_items(Join->conds, this);
89
for (tbl= Join->select_lex->leaf_tables; tbl; tbl= tbl->next_leaf)
92
TableList *embedding= tbl;
96
if (embedded->on_expr)
97
update_const_equal_items(embedded->on_expr, this);
98
embedding= embedded->getEmbedding();
101
embedding->getNestedJoin()->join_list.head() == embedded);
28
107
void JoinTable::readCachedRecord()
30
109
unsigned char *pos;