~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_table.cc

  • Committer: Mark Atwood
  • Date: 2012-01-04 16:59:32 UTC
  • mfrom: (2478.2.3 real-key-use-catalog)
  • Revision ID: me@mark.atwood.name-20120104165932-cm0xqs4by0u3p4cy
mergeĀ lp:~stewart/drizzle/key-use-catalog

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
  if (this->type == AM_SYSTEM)
42
42
  {
43
 
    if ((error=this->joinReadSystem()))
 
43
    if ((error= this->joinReadSystem()))
44
44
    {                                           // Info for DESCRIBE
45
45
      this->info="const row not found";
46
46
      /* Mark for EXPLAIN that the row was not found */
154
154
  this->cache.pos=pos;
155
155
}
156
156
 
157
 
int JoinTable::joinReadSystem()
 
157
int join_read_system(JoinTable *tab)
158
158
{
159
 
  Table *Table= this->table;
 
159
  Table *table= tab->table;
160
160
  int error;
161
 
  if (Table->status & STATUS_GARBAGE)           // If first read
 
161
 
 
162
  if (table->status & STATUS_GARBAGE)           // If first read
162
163
  {
163
 
    if ((error=Table->cursor->read_first_row(table->getInsertRecord(),
164
 
                                           Table->getShare()->getPrimaryKey())))
 
164
    if ((error= table->cursor->read_first_row(table->getInsertRecord(),
 
165
                                              table->getShare()->getPrimaryKey())))
165
166
    {
166
167
      if (error != HA_ERR_END_OF_FILE)
167
 
        return Table->report_error(error);
168
 
      this->table->mark_as_null_row();
169
 
      Table->emptyRecord();                     // Make empty record
 
168
      {
 
169
        return table->report_error(error);
 
170
      }
 
171
 
 
172
      tab->table->mark_as_null_row();
 
173
      table->emptyRecord();                     // Make empty record
170
174
      return -1;
171
175
    }
172
 
    Table->storeRecord();
173
 
  }
174
 
  else if (!Table->status)                      // Only happens with left join
175
 
    Table->restoreRecord();                     // restore old record
176
 
  Table->null_row=0;
177
 
  return Table->status ? -1 : 0;
 
176
    table->storeRecord();
 
177
  }
 
178
  else if (table->status == 0)                  // Only happens with left join
 
179
  {
 
180
    table->restoreRecord();                     // restore old record
 
181
  }
 
182
  table->null_row=0;
 
183
 
 
184
  return table->status ? -1 : 0;
 
185
}
 
186
 
 
187
int JoinTable::joinReadSystem()
 
188
{
 
189
  return join_read_system(this);
178
190
}
179
191
 
180
192
} /* namespace drizzled */