~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_create.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-10 09:27:50 UTC
  • mto: (2430.1.6 rf)
  • mto: This revision was merged to the branch mainline in revision 2436.
  • Revision ID: olafvdspek@gmail.com-20111010092750-ryxgmn7zj5yvxfkf
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/* Create a MyISAM table */
17
17
 
18
18
#include "myisam_priv.h"
19
 
#include "drizzled/internal/my_bit.h"
20
 
#include "drizzled/internal/my_sys.h"
 
19
#include <drizzled/internal/my_bit.h>
 
20
#include <drizzled/internal/my_sys.h>
21
21
 
22
 
#include "drizzled/util/test.h"
23
 
#include "drizzled/global_charset_info.h"
24
 
#include "drizzled/error.h"
 
22
#include <drizzled/util/test.h>
 
23
#include <drizzled/charset.h>
 
24
#include <drizzled/error.h>
25
25
 
26
26
#include <cassert>
27
27
#include <algorithm>
30
30
using namespace drizzled;
31
31
 
32
32
/*
 
33
  Next highest power of two
 
34
 
 
35
  SYNOPSIS
 
36
    my_round_up_to_next_power()
 
37
    v           Value to check
 
38
 
 
39
  RETURN
 
40
    Next or equal power of 2
 
41
    Note: 0 will return 0
 
42
 
 
43
  NOTES
 
44
    Algorithm by Sean Anderson, according to:
 
45
    http://graphics.stanford.edu/~seander/bithacks.html
 
46
    (Orignal code public domain)
 
47
 
 
48
    Comments shows how this works with 01100000000000000000000000001011
 
49
*/
 
50
 
 
51
static inline uint32_t my_round_up_to_next_power(uint32_t v)
 
52
{
 
53
  v--;                  /* 01100000000000000000000000001010 */
 
54
  v|= v >> 1;           /* 01110000000000000000000000001111 */
 
55
  v|= v >> 2;           /* 01111100000000000000000000001111 */
 
56
  v|= v >> 4;           /* 01111111110000000000000000001111 */
 
57
  v|= v >> 8;           /* 01111111111111111100000000001111 */
 
58
  v|= v >> 16;          /* 01111111111111111111111111111111 */
 
59
  return v+1;           /* 10000000000000000000000000000000 */
 
60
}
 
61
 
 
62
/*
33
63
  Old options is used when recreating database, from myisamchk
34
64
*/
35
65
 
392
422
  /* There are only 16 bits for the total header length. */
393
423
  if (info_length > 65535)
394
424
  {
395
 
    my_printf_error(0, "MyISAM table '%s' has too many columns and/or "
 
425
    my_printf_error(EE_OK, "MyISAM table '%s' has too many columns and/or "
396
426
                    "indexes and/or unique constraints.",
397
427
                    MYF(0), name + internal::dirname_length(name));
398
428
    errno= HA_WRONG_CREATE_OPTION;
526
556
  */
527
557
  if (test_if_reopen(filename))
528
558
  {
529
 
    my_printf_error(0, "MyISAM table '%s' is in use "
 
559
    my_printf_error(EE_OK, "MyISAM table '%s' is in use "
530
560
                    "(most likely by a MERGE table). Try FLUSH TABLES.",
531
561
                    MYF(0), name + internal::dirname_length(name));
532
562
    errno= HA_ERR_TABLE_EXIST;