~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/base.h

  • Committer: Brian Aker
  • Date: 2010-10-20 20:26:18 UTC
  • mfrom: (1859.2.13 refactor)
  • Revision ID: brian@tangent.org-20101020202618-9222n39lm329urv5
Merge for Brian 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
25
25
 * @TODO Convert HA_XXX defines into enums and/or bitmaps
26
26
 */
27
27
 
28
 
#include "definitions.h"
29
 
 
30
28
#ifndef DRIZZLED_BASE_H
31
29
#define DRIZZLED_BASE_H
32
30
 
308
306
*/
309
307
#define HA_ERR_FIRST            120     /* Copy of first error nr.*/
310
308
 
311
 
/* Other constants */
 
309
#define HA_ERR_KEY_NOT_FOUND    120     /* Didn't find key on read or update */
 
310
#define HA_ERR_FOUND_DUPP_KEY   121     /* Dupplicate key on write */
 
311
#define HA_ERR_INTERNAL_ERROR   122     /* Internal error */
 
312
#define HA_ERR_RECORD_CHANGED   123     /* Uppdate with is recoverable */
 
313
#define HA_ERR_WRONG_INDEX      124     /* Wrong index given to function */
 
314
#define HA_ERR_CRASHED          126     /* Indexfile is crashed */
 
315
#define HA_ERR_WRONG_IN_RECORD  127     /* Record-file is crashed */
 
316
#define HA_ERR_OUT_OF_MEM       128     /* Record-file is crashed */
 
317
#define HA_ERR_NOT_A_TABLE      130     /* not a MYI file - no signature */
 
318
#define HA_ERR_WRONG_COMMAND    131     /* Command not supported */
 
319
#define HA_ERR_OLD_FILE         132     /* old databasfile */
 
320
#define HA_ERR_NO_ACTIVE_RECORD 133     /* No record read in update() */
 
321
#define HA_ERR_RECORD_DELETED   134     /* A record is not there */
 
322
#define HA_ERR_RECORD_FILE_FULL 135     /* No more room in file */
 
323
#define HA_ERR_INDEX_FILE_FULL  136     /* No more room in file */
 
324
#define HA_ERR_END_OF_FILE      137     /* end in next/prev/first/last */
 
325
#define HA_ERR_UNSUPPORTED      138     /* unsupported extension used */
 
326
#define HA_ERR_TO_BIG_ROW       139     /* Too big row */
 
327
#define HA_WRONG_CREATE_OPTION  140     /* Wrong create option */
 
328
#define HA_ERR_FOUND_DUPP_UNIQUE 141    /* Dupplicate unique on write */
 
329
#define HA_ERR_UNKNOWN_CHARSET   142    /* Can't open charset */
 
330
#define HA_ERR_WRONG_MRG_TABLE_DEF 143  /* conflicting tables in MERGE */
 
331
#define HA_ERR_CRASHED_ON_REPAIR 144    /* Last (automatic?) repair failed */
 
332
#define HA_ERR_CRASHED_ON_USAGE  145    /* Table must be repaired */
 
333
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
 
334
#define HA_ERR_LOCK_TABLE_FULL   147
 
335
#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */
 
336
#define HA_ERR_LOCK_DEADLOCK     149
 
337
#define HA_ERR_CANNOT_ADD_FOREIGN 150    /* Cannot add a foreign key constr. */
 
338
#define HA_ERR_NO_REFERENCED_ROW 151     /* Cannot add a child row */
 
339
#define HA_ERR_ROW_IS_REFERENCED 152     /* Cannot delete a parent row */
 
340
#define HA_ERR_NO_SAVEPOINT      153     /* No savepoint with that name */
 
341
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */
 
342
#define HA_ERR_NO_SUCH_TABLE     155  /* The table does not exist in engine */
 
343
#define HA_ERR_TABLE_EXIST       156  /* The table existed in storage engine */
 
344
#define HA_ERR_NO_CONNECTION     157  /* Could not connect to storage engine */
 
345
/* NULLs are not supported in spatial index */
 
346
#define HA_ERR_NULL_IN_SPATIAL   158
 
347
#define HA_ERR_TABLE_DEF_CHANGED 159  /* The table changed in storage engine */
 
348
/* There's no partition in table for given value */
 
349
#define HA_ERR_NO_PARTITION_FOUND 160
 
350
#define HA_ERR_RBR_LOGGING_FAILED 161  /* Row-based binlogging of row failed */
 
351
#define HA_ERR_DROP_INDEX_FK      162  /* Index needed in foreign key constr */
 
352
/*
 
353
  Upholding foreign key constraints would lead to a duplicate key error
 
354
  in some other table.
 
355
*/
 
356
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
 
357
/* The table changed in storage engine */
 
358
#define HA_ERR_TABLE_NEEDS_UPGRADE 164
 
359
#define HA_ERR_TABLE_READONLY      165   /* The table is not writable */
 
360
 
 
361
#define HA_ERR_AUTOINC_READ_FAILED 166   /* Failed to get next autoinc value */
 
362
#define HA_ERR_AUTOINC_ERANGE    167     /* Failed to set row autoinc value */
 
363
#define HA_ERR_GENERIC           168     /* Generic error */
 
364
/* row not actually updated: new values same as the old values */
 
365
#define HA_ERR_RECORD_IS_THE_SAME 169
 
366
/* It is not possible to log this statement */
 
367
#define HA_ERR_LOGGING_IMPOSSIBLE 170    /* It is not possible to log this
 
368
                                            statement */
 
369
#define HA_ERR_TABLESPACE_EXIST   171
 
370
#define HA_ERR_CORRUPT_EVENT      172    /* The event was corrupt, leading to
 
371
                                            illegal data being read */
 
372
#define HA_ERR_NEW_FILE           173    /* New file format */
 
373
#define HA_ERR_ROWS_EVENT_APPLY   174    /* The event could not be processed
 
374
                                            no other hanlder error happened */
 
375
#define HA_ERR_INITIALIZATION     175    /* Error during initialization */
 
376
#define HA_ERR_FILE_TOO_SHORT     176    /* File too short */
 
377
#define HA_ERR_WRONG_CRC          177    /* Wrong CRC on page */
 
378
#define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 178
 
379
#define HA_ERR_NO_SUCH_TABLESPACE 179
 
380
#define HA_ERR_TABLESPACE_NOT_EMPTY 180
 
381
#define HA_ERR_LAST               180    /* Copy of last error nr */
 
382
 
 
383
/* Number of different errors */
 
384
#define HA_ERR_ERRORS            (HA_ERR_LAST - HA_ERR_FIRST + 1)
 
385
 
 
386
        /* Other constants */
312
387
 
313
388
typedef unsigned long key_part_map;
314
389
#define HA_WHOLE_KEY  (~(key_part_map)0)
419
494
 
420
495
/* For number of records */
421
496
typedef uint64_t        ha_rows;
422
 
inline static double rows2double(ha_rows rows)
423
 
{  
424
 
  return uint64_t2double(rows);
425
 
}
 
497
#define rows2double(A)  uint64_t2double(A)
426
498
 
427
499
#define HA_POS_ERROR    (~ (::drizzled::ha_rows) 0)
428
500
#define HA_OFFSET_ERROR (~ (::drizzled::internal::my_off_t) 0)
433
505
#define MAX_FILE_SIZE   INT64_MAX
434
506
#endif
435
507
 
436
 
inline static uint32_t ha_varchar_packlength(uint32_t field_length)
437
 
{
438
 
  return (field_length < 256 ? 1 :2);
439
 
}
 
508
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
440
509
 
441
510
 
442
511
} /* namespace drizzled */