~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_cache.cc

  • Committer: Andrew Hutchings
  • Date: 2010-10-23 19:57:57 UTC
  • mto: This revision was merged to the branch mainline in revision 1907.
  • Revision ID: andrew@linuxjedi.co.uk-20101023195757-03jha2xobl6rn80s
Add join cache global constraint

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "config.h"
31
31
#include "drizzled/sql_select.h" /* include join.h */
32
32
#include "drizzled/field/blob.h"
 
33
#include "drizzled/drizzled.h"
 
34
#include "drizzled/internal/my_sys.h"
33
35
 
34
36
#include <algorithm>
35
37
 
87
89
  if (!(cache->field=(CacheField*)
88
90
        memory::sql_alloc(sizeof(CacheField)*(cache->fields+table_count*2)+(blobs+1)* sizeof(CacheField*))))
89
91
  {
 
92
    size= max((size_t) session->variables.join_buff_size, (size_t)cache->length);
 
93
    global_join_buffer.sub(size);
90
94
    free((unsigned char*) cache->buff);
91
95
    cache->buff=0;
92
96
    return(1);
162
166
  cache->blobs= blobs;
163
167
  *blob_ptr= NULL;                                      /* End sequentel */
164
168
  size= max((size_t) session->variables.join_buff_size, (size_t)cache->length);
 
169
  if (not global_join_buffer.add(size))
 
170
  {
 
171
    my_error(ER_OUT_OF_GLOBAL_JOINMEMORY, MYF(ME_ERROR+ME_WAITTANG));
 
172
    return 1;
 
173
  }
165
174
  if (!(cache->buff= (unsigned char*) malloc(size)))
166
175
    return 1;
167
176
  cache->end= cache->buff+size;