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
a13ef90e
Commit
a13ef90e
authored
Mar 25, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0
into mysql.com:/home/jimw/my/mysql-5.0-clean
parents
3b090265
97b5cbba
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
221 additions
and
59 deletions
+221
-59
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
myisam/myisamchk.c
myisam/myisamchk.c
+2
-2
mysql-test/r/ctype_big5.result
mysql-test/r/ctype_big5.result
+7
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+8
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+20
-0
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+4
-2
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+0
-8
mysql-test/t/ctype_big5.test
mysql-test/t/ctype_big5.test
+9
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+14
-0
mysql-test/t/information_schema.test
mysql-test/t/information_schema.test
+1
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+0
-9
sql/item_func.h
sql/item_func.h
+2
-1
sql/item_strfunc.h
sql/item_strfunc.h
+4
-0
sql/sql_select.cc
sql/sql_select.cc
+3
-2
sql/sql_show.cc
sql/sql_show.cc
+95
-34
sql/table.h
sql/table.h
+2
-0
strings/ctype-big5.c
strings/ctype-big5.c
+38
-1
tests/mysql_client_test.c
tests/mysql_client_test.c
+2
-0
No files found.
BitKeeper/etc/logging_ok
View file @
a13ef90e
...
...
@@ -25,6 +25,7 @@ bar@bar.intranet.mysql.r18.ru
bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bar@deer.(none)
bar@eagle.intranet.mysql.r18.ru
bar@gw.udmsearch.izhnet.ru
bar@mysql.com
bar@noter.intranet.mysql.r18.ru
...
...
myisam/myisamchk.c
View file @
a13ef90e
...
...
@@ -427,8 +427,8 @@ static void usage(void)
can't fix the data file.
\n
\
--character-sets-dir=...
\n
\
Directory where character sets are.
\n
\
--set-c
haracter-set
=name
\n
\
Change the c
haracter set
used by the index.
\n
\
--set-c
ollation
=name
\n
\
Change the c
ollation
used by the index.
\n
\
-q, --quick Faster repair by not modifying the data file.
\n
\
One can give a second '-q' to force myisamchk to
\n
\
modify the original datafile in case of duplicate keys.
\n
\
...
...
mysql-test/r/ctype_big5.result
View file @
a13ef90e
...
...
@@ -77,3 +77,10 @@ big5_bin 6109
big5_bin 61
big5_bin 6120
drop table t1;
SET NAMES big5;
CREATE TABLE t1 (a text) character set big5;
INSERT INTO t1 VALUES ('ùØ');
SELECT * FROM t1;
a
ùØ
DROP TABLE t1;
mysql-test/r/ctype_ucs.result
View file @
a13ef90e
...
...
@@ -642,3 +642,11 @@ Warnings:
Warning 1264 Out of range value adjusted for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
SELECT * FROM t1;
a b
1.1 1.100
2.1 2.100
DROP TABLE t1;
mysql-test/r/func_str.result
View file @
a13ef90e
...
...
@@ -639,6 +639,26 @@ drop table t1;
select charset(null), collation(null), coercibility(null);
charset(null) collation(null) coercibility(null)
binary binary 5
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (a int, b int);
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (2,2),(3,3);
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
a b a b
1 1 NULL NULL
2 2 2 2
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
a b a b
1 1 NULL NULL
2 2 2 2
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
where coercibility(t2.a) = 2 order by t1.a,t2.a;
a b a b
1 1 NULL NULL
2 2 2 2
DROP TABLE t1, t2;
select SUBSTR('abcdefg',3,2);
SUBSTR('abcdefg',3,2)
cd
...
...
mysql-test/r/information_schema.result
View file @
a13ef90e
...
...
@@ -441,7 +441,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` (
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
MAX_ROWS=1818
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
...
...
@@ -450,7 +450,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` (
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
MAX_ROWS=1818
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like "latin1";
...
...
@@ -651,6 +651,8 @@ drop table t1, t2;
CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
count(*)
100
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
...
...
mysql-test/r/type_newdecimal.result
View file @
a13ef90e
...
...
@@ -180,14 +180,6 @@ t1 CREATE TABLE `t1` (
`-(-1.1)` decimal(7,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
update t1 set b=a;
SELECT * FROM t1;
a b
1.1 1.100
2.1 2.100
DROP TABLE t1;
set session sql_mode='traditional';
select 1e10/0e0;
1e10/0e0
...
...
mysql-test/t/ctype_big5.test
View file @
a13ef90e
...
...
@@ -16,3 +16,12 @@ SET collation_connection='big5_chinese_ci';
--
source
include
/
ctype_filesort
.
inc
SET
collation_connection
=
'big5_bin'
;
--
source
include
/
ctype_filesort
.
inc
#
# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
#
SET
NAMES
big5
;
CREATE
TABLE
t1
(
a
text
)
character
set
big5
;
INSERT
INTO
t1
VALUES
(
''
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
mysql-test/t/ctype_ucs.test
View file @
a13ef90e
...
...
@@ -414,3 +414,12 @@ CREATE TABLE t1 (Field1 int(10) unsigned default '0');
INSERT
INTO
t1
VALUES
(
'-1'
);
DROP
TABLE
t1
;
SET
NAMES
latin1
;
#
# Conversion from an UCS2 string to a decimal column
#
CREATE
TABLE
t1
(
a
varchar
(
64
)
character
set
ucs2
,
b
decimal
(
10
,
3
));
INSERT
INTO
t1
VALUES
(
"1.1"
,
0
),
(
"2.1"
,
0
);
update
t1
set
b
=
a
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
mysql-test/t/func_str.test
View file @
a13ef90e
...
...
@@ -377,6 +377,20 @@ insert into t1 values (null);
select
charset
(
a
),
collation
(
a
),
coercibility
(
a
)
from
t1
;
drop
table
t1
;
select
charset
(
null
),
collation
(
null
),
coercibility
(
null
);
#
# Make sure OUTER JOIN is not replaced with a regular joun
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
CREATE
TABLE
t2
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
);
INSERT
INTO
t2
VALUES
(
2
,
2
),(
3
,
3
);
select
t1
.*
,
t2
.*
from
t1
left
join
t2
on
(
t1
.
b
=
t2
.
b
)
where
collation
(
t2
.
a
)
=
_utf8
'binary'
order
by
t1
.
a
,
t2
.
a
;
select
t1
.*
,
t2
.*
from
t1
left
join
t2
on
(
t1
.
b
=
t2
.
b
)
where
charset
(
t2
.
a
)
=
_utf8
'binary'
order
by
t1
.
a
,
t2
.
a
;
select
t1
.*
,
t2
.*
from
t1
left
join
t2
on
(
t1
.
b
=
t2
.
b
)
where
coercibility
(
t2
.
a
)
=
2
order
by
t1
.
a
,
t2
.
a
;
DROP
TABLE
t1
,
t2
;
#
# test for SUBSTR
...
...
mysql-test/t/information_schema.test
View file @
a13ef90e
...
...
@@ -403,6 +403,7 @@ while ($tab_count)
--
disable_result_log
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA
.
TABLES
;
--
enable_result_log
SELECT
count
(
*
)
FROM
INFORMATION_SCHEMA
.
TABLES
;
let
$tab_count
=
65
;
while
(
$tab_count
)
{
...
...
mysql-test/t/type_newdecimal.test
View file @
a13ef90e
...
...
@@ -90,15 +90,6 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-
show
create
table
t1
;
drop
table
t1
;
#
# conversion from ucs2
#
CREATE
TABLE
t1
(
a
varchar
(
64
)
character
set
ucs2
,
b
decimal
(
10
,
3
));
INSERT
INTO
t1
VALUES
(
"1.1"
,
0
),
(
"2.1"
,
0
);
update
t1
set
b
=
a
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Trydy's tests
#
...
...
sql/item_func.h
View file @
a13ef90e
...
...
@@ -704,7 +704,8 @@ public:
Item_func_coercibility
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"coercibility"
;
}
void
fix_length_and_dec
()
{
max_length
=
10
;
}
void
fix_length_and_dec
()
{
max_length
=
10
;
maybe_null
=
0
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
};
class
Item_func_locate
:
public
Item_int_func
...
...
sql/item_strfunc.h
View file @
a13ef90e
...
...
@@ -653,7 +653,9 @@ public:
{
collation
.
set
(
system_charset_info
);
max_length
=
64
*
collation
.
collation
->
mbmaxlen
;
// should be enough
maybe_null
=
0
;
};
table_map
not_null_tables
()
const
{
return
0
;
}
};
class
Item_func_collation
:
public
Item_str_func
...
...
@@ -666,7 +668,9 @@ public:
{
collation
.
set
(
system_charset_info
);
max_length
=
64
*
collation
.
collation
->
mbmaxlen
;
// should be enough
maybe_null
=
0
;
};
table_map
not_null_tables
()
const
{
return
0
;
}
};
class
Item_func_crc32
:
public
Item_int_func
...
...
sql/sql_select.cc
View file @
a13ef90e
...
...
@@ -8714,6 +8714,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
*
table
=
new_table
;
table
->
s
=
&
table
->
share_not_to_be_used
;
table
->
file
->
change_table_ptr
(
table
);
if
(
save_proc_info
)
thd
->
proc_info
=
(
!
strcmp
(
save_proc_info
,
"Copying to tmp table"
)
?
"Copying to tmp table on disk"
:
save_proc_info
);
DBUG_RETURN
(
0
);
...
...
sql/sql_show.cc
View file @
a13ef90e
...
...
@@ -41,6 +41,7 @@ static int
store_create_info
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
String
*
packet
);
static
int
view_store_create_info
(
THD
*
thd
,
TABLE_LIST
*
table
,
String
*
packet
);
static
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
/***************************************************************************
...
...
@@ -978,7 +979,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet
->
append
(
buff
,
(
uint
)
(
end
-
buff
));
}
if
(
share
->
max_rows
)
if
(
share
->
max_rows
&&
!
table_list
->
schema_table
)
{
packet
->
append
(
" MAX_ROWS="
,
10
);
end
=
longlong10_to_str
(
share
->
max_rows
,
buff
,
10
);
...
...
@@ -1550,7 +1551,8 @@ static bool show_status_array(THD *thd, const char *wild,
table
->
field
[
0
]
->
store
(
name_buffer
,
strlen
(
name_buffer
),
system_charset_info
);
table
->
field
[
1
]
->
store
(
pos
,
(
uint32
)
(
end
-
pos
),
system_charset_info
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
TRUE
);
}
}
}
...
...
@@ -1606,6 +1608,33 @@ typedef struct st_index_field_values
}
INDEX_FIELD_VALUES
;
/*
Store record to I_S table, convert HEAP table
to MyISAM if necessary
SYNOPSIS
schema_table_store_record()
thd thread handler
table I_S table
RETURN
1 error
0 success
*/
static
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
)
{
int
error
;
if
((
error
=
table
->
file
->
write_row
(
table
->
record
[
0
])))
{
if
(
create_myisam_from_heap
(
thd
,
table
,
table
->
pos_in_table_list
->
schema_table_param
,
error
,
0
))
return
1
;
}
return
0
;
}
void
get_index_field_values
(
LEX
*
lex
,
INDEX_FIELD_VALUES
*
index_field_values
)
{
const
char
*
wild
=
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
;
...
...
@@ -1929,7 +1958,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
}
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
error
);
}
else
{
...
...
@@ -1966,13 +1996,13 @@ err:
}
void
store_schema_shemata
(
TABLE
*
table
,
const
char
*
db_name
,
bool
store_schema_shemata
(
THD
*
thd
,
TABLE
*
table
,
const
char
*
db_name
,
const
char
*
cs_name
)
{
restore_record
(
table
,
s
->
default_values
);
table
->
field
[
1
]
->
store
(
db_name
,
strlen
(
db_name
),
system_charset_info
);
table
->
field
[
2
]
->
store
(
cs_name
,
strlen
(
cs_name
),
system_charset_info
);
table
->
file
->
write_row
(
table
->
record
[
0
]
);
return
schema_table_store_record
(
thd
,
table
);
}
...
...
@@ -2001,7 +2031,9 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
{
if
(
with_i_schema
)
// information schema name is always first in list
{
store_schema_shemata
(
table
,
file_name
,
system_charset_info
->
csname
);
if
(
store_schema_shemata
(
thd
,
table
,
file_name
,
system_charset_info
->
csname
))
DBUG_RETURN
(
1
);
with_i_schema
=
0
;
continue
;
}
...
...
@@ -2024,8 +2056,9 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
path
[
length
-
1
]
=
FN_LIBCHAR
;
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
load_db_opt
(
thd
,
path
,
&
create
);
store_schema_shemata
(
table
,
file_name
,
create
.
default_table_charset
->
csname
);
if
(
store_schema_shemata
(
thd
,
table
,
file_name
,
create
.
default_table_charset
->
csname
))
DBUG_RETURN
(
1
);
}
}
DBUG_RETURN
(
0
);
...
...
@@ -2210,8 +2243,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
}
}
}
table
->
file
->
write_row
(
table
->
record
[
0
]);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
schema_table_store_record
(
thd
,
table
));
}
...
...
@@ -2389,7 +2421,8 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
#endif
table
->
field
[
17
]
->
store
(
tmp
+
1
,
end
==
tmp
?
0
:
(
uint
)
(
end
-
tmp
-
1
),
cs
);
table
->
field
[
18
]
->
store
(
field
->
comment
.
str
,
field
->
comment
.
length
,
cs
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
}
DBUG_RETURN
(
0
);
...
...
@@ -2418,7 +2451,8 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
strlen
(
tmp_cs
->
comment
?
tmp_cs
->
comment
:
""
),
scs
);
table
->
field
[
3
]
->
store
((
longlong
)
tmp_cs
->
mbmaxlen
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
return
1
;
}
}
return
0
;
...
...
@@ -2457,7 +2491,8 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
tmp_buff
=
(
tmp_cl
->
state
&
MY_CS_COMPILED
)
?
"Yes"
:
""
;
table
->
field
[
4
]
->
store
(
tmp_buff
,
strlen
(
tmp_buff
),
scs
);
table
->
field
[
5
]
->
store
((
longlong
)
tmp_cl
->
strxfrm_multiply
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
return
1
;
}
}
}
...
...
@@ -2486,14 +2521,15 @@ int fill_schema_coll_charset_app(THD *thd, TABLE_LIST *tables, COND *cond)
restore_record
(
table
,
s
->
default_values
);
table
->
field
[
0
]
->
store
(
tmp_cl
->
name
,
strlen
(
tmp_cl
->
name
),
scs
);
table
->
field
[
1
]
->
store
(
tmp_cl
->
csname
,
strlen
(
tmp_cl
->
csname
),
scs
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
return
1
;
}
}
return
0
;
}
void
store_schema_proc
(
THD
*
thd
,
TABLE
*
table
,
TABLE
*
proc_table
,
bool
store_schema_proc
(
THD
*
thd
,
TABLE
*
table
,
TABLE
*
proc_table
,
const
char
*
wild
,
bool
full_access
,
const
char
*
sp_user
)
{
String
tmp_string
;
...
...
@@ -2507,7 +2543,7 @@ void store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
if
(
!
full_access
)
full_access
=
!
strcmp
(
sp_user
,
definer
);
if
(
!
full_access
&&
check_some_routine_access
(
thd
,
sp_db
,
sp_name
))
return
;
return
0
;
if
(
lex
->
orig_sql_command
==
SQLCOM_SHOW_STATUS_PROC
&&
proc_table
->
field
[
2
]
->
val_int
()
==
TYPE_ENUM_PROCEDURE
||
...
...
@@ -2556,9 +2592,10 @@ void store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
get_field
(
thd
->
mem_root
,
proc_table
->
field
[
15
],
&
tmp_string
);
table
->
field
[
18
]
->
store
(
tmp_string
.
ptr
(),
tmp_string
.
length
(),
cs
);
table
->
field
[
19
]
->
store
(
definer
,
strlen
(
definer
),
cs
);
table
->
file
->
write_row
(
table
->
record
[
0
]
);
return
schema_table_store_record
(
thd
,
table
);
}
}
return
0
;
}
...
...
@@ -2591,9 +2628,19 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
res
=
(
res
==
HA_ERR_END_OF_FILE
)
?
0
:
1
;
goto
err
;
}
store_schema_proc
(
thd
,
table
,
proc_table
,
wild
,
full_access
,
definer
);
if
(
store_schema_proc
(
thd
,
table
,
proc_table
,
wild
,
full_access
,
definer
))
{
res
=
1
;
goto
err
;
}
while
(
!
proc_table
->
file
->
index_next
(
proc_table
->
record
[
0
]))
store_schema_proc
(
thd
,
table
,
proc_table
,
wild
,
full_access
,
definer
);
{
if
(
store_schema_proc
(
thd
,
table
,
proc_table
,
wild
,
full_access
,
definer
))
{
res
=
1
;
goto
err
;
}
}
err:
proc_table
->
file
->
ha_index_end
();
...
...
@@ -2683,7 +2730,8 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
else
table
->
field
[
14
]
->
store
(
""
,
0
,
cs
);
table
->
field
[
14
]
->
set_notnull
();
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
}
}
...
...
@@ -2722,7 +2770,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
table
->
field
[
5
]
->
store
(
"YES"
,
3
,
cs
);
else
table
->
field
[
5
]
->
store
(
"NO"
,
2
,
cs
);
table
->
file
->
write_row
(
table
->
record
[
0
]
);
DBUG_RETURN
(
schema_table_store_record
(
thd
,
table
)
);
}
}
else
...
...
@@ -2736,9 +2784,9 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
}
void
store_constraints
(
TABLE
*
table
,
const
char
*
db
,
const
char
*
tname
,
const
char
*
key_name
,
uint
key_len
,
const
char
*
con_type
,
uint
con_len
)
bool
store_constraints
(
THD
*
thd
,
TABLE
*
table
,
const
char
*
db
,
const
char
*
tname
,
const
char
*
key_name
,
uint
key_len
,
const
char
*
con_type
,
uint
con_len
)
{
CHARSET_INFO
*
cs
=
system_charset_info
;
restore_record
(
table
,
s
->
default_values
);
...
...
@@ -2747,7 +2795,7 @@ void store_constraints(TABLE *table, const char*db, const char *tname,
table
->
field
[
3
]
->
store
(
db
,
strlen
(
db
),
cs
);
table
->
field
[
4
]
->
store
(
tname
,
strlen
(
tname
),
cs
);
table
->
field
[
5
]
->
store
(
con_type
,
con_len
,
cs
);
table
->
file
->
write_row
(
table
->
record
[
0
]
);
return
schema_table_store_record
(
thd
,
table
);
}
...
...
@@ -2780,11 +2828,17 @@ static int get_schema_constraints_record(THD *thd, struct st_table_list *tables,
continue
;
if
(
i
==
primary_key
&&
!
strcmp
(
key_info
->
name
,
primary_key_name
))
store_constraints
(
table
,
base_name
,
file_name
,
key_info
->
name
,
strlen
(
key_info
->
name
),
"PRIMARY KEY"
,
11
);
{
if
(
store_constraints
(
thd
,
table
,
base_name
,
file_name
,
key_info
->
name
,
strlen
(
key_info
->
name
),
"PRIMARY KEY"
,
11
))
DBUG_RETURN
(
1
);
}
else
if
(
key_info
->
flags
&
HA_NOSAME
)
store_constraints
(
table
,
base_name
,
file_name
,
key_info
->
name
,
strlen
(
key_info
->
name
),
"UNIQUE"
,
6
);
{
if
(
store_constraints
(
thd
,
table
,
base_name
,
file_name
,
key_info
->
name
,
strlen
(
key_info
->
name
),
"UNIQUE"
,
6
))
DBUG_RETURN
(
1
);
}
}
show_table
->
file
->
get_foreign_key_list
(
thd
,
&
f_key_list
);
...
...
@@ -2792,8 +2846,11 @@ static int get_schema_constraints_record(THD *thd, struct st_table_list *tables,
List_iterator_fast
<
FOREIGN_KEY_INFO
>
it
(
f_key_list
);
while
((
f_key_info
=
it
++
))
{
store_constraints
(
table
,
base_name
,
file_name
,
f_key_info
->
forein_id
->
str
,
strlen
(
f_key_info
->
forein_id
->
str
),
"FOREIGN KEY"
,
11
);
if
(
store_constraints
(
thd
,
table
,
base_name
,
file_name
,
f_key_info
->
forein_id
->
str
,
strlen
(
f_key_info
->
forein_id
->
str
),
"FOREIGN KEY"
,
11
))
DBUG_RETURN
(
1
);
}
}
DBUG_RETURN
(
res
);
...
...
@@ -2856,7 +2913,8 @@ static int get_schema_key_column_usage_record(THD *thd,
key_part
->
field
->
field_name
,
strlen
(
key_part
->
field
->
field_name
),
(
longlong
)
f_idx
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
}
}
...
...
@@ -2882,7 +2940,8 @@ static int get_schema_key_column_usage_record(THD *thd,
(
longlong
)
f_idx
);
table
->
field
[
8
]
->
store
((
longlong
)
f_idx
);
table
->
field
[
8
]
->
set_notnull
();
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
}
}
...
...
@@ -2907,7 +2966,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
table
->
field
[
1
]
->
store
(
open_list
->
table
,
strlen
(
open_list
->
table
),
cs
);
table
->
field
[
2
]
->
store
((
longlong
)
open_list
->
in_use
);
table
->
field
[
3
]
->
store
((
longlong
)
open_list
->
locked
);
table
->
file
->
write_row
(
table
->
record
[
0
]);
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
DBUG_RETURN
(
0
);
}
...
...
@@ -3048,6 +3108,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
TMP_TABLE_ALL_COLUMNS
),
HA_POS_ERROR
,
table_list
->
alias
)))
DBUG_RETURN
(
0
);
table_list
->
schema_table_param
=
tmp_table_param
;
DBUG_RETURN
(
table
);
}
...
...
sql/table.h
View file @
a13ef90e
...
...
@@ -322,6 +322,7 @@ typedef struct st_schema_table
struct
st_lex
;
class
select_union
;
class
TMP_TABLE_PARAM
;
struct
Field_translator
{
...
...
@@ -370,6 +371,7 @@ typedef struct st_table_list
ST_SCHEMA_TABLE
*
schema_table
;
/* Information_schema table */
st_select_lex
*
schema_select_lex
;
bool
schema_table_reformed
;
TMP_TABLE_PARAM
*
schema_table_param
;
/* link to select_lex where this table was used */
st_select_lex
*
select_lex
;
st_lex
*
view
;
/* link on VIEW lex for merging */
...
...
strings/ctype-big5.c
View file @
a13ef90e
...
...
@@ -6287,6 +6287,43 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
return
2
;
}
/*
Returns a well formed length of a BIG5 string.
CP950 and HKSCS additional characters are also accepted.
*/
static
uint
my_well_formed_len_big5
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
b
,
const
char
*
e
,
uint
pos
)
{
const
char
*
b0
=
b
;
const
char
*
emb
=
e
-
1
;
/* Last possible end of an MB character */
while
(
pos
&&
b
<
e
)
{
/*
Cast to int8 for extra safety. "char" can be unsigned
by default on some platforms.
*/
if
(((
int8
)
b
[
0
])
>=
0
)
{
/* Single byte ascii character */
b
++
;
}
else
if
((
b
<
emb
)
&&
isbig5code
((
uchar
)
*
b
,
(
uchar
)
b
[
1
]))
{
/* Double byte character */
b
+=
2
;
}
else
{
/* Wrong byte sequence */
break
;
}
}
return
b
-
b0
;
}
static
MY_COLLATION_HANDLER
my_collation_big5_chinese_ci_handler
=
{
NULL
,
/* init */
...
...
@@ -6308,7 +6345,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler=
mbcharlen_big5
,
my_numchars_mb
,
my_charpos_mb
,
my_well_formed_len_
mb
,
my_well_formed_len_
big5
,
my_lengthsp_8bit
,
my_numcells_8bit
,
my_mb_wc_big5
,
/* mb_wc */
...
...
tests/mysql_client_test.c
View file @
a13ef90e
...
...
@@ -12704,6 +12704,7 @@ from t2);");
static
void
test_bug8378
()
{
#ifdef HAVE_CHARSET_gbk
MYSQL
*
lmysql
;
char
out
[
9
];
/* strlen(TEST_BUG8378)*2+1 */
int
len
;
...
...
@@ -12738,6 +12739,7 @@ static void test_bug8378()
DIE_UNLESS
(
memcmp
(
out
,
TEST_BUG8378_OUT
,
len
)
==
0
);
mysql_close
(
lmysql
);
#endif
}
...
...
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