~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Monty Taylor
  • Date: 2008-12-21 00:17:47 UTC
  • mto: (722.2.2 devel)
  • mto: This revision was merged to the branch mainline in revision 727.
  • Revision ID: monty@inaugust.com-20081221001747-m8dpxvnfkieu19vc
Split out query_arena.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <drizzled/handler.h>
36
36
#include <drizzled/current_session.h>
37
37
#include <drizzled/sql_error.h>
 
38
#include <drizzled/query_arena.h>
38
39
#include <string>
39
40
#include <bitset>
40
41
 
332
333
 
333
334
#ifdef DRIZZLE_SERVER
334
335
 
335
 
class Query_arena
336
 
{
337
 
public:
338
 
  /*
339
 
    List of items created in the parser for this query. Every item puts
340
 
    itself to the list on creation (see Item::Item() for details))
341
 
  */
342
 
  Item *free_list;
343
 
  MEM_ROOT *mem_root;                   // Pointer to current memroot
344
 
 
345
 
  Query_arena(MEM_ROOT *mem_root_arg) :
346
 
    free_list(0), mem_root(mem_root_arg)
347
 
  { }
348
 
  /*
349
 
    This constructor is used only when Query_arena is created as
350
 
    backup storage for another instance of Query_arena.
351
 
  */
352
 
  Query_arena() { }
353
 
 
354
 
  virtual ~Query_arena() {};
355
 
 
356
 
  inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
357
 
  inline void* calloc(size_t size)
358
 
  {
359
 
    void *ptr;
360
 
    if ((ptr=alloc_root(mem_root,size)))
361
 
      memset(ptr, 0, size);
362
 
    return ptr;
363
 
  }
364
 
  inline char *strdup(const char *str)
365
 
  { return strdup_root(mem_root,str); }
366
 
  inline char *strmake(const char *str, size_t size)
367
 
  { return strmake_root(mem_root,str,size); }
368
 
  inline void *memdup(const void *str, size_t size)
369
 
  { return memdup_root(mem_root,str,size); }
370
 
  inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
371
 
  {
372
 
    void *ptr;
373
 
    if ((ptr= alloc_root(mem_root,size+gap)))
374
 
      memcpy(ptr,str,size);
375
 
    return ptr;
376
 
  }
377
 
 
378
 
  void free_items();
379
 
};
380
 
 
381
 
 
382
336
/**
383
337
  @class Statement
384
338
  @brief State of a single command executed against this connection.