~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/funcs_1/datadict/columns.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# suite/funcs_1/datadict/is_columns.inc
 
2
#
 
3
# Auxiliary script to be sourced by
 
4
#    is_columns_is
 
5
#    is_columns_mysql
 
6
#    is_columns_<engine>
 
7
#
 
8
# Purpose:
 
9
#    Check the content of information_schema.columns about tables within certain
 
10
#    database/s.
 
11
#
 
12
# Usage:
 
13
#    The variable $my_where has to
 
14
#    - be set before sourcing this script.
 
15
#    - contain the first part of the WHERE qualification
 
16
#    Example:
 
17
#       let $my_where = WHERE table_schema = 'information_schema'
 
18
#       AND table_name <> 'profiling';
 
19
#       --source suite/funcs_1/datadict/is_columns.inc
 
20
#
 
21
# Author:
 
22
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
 
23
#                           testsuite funcs_1
 
24
#                   Create this script based on older scripts and new code.
 
25
#
 
26
 
 
27
--source suite/funcs_1/datadict/datadict_bug_12777.inc
 
28
eval
 
29
SELECT * FROM information_schema.columns
 
30
$my_where
 
31
ORDER BY table_schema, table_name, column_name;
 
32
 
 
33
--echo ##########################################################################
 
34
--echo # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
 
35
--echo ##########################################################################
 
36
eval
 
37
SELECT DISTINCT
 
38
       CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
 
39
       DATA_TYPE,
 
40
       CHARACTER_SET_NAME,
 
41
       COLLATION_NAME
 
42
FROM information_schema.columns
 
43
$my_where
 
44
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
 
45
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
 
46
 
 
47
#FIXME 3.2.6.2: check the value 2.0079 tinytext ucs2 ucs2_general_ci
 
48
eval
 
49
SELECT DISTINCT
 
50
       CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
 
51
       DATA_TYPE,
 
52
       CHARACTER_SET_NAME,
 
53
       COLLATION_NAME
 
54
FROM information_schema.columns
 
55
$my_where
 
56
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
 
57
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
 
58
 
 
59
eval
 
60
SELECT DISTINCT
 
61
       CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
 
62
       DATA_TYPE,
 
63
       CHARACTER_SET_NAME,
 
64
       COLLATION_NAME
 
65
FROM information_schema.columns
 
66
$my_where
 
67
      AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
 
68
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
 
69
 
 
70
echo --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values;
 
71
echo --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL;
 
72
--source suite/funcs_1/datadict/datadict_bug_12777.inc
 
73
eval
 
74
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
 
75
       TABLE_SCHEMA,
 
76
       TABLE_NAME,
 
77
       COLUMN_NAME,
 
78
       DATA_TYPE,
 
79
       CHARACTER_MAXIMUM_LENGTH,
 
80
       CHARACTER_OCTET_LENGTH,
 
81
       CHARACTER_SET_NAME,
 
82
       COLLATION_NAME,
 
83
       COLUMN_TYPE
 
84
FROM information_schema.columns
 
85
$my_where
 
86
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
 
87