~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000-2006 MySQL AB
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16
/**
17
  @file
18
19
  @brief
20
  Functions for easy reading of records, possible through a cache
21
*/
1241.9.36 by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h.
22
#include "config.h"
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
23
#include "drizzled/error.h"
24
#include "drizzled/table.h"
25
#include "drizzled/session.h"
26
#include "drizzled/records.h"
1237.9.2 by Padraig O'Sullivan
Moved opt_range.[cc,h] into the optimizer directory and namespace and renamed the files to
27
#include "drizzled/optimizer/range.h"
1241.9.64 by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal.
28
#include "drizzled/internal/my_sys.h"
29
#include "drizzled/internal/iocache.h"
1237.9.2 by Padraig O'Sullivan
Moved opt_range.[cc,h] into the optimizer directory and namespace and renamed the files to
30
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
31
namespace drizzled
32
{
1 by brian
clean slate
33
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
34
int rr_sequential(READ_RECORD *info);
1 by brian
clean slate
35
static int rr_quick(READ_RECORD *info);
36
static int rr_from_tempfile(READ_RECORD *info);
37
static int rr_unpack_from_tempfile(READ_RECORD *info);
38
static int rr_unpack_from_buffer(READ_RECORD *info);
39
static int rr_from_pointers(READ_RECORD *info);
40
static int rr_from_cache(READ_RECORD *info);
520.1.22 by Brian Aker
Second pass of thd cleanup
41
static int init_rr_cache(Session *session, READ_RECORD *info);
481 by Brian Aker
Remove all of uchar.
42
static int rr_cmp(unsigned char *a,unsigned char *b);
1 by brian
clean slate
43
static int rr_index_first(READ_RECORD *info);
44
static int rr_index(READ_RECORD *info);
45
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
46
void init_read_record_idx(READ_RECORD *info, 
47
                          Session *, 
48
                          Table *table,
49
                          bool print_error, 
50
                          uint32_t idx)
1 by brian
clean slate
51
{
997.5.1 by chris
Replace macros around unireg.h, store_record,restore_record,cmp_record,empty_record
52
  table->emptyRecord();
212.6.6 by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove().
53
  memset(info, 0, sizeof(*info));
1 by brian
clean slate
54
  info->table= table;
1208.3.2 by brian
Update for Cursor renaming.
55
  info->cursor=  table->cursor;
1 by brian
clean slate
56
  info->record= table->record[0];
57
  info->print_error= print_error;
58
59
  table->status=0;			/* And it's always found */
1208.3.2 by brian
Update for Cursor renaming.
60
  if (!table->cursor->inited)
61
    table->cursor->ha_index_init(idx, 1);
1 by brian
clean slate
62
  /* read_record will be changed to rr_index in rr_index_first */
63
  info->read_record= rr_index_first;
64
}
65
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
66
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
67
void init_read_record(READ_RECORD *info,
68
                      Session *session, 
69
                      Table *table,
1237.13.3 by Padraig O'Sullivan
Performed numerous style cleanups in range.[cc,h].
70
                      optimizer::SqlSelect *select,
1216.1.1 by Brian Aker
Move print_error up to Engine.
71
                      int use_record_cache, 
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
72
                      bool print_error)
1 by brian
clean slate
73
{
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
74
  internal::IO_CACHE *tempfile;
1 by brian
clean slate
75
212.6.6 by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove().
76
  memset(info, 0, sizeof(*info));
520.1.22 by Brian Aker
Second pass of thd cleanup
77
  info->session=session;
1 by brian
clean slate
78
  info->table=table;
1208.3.2 by brian
Update for Cursor renaming.
79
  info->cursor= table->cursor;
1 by brian
clean slate
80
  info->forms= &info->table;		/* Only one table */
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
81
1 by brian
clean slate
82
  if (table->sort.addon_field)
83
  {
84
    info->rec_buf= table->sort.addon_buf;
85
    info->ref_length= table->sort.addon_length;
86
  }
87
  else
88
  {
997.5.1 by chris
Replace macros around unireg.h, store_record,restore_record,cmp_record,empty_record
89
    table->emptyRecord();
1 by brian
clean slate
90
    info->record= table->record[0];
1208.3.2 by brian
Update for Cursor renaming.
91
    info->ref_length= table->cursor->ref_length;
1 by brian
clean slate
92
  }
93
  info->select=select;
1216.1.1 by Brian Aker
Move print_error up to Engine.
94
  info->print_error= print_error;
1 by brian
clean slate
95
  info->ignore_not_found_rows= 0;
96
  table->status=0;			/* And it's always found */
97
1241.9.48 by Monty Taylor
Made one of the drizzled instances of IO_CACHE a pointer.
98
  if (select && my_b_inited(select->file))
99
    tempfile= select->file;
1 by brian
clean slate
100
  else
101
    tempfile= table->sort.io_cache;
102
  if (tempfile && my_b_inited(tempfile)) // Test if ref-records was used
103
  {
104
    info->read_record= (table->sort.addon_field ?
105
                        rr_unpack_from_tempfile : rr_from_tempfile);
106
    info->io_cache=tempfile;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
107
    reinit_io_cache(info->io_cache,internal::READ_CACHE,0L,0,0);
1208.3.2 by brian
Update for Cursor renaming.
108
    info->ref_pos=table->cursor->ref;
109
    if (!table->cursor->inited)
110
      table->cursor->ha_rnd_init(0);
1 by brian
clean slate
111
112
    /*
113
      table->sort.addon_field is checked because if we use addon fields,
114
      it doesn't make sense to use cache - we don't read from the table
115
      and table->sort.io_cache is read sequentially
116
    */
117
    if (!table->sort.addon_field &&
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
118
        session->variables.read_rnd_buff_size &&
1233.1.5 by Brian Aker
More table_flags converted.
119
        !(table->cursor->getEngine()->check_flag(HTON_BIT_FAST_KEY_READ)) &&
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
120
        (table->db_stat & HA_READ_ONLY ||
121
        table->reginfo.lock_type <= TL_READ_NO_INSERT) &&
1208.3.2 by brian
Update for Cursor renaming.
122
        (uint64_t) table->s->reclength* (table->cursor->stats.records+
123
                                                table->cursor->stats.deleted) >
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
124
        (uint64_t) MIN_FILE_LENGTH_TO_USE_ROW_CACHE &&
125
        info->io_cache->end_of_file/info->ref_length * table->s->reclength >
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
126
        (internal::my_off_t) MIN_ROWS_TO_USE_TABLE_CACHE &&
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
127
        !table->s->blob_fields &&
1 by brian
clean slate
128
        info->ref_length <= MAX_REFLENGTH)
129
    {
520.1.22 by Brian Aker
Second pass of thd cleanup
130
      if (! init_rr_cache(session, info))
1 by brian
clean slate
131
      {
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
132
        info->read_record=rr_from_cache;
1 by brian
clean slate
133
      }
134
    }
135
  }
136
  else if (select && select->quick)
137
  {
138
    info->read_record=rr_quick;
139
  }
140
  else if (table->sort.record_pointers)
141
  {
1208.3.2 by brian
Update for Cursor renaming.
142
    table->cursor->ha_rnd_init(0);
1 by brian
clean slate
143
    info->cache_pos=table->sort.record_pointers;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
144
    info->cache_end=info->cache_pos+
1 by brian
clean slate
145
                    table->sort.found_records*info->ref_length;
146
    info->read_record= (table->sort.addon_field ?
147
                        rr_unpack_from_buffer : rr_from_pointers);
148
  }
149
  else
150
  {
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
151
    info->read_record= rr_sequential;
1208.3.2 by brian
Update for Cursor renaming.
152
    table->cursor->ha_rnd_init(1);
1 by brian
clean slate
153
    /* We can use record cache if we don't update dynamic length tables */
154
    if (!table->no_cache &&
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
155
        (use_record_cache > 0 ||
156
        (int) table->reginfo.lock_type <= (int) TL_READ_WITH_SHARED_LOCKS ||
1233.1.8 by Brian Aker
Final removal table_flag().
157
        !(table->s->db_options_in_use & HA_OPTION_PACK_RECORD)))
1208.3.2 by brian
Update for Cursor renaming.
158
      table->cursor->extra_opt(HA_EXTRA_CACHE, session->variables.read_buff_size);
1 by brian
clean slate
159
  }
160
51.1.4 by Jay Pipes
Removed all DBUG_XXX content from records.cc. Builds/tests run fine. On to next file...
161
  return;
1 by brian
clean slate
162
} /* init_read_record */
163
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
164
1 by brian
clean slate
165
void end_read_record(READ_RECORD *info)
166
{                   /* free cache if used */
167
  if (info->cache)
168
  {
477 by Monty Taylor
Removed my_free(). It turns out that it had been def'd to ignore the flags passed to it in the second arg anyway. Gotta love that.
169
    free((char*) info->cache);
1 by brian
clean slate
170
    info->cache=0;
171
  }
172
  if (info->table)
173
  {
1109.1.4 by Brian Aker
More Table refactor
174
    info->table->filesort_free_buffers();
1208.3.2 by brian
Update for Cursor renaming.
175
    (void) info->cursor->extra(HA_EXTRA_NO_CACHE);
1 by brian
clean slate
176
    if (info->read_record != rr_quick) // otherwise quick_range does it
1208.3.2 by brian
Update for Cursor renaming.
177
      (void) info->cursor->ha_index_or_rnd_end();
1 by brian
clean slate
178
    info->table=0;
179
  }
180
}
181
182
static int rr_handle_error(READ_RECORD *info, int error)
183
{
184
  if (error == HA_ERR_END_OF_FILE)
185
    error= -1;
186
  else
187
  {
188
    if (info->print_error)
1216.1.1 by Brian Aker
Move print_error up to Engine.
189
      info->table->print_error(error, MYF(0));
1 by brian
clean slate
190
    if (error < 0)                            // Fix negative BDB errno
191
      error= 1;
192
  }
193
  return error;
194
}
195
196
/** Read a record from head-database. */
197
static int rr_quick(READ_RECORD *info)
198
{
199
  int tmp;
200
  while ((tmp= info->select->quick->get_next()))
201
  {
520.1.22 by Brian Aker
Second pass of thd cleanup
202
    if (info->session->killed)
1 by brian
clean slate
203
    {
204
      my_error(ER_SERVER_SHUTDOWN, MYF(0));
205
      return 1;
206
    }
207
    if (tmp != HA_ERR_RECORD_DELETED)
208
    {
209
      tmp= rr_handle_error(info, tmp);
210
      break;
211
    }
212
  }
998.1.2 by Brian Aker
First pass on removing virt columns
213
1 by brian
clean slate
214
  return tmp;
215
}
216
217
/**
218
  Reads first row in an index scan.
219
220
  @param info  	Scan info
221
222
  @retval
223
    0   Ok
224
  @retval
225
    -1   End of records
226
  @retval
227
    1   Error
228
*/
229
static int rr_index_first(READ_RECORD *info)
230
{
1208.3.2 by brian
Update for Cursor renaming.
231
  int tmp= info->cursor->index_first(info->record);
1 by brian
clean slate
232
  info->read_record= rr_index;
233
  if (tmp)
234
    tmp= rr_handle_error(info, tmp);
235
  return tmp;
236
}
237
238
/**
239
  Reads index sequentially after first row.
240
241
  Read the next index record (in forward direction) and translate return
242
  value.
243
244
  @param info  Scan info
245
246
  @retval
247
    0   Ok
248
  @retval
249
    -1   End of records
250
  @retval
251
    1   Error
252
*/
253
static int rr_index(READ_RECORD *info)
254
{
1208.3.2 by brian
Update for Cursor renaming.
255
  int tmp= info->cursor->index_next(info->record);
1 by brian
clean slate
256
  if (tmp)
257
    tmp= rr_handle_error(info, tmp);
258
  return tmp;
259
}
260
261
int rr_sequential(READ_RECORD *info)
262
{
263
  int tmp;
1208.3.2 by brian
Update for Cursor renaming.
264
  while ((tmp= info->cursor->rnd_next(info->record)))
1 by brian
clean slate
265
  {
520.1.22 by Brian Aker
Second pass of thd cleanup
266
    if (info->session->killed)
1 by brian
clean slate
267
    {
520.1.22 by Brian Aker
Second pass of thd cleanup
268
      info->session->send_kill_message();
1 by brian
clean slate
269
      return 1;
270
    }
271
    /*
822 by Brian Aker
Merge from Stewart.
272
      TODO> Fix this so that engine knows how to behave on its own.
1 by brian
clean slate
273
      rnd_next can return RECORD_DELETED for MyISAM when one thread is
274
      reading and another deleting without locks.
275
    */
276
    if (tmp != HA_ERR_RECORD_DELETED)
277
    {
278
      tmp= rr_handle_error(info, tmp);
279
      break;
280
    }
281
  }
998.1.2 by Brian Aker
First pass on removing virt columns
282
1 by brian
clean slate
283
  return tmp;
284
}
285
286
static int rr_from_tempfile(READ_RECORD *info)
287
{
288
  int tmp;
289
  for (;;)
290
  {
291
    if (my_b_read(info->io_cache,info->ref_pos,info->ref_length))
1208.3.2 by brian
Update for Cursor renaming.
292
      return -1;					/* End of cursor */
293
    if (!(tmp=info->cursor->rnd_pos(info->record,info->ref_pos)))
1 by brian
clean slate
294
      break;
295
    /* The following is extremely unlikely to happen */
296
    if (tmp == HA_ERR_RECORD_DELETED ||
297
        (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
298
      continue;
299
    tmp= rr_handle_error(info, tmp);
300
    break;
301
  }
302
  return tmp;
303
} /* rr_from_tempfile */
304
305
/**
1208.3.2 by brian
Update for Cursor renaming.
306
  Read a result set record from a temporary cursor after sorting.
1 by brian
clean slate
307
1208.3.2 by brian
Update for Cursor renaming.
308
  The function first reads the next sorted record from the temporary cursor.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
309
  into a buffer. If a success it calls a callback function that unpacks
1 by brian
clean slate
310
  the fields values use in the result set from this buffer into their
311
  positions in the regular record buffer.
312
313
  @param info          Reference to the context including record descriptors
314
315
  @retval
316
    0   Record successfully read.
317
  @retval
318
    -1   There is no record to be read anymore.
319
*/
320
static int rr_unpack_from_tempfile(READ_RECORD *info)
321
{
322
  if (my_b_read(info->io_cache, info->rec_buf, info->ref_length))
323
    return -1;
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
324
  Table *table= info->table;
1 by brian
clean slate
325
  (*table->sort.unpack)(table->sort.addon_field, info->rec_buf);
326
327
  return 0;
328
}
329
330
static int rr_from_pointers(READ_RECORD *info)
331
{
332
  int tmp;
481 by Brian Aker
Remove all of uchar.
333
  unsigned char *cache_pos;
1 by brian
clean slate
334
335
  for (;;)
336
  {
337
    if (info->cache_pos == info->cache_end)
1208.3.2 by brian
Update for Cursor renaming.
338
      return -1;					/* End of cursor */
1 by brian
clean slate
339
    cache_pos= info->cache_pos;
340
    info->cache_pos+= info->ref_length;
341
1208.3.2 by brian
Update for Cursor renaming.
342
    if (!(tmp=info->cursor->rnd_pos(info->record,cache_pos)))
1 by brian
clean slate
343
      break;
344
345
    /* The following is extremely unlikely to happen */
346
    if (tmp == HA_ERR_RECORD_DELETED ||
347
        (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
348
      continue;
349
    tmp= rr_handle_error(info, tmp);
350
    break;
351
  }
352
  return tmp;
353
}
354
355
/**
356
  Read a result set record from a buffer after sorting.
357
358
  The function first reads the next sorted record from the sort buffer.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
359
  If a success it calls a callback function that unpacks
1 by brian
clean slate
360
  the fields values use in the result set from this buffer into their
361
  positions in the regular record buffer.
362
363
  @param info          Reference to the context including record descriptors
364
365
  @retval
366
    0   Record successfully read.
367
  @retval
368
    -1   There is no record to be read anymore.
369
*/
370
static int rr_unpack_from_buffer(READ_RECORD *info)
371
{
372
  if (info->cache_pos == info->cache_end)
373
    return -1;                      /* End of buffer */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
374
  Table *table= info->table;
1 by brian
clean slate
375
  (*table->sort.unpack)(table->sort.addon_field, info->cache_pos);
376
  info->cache_pos+= info->ref_length;
377
378
  return 0;
379
}
380
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
381
/* cacheing of records from a database */
520.1.22 by Brian Aker
Second pass of thd cleanup
382
static int init_rr_cache(Session *session, READ_RECORD *info)
1 by brian
clean slate
383
{
482 by Brian Aker
Remove uint.
384
  uint32_t rec_cache_size;
1 by brian
clean slate
385
386
  info->struct_length= 3+MAX_REFLENGTH;
387
  info->reclength= ALIGN_SIZE(info->table->s->reclength+1);
388
  if (info->reclength < info->struct_length)
389
    info->reclength= ALIGN_SIZE(info->struct_length);
390
391
  info->error_offset= info->table->s->reclength;
520.1.22 by Brian Aker
Second pass of thd cleanup
392
  info->cache_records= (session->variables.read_rnd_buff_size /
1 by brian
clean slate
393
                        (info->reclength+info->struct_length));
394
  rec_cache_size= info->cache_records*info->reclength;
395
  info->rec_cache_size= info->cache_records*info->ref_length;
396
397
  // We have to allocate one more byte to use uint3korr (see comments for it)
398
  if (info->cache_records <= 2 ||
641.3.7 by Monty Taylor
More my_malloc removal.
399
      !(info->cache=(unsigned char*) malloc(rec_cache_size+info->cache_records*
400
					    info->struct_length+1)))
51.1.4 by Jay Pipes
Removed all DBUG_XXX content from records.cc. Builds/tests run fine. On to next file...
401
    return(1);
1 by brian
clean slate
402
#ifdef HAVE_purify
403
  // Avoid warnings in qsort
212.6.1 by Mats Kindahl
Replacing all bzero() calls with memset() calls and removing the bzero.c file.
404
  memset(info->cache, 0,
405
         rec_cache_size+info->cache_records* info->struct_length+1);
1 by brian
clean slate
406
#endif
407
  info->read_positions=info->cache+rec_cache_size;
408
  info->cache_pos=info->cache_end=info->cache;
51.1.4 by Jay Pipes
Removed all DBUG_XXX content from records.cc. Builds/tests run fine. On to next file...
409
  return(0);
1 by brian
clean slate
410
} /* init_rr_cache */
411
412
static int rr_from_cache(READ_RECORD *info)
413
{
482 by Brian Aker
Remove uint.
414
  register uint32_t i;
308 by Brian Aker
ulong conversion
415
  uint32_t length;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
416
  internal::my_off_t rest_of_file;
206 by Brian Aker
Removed final uint dead types.
417
  int16_t error;
481 by Brian Aker
Remove all of uchar.
418
  unsigned char *position,*ref_position,*record_pos;
308 by Brian Aker
ulong conversion
419
  uint32_t record;
1 by brian
clean slate
420
421
  for (;;)
422
  {
423
    if (info->cache_pos != info->cache_end)
424
    {
425
      if (info->cache_pos[info->error_offset])
426
      {
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
427
        shortget(error,info->cache_pos);
428
        if (info->print_error)
1216.1.1 by Brian Aker
Move print_error up to Engine.
429
          info->table->print_error(error,MYF(0));
1 by brian
clean slate
430
      }
431
      else
432
      {
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
433
        error=0;
434
        memcpy(info->record,info->cache_pos, (size_t) info->table->s->reclength);
1 by brian
clean slate
435
      }
436
      info->cache_pos+=info->reclength;
437
      return ((int) error);
438
    }
439
    length=info->rec_cache_size;
440
    rest_of_file=info->io_cache->end_of_file - my_b_tell(info->io_cache);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
441
    if ((internal::my_off_t) length > rest_of_file)
308 by Brian Aker
ulong conversion
442
      length= (uint32_t) rest_of_file;
1 by brian
clean slate
443
    if (!length || my_b_read(info->io_cache,info->cache,length))
444
    {
1208.3.2 by brian
Update for Cursor renaming.
445
      return -1;			/* End of cursor */
1 by brian
clean slate
446
    }
447
448
    length/=info->ref_length;
449
    position=info->cache;
450
    ref_position=info->read_positions;
451
    for (i=0 ; i < length ; i++,position+=info->ref_length)
452
    {
453
      memcpy(ref_position,position,(size_t) info->ref_length);
454
      ref_position+=MAX_REFLENGTH;
455
      int3store(ref_position,(long) i);
456
      ref_position+=3;
457
    }
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
458
    internal::my_qsort(info->read_positions, length, info->struct_length,
459
                       (qsort_cmp) rr_cmp);
1 by brian
clean slate
460
461
    position=info->read_positions;
462
    for (i=0 ; i < length ; i++)
463
    {
464
      memcpy(info->ref_pos,position,(size_t) info->ref_length);
465
      position+=MAX_REFLENGTH;
466
      record=uint3korr(position);
467
      position+=3;
468
      record_pos=info->cache+record*info->reclength;
1208.3.2 by brian
Update for Cursor renaming.
469
      if ((error=(int16_t) info->cursor->rnd_pos(record_pos,info->ref_pos)))
1 by brian
clean slate
470
      {
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
471
        record_pos[info->error_offset]=1;
472
        shortstore(record_pos,error);
1 by brian
clean slate
473
      }
474
      else
1039.2.8 by Jay Pipes
Yet more indentation and style cleanup
475
        record_pos[info->error_offset]=0;
1 by brian
clean slate
476
    }
477
    info->cache_end=(info->cache_pos=info->cache)+length*info->reclength;
478
  }
479
} /* rr_from_cache */
480
481 by Brian Aker
Remove all of uchar.
481
static int rr_cmp(unsigned char *a,unsigned char *b)
1 by brian
clean slate
482
{
483
  if (a[0] != b[0])
484
    return (int) a[0] - (int) b[0];
485
  if (a[1] != b[1])
486
    return (int) a[1] - (int) b[1];
487
  if (a[2] != b[2])
488
    return (int) a[2] - (int) b[2];
489
#if MAX_REFLENGTH == 4
490
  return (int) a[3] - (int) b[3];
491
#else
492
  if (a[3] != b[3])
493
    return (int) a[3] - (int) b[3];
494
  if (a[4] != b[4])
495
    return (int) a[4] - (int) b[4];
496
  if (a[5] != b[5])
497
    return (int) a[1] - (int) b[5];
498
  if (a[6] != b[6])
499
    return (int) a[6] - (int) b[6];
500
  return (int) a[7] - (int) b[7];
501
#endif
502
}
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
503
504
} /* namespace drizzled */