~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/character_sets.m4

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl In order to add new charset, you must add charset name to
 
2
dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index.xml.
 
3
dnl If the character set uses strcoll or other special handling,
 
4
dnl you must also create strings/ctype-$charset_name.c
 
5
 
 
6
AC_DIVERT_PUSH(0)
 
7
 
 
8
define(CHARSETS_AVAILABLE0,binary)
 
9
define(CHARSETS_AVAILABLE5,utf8)
 
10
 
 
11
DEFAULT_CHARSET=utf8
 
12
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5"
 
13
CHARSETS_COMPLEX="utf8"
 
14
 
 
15
AC_DIVERT_POP
 
16
 
 
17
AC_ARG_WITH(charset,
 
18
   [  --with-charset=CHARSET
 
19
                          Default character set, use one of: CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE5],
 
20
   [default_charset="$withval"],
 
21
   [default_charset="$DEFAULT_CHARSET"])
 
22
 
 
23
AC_ARG_WITH(collation,
 
24
   [  --with-collation=COLLATION
 
25
                          Default collation],
 
26
   [default_collation="$withval"],
 
27
   [default_collation="default"])
 
28
 
 
29
AC_MSG_CHECKING("character sets")
 
30
 
 
31
CHARSETS="$default_charset utf8"
 
32
 
 
33
for cs in $CHARSETS
 
34
do
 
35
  case $cs in 
 
36
    binary)
 
37
      ;;
 
38
    utf8)
 
39
      AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable ut8])
 
40
      AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
 
41
      AC_DEFINE(USE_MB_IDENT, [1], [ ])
 
42
      ;;
 
43
    *)
 
44
      AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE).
 
45
      See the Installation chapter in the Reference Manual.])
 
46
  esac
 
47
done
 
48
 
 
49
 
 
50
      default_charset_collations=""
 
51
 
 
52
case $default_charset in 
 
53
    utf8)
 
54
      default_charset_default_collation="utf8_general_ci"
 
55
      define(UTFC1, utf8_general_ci utf8_bin)
 
56
      define(UTFC2, utf8_czech_ci utf8_danish_ci)
 
57
      define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_icelandic_ci)
 
58
      define(UTFC4, utf8_latvian_ci utf8_lithuanian_ci)
 
59
      define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
 
60
      define(UTFC6, utf8_sinhala_ci utf8_slovak_ci utf8_slovenian_ci)
 
61
      define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
 
62
      define(UTFC8, utf8_swedish_ci utf8_turkish_ci)
 
63
      define(UTFC9, utf8_unicode_ci)
 
64
      UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
 
65
      default_charset_collations="$UTFC"
 
66
      ;;
 
67
    *)
 
68
      AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
 
69
      See the Installation chapter in the Reference Manual.])
 
70
esac
 
71
 
 
72
if test "$default_collation" = default; then
 
73
  default_collation=$default_charset_default_collation
 
74
fi
 
75
 
 
76
valid_default_collation=no
 
77
for cl in $default_charset_collations
 
78
do
 
79
  if test x"$cl" = x"$default_collation"
 
80
  then
 
81
    valid_default_collation=yes
 
82
    break
 
83
  fi
 
84
done
 
85
 
 
86
if test x$valid_default_collation = xyes
 
87
then
 
88
  AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS])
 
89
else
 
90
  AC_MSG_ERROR([
 
91
      Collation $default_collation is not valid for character set $default_charset.
 
92
      Valid collations are: $default_charset_collations.
 
93
      See the Installation chapter in the Reference Manual.
 
94
  ])
 
95
fi
 
96
 
 
97
AC_DEFINE_UNQUOTED([DRIZZLE_DEFAULT_CHARSET_NAME], ["$default_charset"],
 
98
                   [Define the default charset name])
 
99
AC_DEFINE_UNQUOTED([DRIZZLE_DEFAULT_COLLATION_NAME], ["$default_collation"],
 
100
                   [Define the default charset name])