~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/cursor.cc

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
37
37
*****************************************************************************/
38
38
 
39
39
FunctionCursor::FunctionCursor(plugin::StorageEngine &engine_arg,
40
 
                               Table &table_arg) :
 
40
                               TableShare &table_arg) :
41
41
  Cursor(engine_arg, table_arg),
42
42
  estimate_of_rows(100), // Completely fabricated, I used to use the value 2.
43
43
  rows_returned(0)
45
45
 
46
46
int FunctionCursor::open(const char *name, int, uint32_t)
47
47
{
48
 
  tool= static_cast<Function *>(getEngine())->getFunction(name); 
 
48
  tool= static_cast<Function *>(engine)->getFunction(name); 
49
49
//  assert(tool);
50
50
 
51
51
  record_id= 0;
67
67
int FunctionCursor::doStartTableScan(bool)
68
68
{
69
69
  rows_returned= 0;
70
 
  generator= tool->generator(getTable()->getFields());
 
70
  generator= tool->generator(table->getFields());
71
71
 
72
72
  return 0;
73
73
}
79
79
  ha_statistic_increment(&system_status_var::ha_read_rnd_next_count);
80
80
 
81
81
  /* Fix bug in the debug logic for field */
82
 
  for (Field **field= getTable()->getFields() ; *field ; field++)
 
82
  for (Field **field= table->getFields() ; *field ; field++)
83
83
  {
84
84
    (*field)->setWriteSet();
85
85
  }
86
86
 
87
 
  more_rows= generator->sub_populate(getTable()->getShare()->sizeFields());
 
87
  more_rows= generator->sub_populate(table->getShare()->sizeFields());
88
88
 
89
89
  if (more_rows)
90
90
  {
102
102
 
103
103
void FunctionCursor::position(const unsigned char *record)
104
104
{
105
 
  if (row_cache.size() <= record_id * getTable()->getShare()->getRecordLength())
 
105
  if (row_cache.size() <= record_id * table->getShare()->getRecordLength())
106
106
  {
107
 
    row_cache.resize(row_cache.size() + getTable()->getShare()->getRecordLength() * 100); // Hardwired at adding an additional 100 rows of storage
 
107
    row_cache.resize(row_cache.size() + table->getShare()->getRecordLength() * 100); // Hardwired at adding an additional 100 rows of storage
108
108
  }
109
 
  memcpy(&row_cache[record_id * getTable()->getShare()->getRecordLength()], record, getTable()->getShare()->getRecordLength());
 
109
  memcpy(&row_cache[record_id * table->getShare()->getRecordLength()], record, table->getShare()->getRecordLength());
110
110
  internal::my_store_ptr(ref, ref_length, record_id);
111
111
  record_id++;
112
112
}
151
151
  ha_statistic_increment(&system_status_var::ha_read_rnd_count);
152
152
  size_t position_id= (size_t)internal::my_get_ptr(pos, ref_length);
153
153
 
154
 
  assert(position_id * getTable()->getShare()->getRecordLength() < row_cache.size());
155
 
  memcpy(buf, &row_cache[position_id * getTable()->getShare()->getRecordLength()], getTable()->getShare()->getRecordLength());
 
154
  assert(position_id * table->getShare()->getRecordLength() < row_cache.size());
 
155
  memcpy(buf, &row_cache[position_id * table->getShare()->getRecordLength()], table->getShare()->getRecordLength());
156
156
 
157
157
  return 0;
158
158
}