~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.cc

  • Committer: Brian Aker
  • Date: 2011-01-25 05:20:15 UTC
  • mto: (2109.1.6 drizzle-build)
  • mto: This revision was merged to the branch mainline in revision 2112.
  • Revision ID: brian@tangent.org-20110125052015-nw5jhmiq0at1qt9u
Merge in reference from pointer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "drizzled/lock.h"
40
40
#include "drizzled/item/int.h"
41
41
#include "drizzled/item/empty_string.h"
42
 
#include "drizzled/field/timestamp.h"
 
42
#include "drizzled/field/epoch.h"
43
43
#include "drizzled/message/table.pb.h"
44
44
#include "drizzled/plugin/client.h"
45
45
#include "drizzled/internal/my_sys.h"
90
90
  if (!(new_handler->ref= (unsigned char*) mem_root->alloc_root(ALIGN_SIZE(ref_length)*2)))
91
91
    return NULL;
92
92
 
93
 
  TableIdentifier identifier(getTable()->getShare()->getSchemaName(),
 
93
  identifier::Table identifier(getTable()->getShare()->getSchemaName(),
94
94
                             getTable()->getShare()->getTableName(),
95
95
                             getTable()->getShare()->getType());
96
96
 
210
210
uint64_t Cursor::tableSize() { return stats.index_file_length + stats.data_file_length; }
211
211
uint64_t Cursor::rowSize() { return getTable()->getRecordLength() + getTable()->sizeFields(); }
212
212
 
213
 
int Cursor::doOpen(const TableIdentifier &identifier, int mode, uint32_t test_if_locked)
 
213
int Cursor::doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked)
214
214
{
215
215
  return open(identifier.getPath().c_str(), mode, test_if_locked);
216
216
}
221
221
  Try O_RDONLY if cannot open as O_RDWR
222
222
  Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set
223
223
*/
224
 
int Cursor::ha_open(const TableIdentifier &identifier,
 
224
int Cursor::ha_open(const identifier::Table &identifier,
225
225
                    int mode,
226
226
                    int test_if_locked)
227
227
{
278
278
  if (stats.deleted < 10 || primary_key >= MAX_KEY ||
279
279
      !(getTable()->index_flags(primary_key) & HA_READ_ORDER))
280
280
  {
281
 
    (void) startTableScan(1);
282
 
    while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
283
 
    (void) endTableScan();
 
281
    error= startTableScan(1);
 
282
    if (error == 0)
 
283
    {
 
284
      while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
 
285
      (void) endTableScan();
 
286
    }
284
287
  }
285
288
  else
286
289
  {
287
290
    /* Find the first row through the primary key */
288
 
    (void) startIndexScan(primary_key, 0);
289
 
    error=index_first(buf);
290
 
    (void) endIndexScan();
 
291
    error= startIndexScan(primary_key, 0);
 
292
    if (error == 0)
 
293
    {
 
294
      error=index_first(buf);
 
295
      (void) endIndexScan();
 
296
    }
291
297
  }
292
298
  return error;
293
299
}