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
e8e6d057
Commit
e8e6d057
authored
Dec 28, 2004
by
lenz@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge lgrimmer@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/space/my/mysql-4.1
parents
878ed021
cf6e2214
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
29 deletions
+39
-29
client/mysqldump.c
client/mysqldump.c
+15
-28
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+6
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+8
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+10
-1
No files found.
client/mysqldump.c
View file @
e8e6d057
...
...
@@ -137,7 +137,6 @@ typedef struct st_table_rule_ent
uint
key_len
;
}
TABLE_RULE_ENT
;
my_bool
ignore_table_inited
;
HASH
ignore_table
;
static
struct
my_option
my_long_options
[]
=
...
...
@@ -532,16 +531,12 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len,
}
void
init_table_rule_hash
(
HASH
*
h
,
bool
*
h_inited
)
void
init_table_rule_hash
(
HASH
*
h
)
{
if
(
hash_init
(
h
,
charset_info
,
TABLE_RULE_HASH_SIZE
,
0
,
0
,
(
hash_get_key
)
get_table_key
,
(
hash_free_key
)
free_table_ent
,
0
))
{
fprintf
(
stderr
,
"Internal hash initialization error
\n
"
);
exit
(
1
);
}
*
h_inited
=
1
;
exit
(
EX_EOM
);
}
...
...
@@ -617,33 +612,26 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break
;
case
(
int
)
OPT_IGNORE_TABLE
:
{
const
char
*
dot
=
strchr
(
argument
,
'.'
);
if
(
!
dot
)
uint
len
=
(
uint
)
strlen
(
argument
);
TABLE_RULE_ENT
*
e
;
if
(
!
strchr
(
argument
,
'.'
))
{
fprintf
(
stderr
,
"Illegal use of option --ignore-table=<database>.<table>
\n
"
);
exit
(
1
);
}
// len is always > 0 because we know the there exists a '.'
uint
len
=
(
uint
)
strlen
(
argument
);
TABLE_RULE_ENT
*
e
=
(
TABLE_RULE_ENT
*
)
my_malloc
(
sizeof
(
TABLE_RULE_ENT
)
+
len
,
MYF
(
MY_WME
));
/* len is always > 0 because we know the there exists a '.' */
e
=
(
TABLE_RULE_ENT
*
)
my_malloc
(
sizeof
(
TABLE_RULE_ENT
)
+
len
,
MYF
(
MY_WME
));
if
(
!
e
)
{
fprintf
(
stderr
,
"Internal memory allocation error
\n
"
);
exit
(
1
);
}
exit
(
EX_EOM
);
e
->
key
=
(
char
*
)
e
+
sizeof
(
TABLE_RULE_ENT
);
e
->
key_len
=
len
;
memcpy
(
e
->
key
,
argument
,
len
);
if
(
!
ignore_table_inited
)
init_table_rule_hash
(
&
ignore_table
,
&
ignore_table_inited
);
if
(
!
hash_inited
(
&
ignore_table
)
)
init_table_rule_hash
(
&
ignore_table
);
if
(
my_hash_insert
(
&
ignore_table
,
(
byte
*
)
e
))
{
fprintf
(
stderr
,
"Internal hash insert error
\n
"
);
exit
(
1
);
}
exit
(
EX_EOM
);
break
;
}
case
(
int
)
OPT_COMPATIBLE
:
...
...
@@ -2021,8 +2009,7 @@ static int init_dumping(char *database)
my_bool
include_table
(
byte
*
hash_key
,
uint
len
)
{
if
(
ignore_table_inited
&&
hash_search
(
&
ignore_table
,
(
byte
*
)
hash_key
,
len
))
if
(
hash_search
(
&
ignore_table
,
(
byte
*
)
hash_key
,
len
))
return
FALSE
;
return
TRUE
;
...
...
mysql-test/r/func_str.result
View file @
e8e6d057
...
...
@@ -697,3 +697,9 @@ quote(ltrim(concat(' ', 'a')))
select quote(trim(concat(' ', 'a')));
quote(trim(concat(' ', 'a')))
'a'
select trim(null from 'kate') as "must_be_null";
must_be_null
NULL
select trim('xyz' from null) as "must_be_null";
must_be_null
NULL
mysql-test/t/func_str.test
View file @
e8e6d057
...
...
@@ -435,3 +435,11 @@ drop table t1;
select
quote
(
ltrim
(
concat
(
' '
,
'a'
)));
select
quote
(
trim
(
concat
(
' '
,
'a'
)));
#
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
# According to ANSI if one of the TRIM arguments is NULL, then the result
# must be NULL too.
#
select
trim
(
null
from
'kate'
)
as
"must_be_null"
;
select
trim
(
'xyz'
from
null
)
as
"must_be_null"
;
sql/item_strfunc.cc
View file @
e8e6d057
...
...
@@ -1302,9 +1302,18 @@ String *Item_func_trim::val_str(String *str)
return
0
;
/* purecov: inspected */
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
String
*
remove_str
=
(
arg_count
==
2
)
?
args
[
1
]
->
val_str
(
&
tmp
)
:
&
remove
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
String
*
remove_str
;
/* The string to remove from res. */
if
(
arg_count
==
2
)
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
}
else
remove_str
=
&
remove
;
/* Default value. */
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
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