~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/records.cc

  • Committer: LinuxJedi
  • Date: 2010-09-01 17:46:04 UTC
  • mto: (1750.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1751.
  • Revision ID: linuxjedi@linuxjedi-laptop-20100901174604-dvdwv3vey32ffbrk
Add a data_dictionary table for the MySQL protocol plugin

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
{
111
110
                  rr_unpack_from_tempfile : rr_from_tempfile);
112
111
 
113
112
    io_cache=tempfile;
114
 
    io_cache->reinit_io_cache(internal::READ_CACHE,0L,0,0);
 
113
    reinit_io_cache(io_cache,internal::READ_CACHE,0L,0,0);
115
114
    ref_pos=table->cursor->ref;
116
115
    if (!table->cursor->inited)
117
116
      table->cursor->startTableScan(0);
173
172
{                   /* free cache if used */
174
173
  if (cache)
175
174
  {
176
 
    global_read_rnd_buffer.sub(session->variables.read_rnd_buff_size);
177
175
    free((char*) cache);
178
176
    cache= NULL;
179
177
  }
208
206
  int tmp;
209
207
  while ((tmp= info->select->quick->get_next()))
210
208
  {
211
 
    if (info->session->getKilled())
 
209
    if (info->session->killed)
212
210
    {
213
211
      my_error(ER_SERVER_SHUTDOWN, MYF(0));
214
212
      return 1;
272
270
  int tmp;
273
271
  while ((tmp= info->cursor->rnd_next(info->record)))
274
272
  {
275
 
    if (info->session->getKilled())
 
273
    if (info->session->killed)
276
274
    {
277
275
      info->session->send_kill_message();
278
276
      return 1;
404
402
  local_rec_cache_size= cache_records * reclength;
405
403
  rec_cache_size= cache_records * ref_length;
406
404
 
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
405
  // We have to allocate one more byte to use uint3korr (see comments for it)
414
406
  if (cache_records <= 2 ||
415
407
      !(cache=(unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1)))
416
408
  {
417
409
    return false;
418
410
  }
419
 
#ifdef HAVE_VALGRIND
 
411
#ifdef HAVE_purify
420
412
  // Avoid warnings in qsort
421
413
  memset(cache, 0, local_rec_cache_size + cache_records * struct_length + 1);
422
414
#endif
428
420
 
429
421
static int rr_from_cache(ReadRecord *info)
430
422
{
 
423
  register uint32_t i;
431
424
  uint32_t length;
432
425
  internal::my_off_t rest_of_file;
433
426
  int16_t error;
467
460
    length/=info->ref_length;
468
461
    position=info->getCache();
469
462
    ref_position=info->read_positions;
470
 
    for (uint32_t i= 0 ; i < length ; i++,position+=info->ref_length)
 
463
    for (i=0 ; i < length ; i++,position+=info->ref_length)
471
464
    {
472
465
      memcpy(ref_position,position,(size_t) info->ref_length);
473
466
      ref_position+=MAX_REFLENGTH;
478
471
                       (qsort_cmp) rr_cmp);
479
472
 
480
473
    position=info->read_positions;
481
 
    for (uint32_t i= 0 ; i < length ; i++)
 
474
    for (i=0 ; i < length ; i++)
482
475
    {
483
476
      memcpy(info->ref_pos, position, (size_t)info->ref_length);
484
477
      position+=MAX_REFLENGTH;