~drizzle-trunk/drizzle/development

1089.1.13 by Brian Aker
Sorting methods into class files.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
1241.9.36 by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h.
21
#include "config.h"
1089.1.13 by Brian Aker
Sorting methods into class files.
22
#include <drizzled/join_table.h>
23
#include <drizzled/field/blob.h>
24
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
25
namespace drizzled
26
{
1089.1.13 by Brian Aker
Sorting methods into class files.
27
28
void JoinTable::readCachedRecord()
29
{
30
  unsigned char *pos;
31
  uint32_t length;
32
  bool last_record;
1539.1.6 by Brian Aker
Update for Join structure changes.
33
  CacheField *copy,*end_field;
1089.1.13 by Brian Aker
Sorting methods into class files.
34
35
  last_record= this->cache.record_nr++ == this->cache.ptr_record;
36
  pos= this->cache.pos;
37
  for (copy= this->cache.field, end_field= copy+this->cache.fields;
38
       copy < end_field;
39
       copy++)
40
  {
41
    if (copy->blob_field)
42
    {
43
      if (last_record)
44
      {
45
        copy->blob_field->set_image(pos, copy->length+sizeof(char*),
46
                  copy->blob_field->charset());
47
        pos+=copy->length+sizeof(char*);
48
      }
49
      else
50
      {
51
        copy->blob_field->set_ptr(pos, pos+copy->length);
52
        pos+=copy->length+copy->blob_field->get_length();
53
      }
54
    }
55
    else
56
    {
57
      if (copy->strip)
58
      {
59
        length= uint2korr(pos);
60
        memcpy(copy->str, pos+2, length);
61
        memset(copy->str+length, ' ', copy->length-length);
62
        pos+= 2 + length;
63
      }
64
      else
65
      {
66
        memcpy(copy->str,pos,copy->length);
67
        pos+=copy->length;
68
      }
69
    }
70
  }
71
  this->cache.pos=pos;
72
}
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
73
74
} /* namespace drizzled */