~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/records.cc

  • Committer: Monty Taylor
  • Date: 2010-06-20 05:00:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1629.
  • Revision ID: mordred@inaugust.com-20100620050042-swl1exqyqau8qp8l
Fixed drizzleslap build issue on Solaris.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/**
17
17
  @file
27
27
#include "drizzled/optimizer/range.h"
28
28
#include "drizzled/internal/my_sys.h"
29
29
#include "drizzled/internal/iocache.h"
30
 
#include "drizzled/drizzled.h"
31
30
 
32
31
namespace drizzled
33
32
{
54
53
                                      uint32_t idx)
55
54
{
56
55
  table_arg->emptyRecord();
 
56
  memset(this, 0, sizeof(*this));
57
57
  table= table_arg;
58
58
  cursor=  table->cursor;
59
 
  record= table->getInsertRecord();
 
59
  record= table->record[0];
60
60
  print_error= print_error_arg;
61
61
 
62
62
  table->status=0;                      /* And it's always found */
75
75
{
76
76
  internal::IO_CACHE *tempfile;
77
77
 
 
78
  memset(this, 0, sizeof(*this));
78
79
  session= session_arg;
79
80
  table= table_arg;
80
81
  cursor= table->cursor;
88
89
  else
89
90
  {
90
91
    table->emptyRecord();
91
 
    record= table->getInsertRecord();
 
92
    record= table->record[0];
92
93
    ref_length= table->cursor->ref_length;
93
94
  }
94
95
  select= select_arg;
111
112
                  rr_unpack_from_tempfile : rr_from_tempfile);
112
113
 
113
114
    io_cache=tempfile;
114
 
    io_cache->reinit_io_cache(internal::READ_CACHE,0L,0,0);
 
115
    reinit_io_cache(io_cache,internal::READ_CACHE,0L,0,0);
115
116
    ref_pos=table->cursor->ref;
116
117
    if (!table->cursor->inited)
117
118
      table->cursor->startTableScan(0);
173
174
{                   /* free cache if used */
174
175
  if (cache)
175
176
  {
176
 
    global_read_rnd_buffer.sub(session->variables.read_rnd_buff_size);
177
177
    free((char*) cache);
178
178
    cache= NULL;
179
179
  }
208
208
  int tmp;
209
209
  while ((tmp= info->select->quick->get_next()))
210
210
  {
211
 
    if (info->session->getKilled())
 
211
    if (info->session->killed)
212
212
    {
213
213
      my_error(ER_SERVER_SHUTDOWN, MYF(0));
214
214
      return 1;
272
272
  int tmp;
273
273
  while ((tmp= info->cursor->rnd_next(info->record)))
274
274
  {
275
 
    if (info->session->getKilled())
 
275
    if (info->session->killed)
276
276
    {
277
277
      info->session->send_kill_message();
278
278
      return 1;
404
404
  local_rec_cache_size= cache_records * reclength;
405
405
  rec_cache_size= cache_records * ref_length;
406
406
 
407
 
  if (not global_read_rnd_buffer.add(session->variables.read_rnd_buff_size))
408
 
  {
409
 
    my_error(ER_OUT_OF_GLOBAL_READRNDMEMORY, MYF(ME_ERROR+ME_WAITTANG));
410
 
    return false;
411
 
  }
412
 
 
413
407
  // We have to allocate one more byte to use uint3korr (see comments for it)
414
408
  if (cache_records <= 2 ||
415
409
      !(cache=(unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1)))
416
410
  {
417
411
    return false;
418
412
  }
419
 
#ifdef HAVE_VALGRIND
 
413
#ifdef HAVE_purify
420
414
  // Avoid warnings in qsort
421
415
  memset(cache, 0, local_rec_cache_size + cache_records * struct_length + 1);
422
416
#endif
428
422
 
429
423
static int rr_from_cache(ReadRecord *info)
430
424
{
 
425
  register uint32_t i;
431
426
  uint32_t length;
432
427
  internal::my_off_t rest_of_file;
433
428
  int16_t error;
467
462
    length/=info->ref_length;
468
463
    position=info->getCache();
469
464
    ref_position=info->read_positions;
470
 
    for (uint32_t i= 0 ; i < length ; i++,position+=info->ref_length)
 
465
    for (i=0 ; i < length ; i++,position+=info->ref_length)
471
466
    {
472
467
      memcpy(ref_position,position,(size_t) info->ref_length);
473
468
      ref_position+=MAX_REFLENGTH;
478
473
                       (qsort_cmp) rr_cmp);
479
474
 
480
475
    position=info->read_positions;
481
 
    for (uint32_t i= 0 ; i < length ; i++)
 
476
    for (i=0 ; i < length ; i++)
482
477
    {
483
478
      memcpy(info->ref_pos, position, (size_t)info->ref_length);
484
479
      position+=MAX_REFLENGTH;