Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
cd49a77a
Commit
cd49a77a
authored
Oct 31, 2007
by
istruewing@stella.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge stella.local:/home2/mydev/mysql-5.0-amain
into stella.local:/home2/mydev/mysql-5.0-axmrg
parents
53b1c3a2
f9fc31f9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
163 additions
and
1 deletion
+163
-1
include/my_sys.h
include/my_sys.h
+2
-0
mysql-test/r/csv.result
mysql-test/r/csv.result
+42
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+6
-0
mysql-test/t/csv.test
mysql-test/t/csv.test
+33
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+8
-0
mysys/charset.c
mysys/charset.c
+40
-0
sql/item_func.cc
sql/item_func.cc
+32
-1
No files found.
include/my_sys.h
View file @
cd49a77a
...
...
@@ -879,6 +879,8 @@ extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
extern
CHARSET_INFO
*
get_charset_by_name
(
const
char
*
cs_name
,
myf
flags
);
extern
CHARSET_INFO
*
get_charset_by_csname
(
const
char
*
cs_name
,
uint
cs_flags
,
myf
my_flags
);
extern
CHARSET_INFO
*
get_compatible_charset_with_ctype
(
CHARSET_INFO
*
original_cs
);
extern
void
free_charsets
(
void
);
extern
char
*
get_charsets_dir
(
char
*
buf
);
extern
my_bool
my_charset_same
(
CHARSET_INFO
*
cs1
,
CHARSET_INFO
*
cs2
);
...
...
mysql-test/r/csv.result
View file @
cd49a77a
...
...
@@ -5029,4 +5029,46 @@ F7
FE LATIN SMALL LETTER THORN
FF LATIN SMALL LETTER Y WITH DIAERESIS
drop table t1;
create table t1(a datetime) engine=csv;
insert into t1 values();
select * from t1;
a
0000-00-00 00:00:00
drop table t1;
create table t1(a set('foo','bar')) engine=csv;
insert into t1 values();
select * from t1;
a
drop table t1;
create table t1(a varchar(32)) engine=csv;
insert into t1 values();
select * from t1;
a
drop table t1;
create table t1(a int) engine=csv;
insert into t1 values();
select * from t1;
a
0
drop table t1;
create table t1(a blob) engine=csv;
insert into t1 values();
select * from t1;
a
drop table t1;
create table t1(a bit(1)) engine=csv;
insert into t1 values();
select BIN(a) from t1;
BIN(a)
0
drop table t1;
create table t1(a enum('foo','bar') default 'foo') engine=csv;
insert into t1 values();
select * from t1;
a
foo
drop table t1;
End of 5.0 tests
mysql-test/r/ctype_ucs.result
View file @
cd49a77a
...
...
@@ -811,6 +811,12 @@ quote(name)
????????
????????????????
drop table bug20536;
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES('abcd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
a
abcd
DROP TABLE t1;
End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
...
...
mysql-test/t/csv.test
View file @
cd49a77a
...
...
@@ -1427,4 +1427,37 @@ insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS');
select
hex
(
c
),
c
,
name
from
t1
order
by
1
;
drop
table
t1
;
#
# Bug #31473: does not work with NULL value in datetime field
# This bug is a 5.1 but is here to prevent 5.0 regression.
#
create
table
t1
(
a
datetime
)
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
a
set
(
'foo'
,
'bar'
))
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
a
varchar
(
32
))
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
a
int
)
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
a
blob
)
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
a
bit
(
1
))
engine
=
csv
;
insert
into
t1
values
();
select
BIN
(
a
)
from
t1
;
drop
table
t1
;
create
table
t1
(
a
enum
(
'foo'
,
'bar'
)
default
'foo'
)
engine
=
csv
;
insert
into
t1
values
();
select
*
from
t1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
mysql-test/t/ctype_ucs.test
View file @
cd49a77a
...
...
@@ -547,6 +547,14 @@ select quote(name) from bug20536;
drop
table
bug20536
;
#
# BUG#31159 - fulltext search on ucs2 column crashes server
#
CREATE
TABLE
t1
(
a
TEXT
CHARSET
ucs2
COLLATE
ucs2_unicode_ci
);
INSERT
INTO
t1
VALUES
(
'abcd'
);
SELECT
*
FROM
t1
WHERE
MATCH
(
a
)
AGAINST
(
'+abcd'
IN
BOOLEAN
MODE
);
DROP
TABLE
t1
;
--
echo
End
of
4.1
tests
#
...
...
mysys/charset.c
View file @
cd49a77a
...
...
@@ -810,3 +810,43 @@ ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
*
to
=
0
;
return
overflow
?
(
ulong
)
~
0
:
(
ulong
)
(
to
-
to_start
);
}
/**
@brief Find compatible character set with ctype.
@param[in] original_cs Original character set
@note
128 my_charset_ucs2_general_uca ->192 my_charset_utf8_general_uca_ci
129 my_charset_ucs2_icelandic_uca_ci ->193 my_charset_utf8_icelandic_uca_ci
130 my_charset_ucs2_latvian_uca_ci ->194 my_charset_utf8_latvian_uca_ci
131 my_charset_ucs2_romanian_uca_ci ->195 my_charset_utf8_romanian_uca_ci
132 my_charset_ucs2_slovenian_uca_ci ->196 my_charset_utf8_slovenian_uca_ci
133 my_charset_ucs2_polish_uca_ci ->197 my_charset_utf8_polish_uca_ci
134 my_charset_ucs2_estonian_uca_ci ->198 my_charset_utf8_estonian_uca_ci
135 my_charset_ucs2_spanish_uca_ci ->199 my_charset_utf8_spanish_uca_ci
136 my_charset_ucs2_swedish_uca_ci ->200 my_charset_utf8_swedish_uca_ci
137 my_charset_ucs2_turkish_uca_ci ->201 my_charset_utf8_turkish_uca_ci
138 my_charset_ucs2_czech_uca_ci ->202 my_charset_utf8_czech_uca_ci
139 my_charset_ucs2_danish_uca_ci ->203 my_charset_utf8_danish_uca_ci
140 my_charset_ucs2_lithuanian_uca_ci->204 my_charset_utf8_lithuanian_uca_ci
141 my_charset_ucs2_slovak_uca_ci ->205 my_charset_utf8_slovak_uca_ci
142 my_charset_ucs2_spanish2_uca_ci ->206 my_charset_utf8_spanish2_uca_ci
143 my_charset_ucs2_roman_uca_ci ->207 my_charset_utf8_roman_uca_ci
144 my_charset_ucs2_persian_uca_ci ->208 my_charset_utf8_persian_uca_ci
@return Compatible character set or NULL.
*/
CHARSET_INFO
*
get_compatible_charset_with_ctype
(
CHARSET_INFO
*
original_cs
)
{
CHARSET_INFO
*
compatible_cs
=
0
;
DBUG_ENTER
(
"get_compatible_charset_with_ctype"
);
if
(
!
strcmp
(
original_cs
->
csname
,
"ucs2"
)
&&
(
compatible_cs
=
get_charset
(
original_cs
->
number
+
64
,
MYF
(
0
)))
&&
(
!
compatible_cs
->
ctype
||
strcmp
(
original_cs
->
name
+
4
,
compatible_cs
->
name
+
4
)))
compatible_cs
=
0
;
DBUG_RETURN
(
compatible_cs
);
}
sql/item_func.cc
View file @
cd49a77a
...
...
@@ -4944,13 +4944,44 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"MATCH"
);
return
TRUE
;
}
table
=
((
Item_field
*
)
item
)
->
field
->
table
;
/*
With prepared statements Item_func_match::fix_fields is called twice.
When it is called first time we have original item tree here and add
conversion layer for character sets that do not have ctype array a few
lines below. When it is called second time, we already have conversion
layer in item tree.
*/
table
=
(
item
->
type
()
==
Item
::
FIELD_ITEM
)
?
((
Item_field
*
)
item
)
->
field
->
table
:
((
Item_field
*
)((
Item_func_conv
*
)
item
)
->
key_item
())
->
field
->
table
;
if
(
!
(
table
->
file
->
table_flags
()
&
HA_CAN_FULLTEXT
))
{
my_error
(
ER_TABLE_CANT_HANDLE_FT
,
MYF
(
0
));
return
1
;
}
table
->
fulltext_searched
=
1
;
/* A workaround for ucs2 character set */
if
(
!
args
[
1
]
->
collation
.
collation
->
ctype
)
{
CHARSET_INFO
*
compatible_cs
=
get_compatible_charset_with_ctype
(
args
[
1
]
->
collation
.
collation
);
bool
rc
=
1
;
if
(
compatible_cs
)
{
Item_string
*
conv_item
=
new
Item_string
(
""
,
0
,
compatible_cs
,
DERIVATION_EXPLICIT
);
item
=
args
[
0
];
args
[
0
]
=
conv_item
;
rc
=
agg_item_charsets
(
cmp_collation
,
func_name
(),
args
,
arg_count
,
MY_COLL_ALLOW_SUPERSET_CONV
|
MY_COLL_ALLOW_COERCIBLE_CONV
|
MY_COLL_DISALLOW_NONE
,
1
);
args
[
0
]
=
item
;
}
else
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"MATCH"
);
return
rc
;
}
return
agg_arg_collations_for_comparison
(
cmp_collation
,
args
+
1
,
arg_count
-
1
,
0
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment