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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
cbe1a8a0
Commit
cbe1a8a0
authored
Dec 09, 2008
by
Patrick Crews
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
2aeeec58
4ce563e0
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
222 additions
and
25 deletions
+222
-25
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+32
-6
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+16
-0
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+9
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+9
-3
mysql-test/r/type_bit.result
mysql-test/r/type_bit.result
+41
-0
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+6
-6
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+13
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+10
-0
mysql-test/t/type_bit.test
mysql-test/t/type_bit.test
+45
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+1
-1
sql/field.cc
sql/field.cc
+1
-1
sql/item.cc
sql/item.cc
+3
-0
sql/item_strfunc.h
sql/item_strfunc.h
+3
-2
sql/sql_select.cc
sql/sql_select.cc
+6
-2
sql/sql_show.cc
sql/sql_show.cc
+15
-3
sql/sql_table.cc
sql/sql_table.cc
+3
-1
No files found.
myisam/ft_boolean_search.c
View file @
cbe1a8a0
...
...
@@ -122,11 +122,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b)
static
int
FTB_WORD_cmp_list
(
CHARSET_INFO
*
cs
,
FTB_WORD
**
a
,
FTB_WORD
**
b
)
{
/* ORDER BY word
DESC, ndepth DESC
*/
int
i
=
mi_compare_text
(
cs
,
(
uchar
*
)
(
*
b
)
->
word
+
1
,(
*
b
)
->
len
-
1
,
(
uchar
*
)
(
*
a
)
->
word
+
1
,(
*
a
)
->
len
-
1
,
0
,
0
);
/* ORDER BY word
, ndepth
*/
int
i
=
mi_compare_text
(
cs
,
(
uchar
*
)
(
*
a
)
->
word
+
1
,
(
*
a
)
->
len
-
1
,
(
uchar
*
)
(
*
b
)
->
word
+
1
,
(
*
b
)
->
len
-
1
,
0
,
0
);
if
(
!
i
)
i
=
CMP_NUM
((
*
b
)
->
ndepth
,(
*
a
)
->
ndepth
);
i
=
CMP_NUM
((
*
a
)
->
ndepth
,
(
*
b
)
->
ndepth
);
return
i
;
}
...
...
@@ -674,23 +674,49 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
(
byte
*
)
end
,
&
word
,
TRUE
))
{
int
a
,
b
,
c
;
/*
Find right-most element in the array of query words matching this
word from a document.
*/
for
(
a
=
0
,
b
=
ftb
->
queue
.
elements
,
c
=
(
a
+
b
)
/
2
;
b
-
a
>
1
;
c
=
(
a
+
b
)
/
2
)
{
ftbw
=
ftb
->
list
[
c
];
if
(
mi_compare_text
(
ftb
->
charset
,
(
uchar
*
)
word
.
pos
,
word
.
len
,
(
uchar
*
)
ftbw
->
word
+
1
,
ftbw
->
len
-
1
,
(
my_bool
)
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
0
)
>
0
)
(
my_bool
)
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
0
)
<
0
)
b
=
c
;
else
a
=
c
;
}
/*
If there were no words with truncation operator, we iterate to the
beginning of an array until array element is equal to the word from
a document. This is done mainly because the same word may be
mentioned twice (or more) in the query.
In case query has words with truncation operator we must iterate
to the beginning of the array. There may be non-matching query words
between matching word with truncation operator and the right-most
matching element. E.g., if we're looking for 'aaa15' in an array of
'aaa1* aaa14 aaa15 aaa16'.
Worse of that there still may be match even if the binary search
above didn't find matching element. E.g., if we're looking for
'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will
stop at 'aaa16'.
*/
for
(;
c
>=
0
;
c
--
)
{
ftbw
=
ftb
->
list
[
c
];
if
(
mi_compare_text
(
ftb
->
charset
,
(
uchar
*
)
word
.
pos
,
word
.
len
,
(
uchar
*
)
ftbw
->
word
+
1
,
ftbw
->
len
-
1
,
(
my_bool
)
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
0
))
{
if
(
ftb
->
with_scan
&
FTB_FLAG_TRUNC
)
continue
;
else
break
;
}
if
(
ftbw
->
docid
[
1
]
==
docid
)
continue
;
ftbw
->
docid
[
1
]
=
docid
;
...
...
mysql-test/r/alter_table.result
View file @
cbe1a8a0
...
...
@@ -915,3 +915,19 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1 (a tinytext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create table t1 (a mediumtext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
mysql-test/r/fulltext.result
View file @
cbe1a8a0
...
...
@@ -497,3 +497,12 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 4 Using where
DROP TABLE t1;
CREATE TABLE t1(a CHAR(10));
INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
1
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
2
DROP TABLE t1;
mysql-test/r/func_str.result
View file @
cbe1a8a0
...
...
@@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` (
`conv(130,16,10)` varchar(64) default NULL,
`hex(130)` varchar(6) NOT NULL default '',
`char(130)` varbinary(4) NOT NULL default '',
`format(130,10)` varchar(
4
) NOT NULL default '',
`format(130,10)` varchar(
16
) NOT NULL default '',
`left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
`right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '',
`lcase(_latin2'a')` varchar(1) character set latin2 NOT NULL default '',
...
...
@@ -2175,4 +2173,12 @@ SELECT HEX(c1) from v1;
HEX(c1)
414243
DROP VIEW v1;
create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def format(a, 2) 253 20 4 Y 0 2 8
format(a, 2)
1.33
drop table t1;
End of 5.0 tests
mysql-test/r/type_bit.result
View file @
cbe1a8a0
...
...
@@ -708,4 +708,45 @@ HEX(b1) HEX(b2) i2
1 0 100
1 0 200
DROP TABLE t1, t2;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'10',
f2 bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` bit(2) NOT NULL default b'10',
`f2` bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
DROP TABLE t1;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
ERROR 42000: Invalid default value for 'f1'
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
create table t2bit7 (b1 bit(7)) engine=MyISAM;
insert into t1bit7 values (b'1100000');
insert into t1bit7 values (b'1100001');
insert into t1bit7 values (b'1100010');
insert into t2bit7 values (b'1100001');
insert into t2bit7 values (b'1100010');
insert into t2bit7 values (b'1100110');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
1100001
1100010
drop table t1bit7, t2bit7;
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
create table t2bit7 (b1 bit(15)) engine=MyISAM;
insert into t1bit7 values (b'110000011111111');
insert into t1bit7 values (b'110000111111111');
insert into t1bit7 values (b'110001011111111');
insert into t2bit7 values (b'110000111111111');
insert into t2bit7 values (b'110001011111111');
insert into t2bit7 values (b'110011011111111');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
110000111111111
110001011111111
drop table t1bit7, t2bit7;
End of 5.0 tests
mysql-test/r/type_float.result
View file @
cbe1a8a0
...
...
@@ -398,11 +398,11 @@ insert into t1(d) values (9.2233720368547777e+18),
(9.22337203685479e18),
(1.84e19);
update t1 set u = d;
select
*
from t1;
d
u
9
.22337203685478e+18 9
223372036854775808
9
.22337203685478e+18 9
223372036854779904
9
.22337203685479e+18 9
223372036854790144
1
.84e+19 1
8400000000000000000
select
u
from t1;
u
9223372036854775808
9223372036854779904
9223372036854790144
18400000000000000000
drop table t1;
End of 5.0 tests
mysql-test/t/alter_table.test
View file @
cbe1a8a0
...
...
@@ -696,3 +696,16 @@ unlock tables;
select
*
from
t1
;
check
table
t1
;
drop
table
t1
;
#
# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
#
create
table
t1
(
a
tinytext
character
set
latin1
);
alter
table
t1
convert
to
character
set
utf8
;
show
create
table
t1
;
drop
table
t1
;
create
table
t1
(
a
mediumtext
character
set
latin1
);
alter
table
t1
convert
to
character
set
utf8
;
show
create
table
t1
;
drop
table
t1
;
mysql-test/t/fulltext.test
View file @
cbe1a8a0
...
...
@@ -423,3 +423,12 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE
MATCH
(
a
)
AGAINST
(
'test'
IN
BOOLEAN
MODE
)
AND
b
=
1
;
DROP
TABLE
t1
;
#
# BUG#37245 - Full text search problem
#
CREATE
TABLE
t1
(
a
CHAR
(
10
));
INSERT
INTO
t1
VALUES
(
'aaa15'
);
SELECT
MATCH
(
a
)
AGAINST
(
'aaa1* aaa14 aaa16'
IN
BOOLEAN
MODE
)
FROM
t1
;
SELECT
MATCH
(
a
)
AGAINST
(
'aaa1* aaa14 aaa15 aaa16'
IN
BOOLEAN
MODE
)
FROM
t1
;
DROP
TABLE
t1
;
mysql-test/t/func_str.test
View file @
cbe1a8a0
...
...
@@ -1149,4 +1149,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
SELECT
HEX
(
c1
)
from
v1
;
DROP
VIEW
v1
;
#
# Bug #35558 Wrong server metadata blows up the client
#
create
table
t1
(
a
float
);
insert
into
t1
values
(
1.33
);
--
enable_metadata
select
format
(
a
,
2
)
from
t1
;
--
disable_metadata
drop
table
t1
;
--
echo
End
of
5.0
tests
mysql-test/t/type_bit.test
View file @
cbe1a8a0
...
...
@@ -352,4 +352,49 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2
DROP
TABLE
t1
,
t2
;
#
# Bug #35796 SHOW CREATE TABLE and default value for BIT field
#
CREATE
TABLE
IF
NOT
EXISTS
t1
(
f1
bit
(
2
)
NOT
NULL
default
b
'10'
,
f2
bit
(
14
)
NOT
NULL
default
b
'11110000111100'
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
COLLATE
=
latin1_general_ci
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
--
error
ER_INVALID_DEFAULT
CREATE
TABLE
IF
NOT
EXISTS
t1
(
f1
bit
(
2
)
NOT
NULL
default
b
''
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
COLLATE
=
latin1_general_ci
;
#
# Bug#31399 Wrong query result when doing join buffering over BIT fields
#
create
table
t1bit7
(
a1
bit
(
7
)
not
null
)
engine
=
MyISAM
;
create
table
t2bit7
(
b1
bit
(
7
))
engine
=
MyISAM
;
insert
into
t1bit7
values
(
b
'1100000'
);
insert
into
t1bit7
values
(
b
'1100001'
);
insert
into
t1bit7
values
(
b
'1100010'
);
insert
into
t2bit7
values
(
b
'1100001'
);
insert
into
t2bit7
values
(
b
'1100010'
);
insert
into
t2bit7
values
(
b
'1100110'
);
select
bin
(
a1
)
from
t1bit7
,
t2bit7
where
t1bit7
.
a1
=
t2bit7
.
b1
;
drop
table
t1bit7
,
t2bit7
;
create
table
t1bit7
(
a1
bit
(
15
)
not
null
)
engine
=
MyISAM
;
create
table
t2bit7
(
b1
bit
(
15
))
engine
=
MyISAM
;
insert
into
t1bit7
values
(
b
'110000011111111'
);
insert
into
t1bit7
values
(
b
'110000111111111'
);
insert
into
t1bit7
values
(
b
'110001011111111'
);
insert
into
t2bit7
values
(
b
'110000111111111'
);
insert
into
t2bit7
values
(
b
'110001011111111'
);
insert
into
t2bit7
values
(
b
'110011011111111'
);
select
bin
(
a1
)
from
t1bit7
,
t2bit7
where
t1bit7
.
a1
=
t2bit7
.
b1
;
drop
table
t1bit7
,
t2bit7
;
--
echo
End
of
5.0
tests
mysql-test/t/type_float.test
View file @
cbe1a8a0
...
...
@@ -265,7 +265,7 @@ insert into t1(d) values (9.2233720368547777e+18),
(
1.84e19
);
update
t1
set
u
=
d
;
select
*
from
t1
;
select
u
from
t1
;
drop
table
t1
;
...
...
sql/field.cc
View file @
cbe1a8a0
...
...
@@ -3473,7 +3473,7 @@ int Field_longlong::store(double nr)
error
=
1
;
}
else
res
=
(
longlong
)
(
ulonglong
)
nr
;
res
=
(
longlong
)
double2ulonglong
(
nr
)
;
}
else
{
...
...
sql/item.cc
View file @
cbe1a8a0
...
...
@@ -4950,6 +4950,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions)
ulonglong
nr
;
uint32
length
=
str_value
.
length
();
if
(
!
length
)
return
1
;
if
(
length
>
8
)
{
nr
=
field
->
flags
&
UNSIGNED_FLAG
?
ULONGLONG_MAX
:
LONGLONG_MAX
;
...
...
sql/item_strfunc.h
View file @
cbe1a8a0
...
...
@@ -516,8 +516,9 @@ public:
{
collation
.
set
(
default_charset
());
uint
char_length
=
args
[
0
]
->
max_length
/
args
[
0
]
->
collation
.
collation
->
mbmaxlen
;
max_length
=
((
char_length
+
(
char_length
-
args
[
0
]
->
decimals
)
/
3
)
*
collation
.
collation
->
mbmaxlen
);
uint
max_sep_count
=
char_length
/
3
+
(
decimals
?
1
:
0
)
+
/*sign*/
1
;
max_length
=
(
char_length
+
max_sep_count
+
decimals
)
*
collation
.
collation
->
mbmaxlen
;
}
const
char
*
func_name
()
const
{
return
"format"
;
}
void
print
(
String
*
);
...
...
sql/sql_select.cc
View file @
cbe1a8a0
...
...
@@ -13233,6 +13233,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length
=
0
;
for
(
i
=
0
;
i
<
table_count
;
i
++
)
{
bool
have_bit_fields
=
FALSE
;
uint
null_fields
=
0
,
used_fields
;
Field
**
f_ptr
,
*
field
;
...
...
@@ -13247,13 +13248,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length
+=
field
->
fill_cache_field
(
copy
);
if
(
copy
->
blob_field
)
(
*
blob_ptr
++
)
=
copy
;
if
(
field
->
maybe_null
())
if
(
field
->
real_
maybe_null
())
null_fields
++
;
if
(
field
->
type
()
==
MYSQL_TYPE_BIT
&&
((
Field_bit
*
)
field
)
->
bit_len
)
have_bit_fields
=
TRUE
;
copy
++
;
}
}
/* Copy null bits from table */
if
(
null_fields
&&
tables
[
i
].
table
->
s
->
null
_fields
)
if
(
null_fields
||
have_bit
_fields
)
{
/* must copy null bits */
copy
->
str
=
(
char
*
)
tables
[
i
].
table
->
null_flags
;
copy
->
length
=
tables
[
i
].
table
->
s
->
null_bytes
;
...
...
sql/sql_show.cc
View file @
cbe1a8a0
...
...
@@ -798,7 +798,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{
bool
has_default
;
bool
has_now_default
;
enum
enum_field_types
field_type
=
field
->
type
();
/*
We are using CURRENT_TIMESTAMP instead of NOW because it is
more standard
...
...
@@ -806,7 +806,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
has_now_default
=
table
->
timestamp_field
==
field
&&
field
->
unireg_check
!=
Field
::
TIMESTAMP_UN_FIELD
;
has_default
=
(
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
has_default
=
(
field
_type
!=
FIELD_TYPE_BLOB
&&
!
(
field
->
flags
&
NO_DEFAULT_VALUE_FLAG
)
&&
field
->
unireg_check
!=
Field
::
NEXT_NUMBER
&&
!
((
thd
->
variables
.
sql_mode
&
(
MODE_MYSQL323
|
MODE_MYSQL40
))
...
...
@@ -821,6 +821,18 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{
// Not null by default
char
tmp
[
MAX_FIELD_WIDTH
];
String
type
(
tmp
,
sizeof
(
tmp
),
field
->
charset
());
if
(
field_type
==
MYSQL_TYPE_BIT
)
{
longlong
dec
=
field
->
val_int
();
char
*
ptr
=
longlong2str
(
dec
,
tmp
+
2
,
2
);
uint32
length
=
(
uint32
)
(
ptr
-
tmp
);
tmp
[
0
]
=
'b'
;
tmp
[
1
]
=
'\''
;
tmp
[
length
]
=
'\''
;
type
.
length
(
length
+
1
);
quoted
=
0
;
}
else
field
->
val_str
(
&
type
);
if
(
type
.
length
())
{
...
...
sql/sql_table.cc
View file @
cbe1a8a0
...
...
@@ -1535,7 +1535,9 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
if
((
sql_field
->
flags
&
BLOB_FLAG
)
&&
sql_field
->
length
)
{
if
(
sql_field
->
sql_type
==
FIELD_TYPE_BLOB
)
if
(
sql_field
->
sql_type
==
FIELD_TYPE_BLOB
||
sql_field
->
sql_type
==
FIELD_TYPE_TINY_BLOB
||
sql_field
->
sql_type
==
FIELD_TYPE_MEDIUM_BLOB
)
{
/* The user has given a length to the blob column */
sql_field
->
sql_type
=
get_blob_type_from_length
(
sql_field
->
length
);
...
...
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