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
d8b078e4
Commit
d8b078e4
authored
Mar 21, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
parents
2aa44dd9
a1ab7860
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
86 additions
and
45 deletions
+86
-45
client/mysqldump.c
client/mysqldump.c
+2
-3
mysql-test/r/olap.result
mysql-test/r/olap.result
+45
-0
mysql-test/t/olap.test
mysql-test/t/olap.test
+7
-0
sql/handler.cc
sql/handler.cc
+9
-5
sql/item.cc
sql/item.cc
+2
-12
sql/item_sum.cc
sql/item_sum.cc
+7
-11
sql/mysqld.cc
sql/mysqld.cc
+4
-3
sql/sql_select.cc
sql/sql_select.cc
+9
-7
sql/sql_string.h
sql/sql_string.h
+1
-4
No files found.
client/mysqldump.c
View file @
d8b078e4
...
...
@@ -1093,7 +1093,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
number of fields in table, 0 if error
*/
static
uint
getTableStructure
(
char
*
table
,
char
*
db
)
static
uint
getTableStructure
(
char
*
table
,
char
*
db
)
{
MYSQL_RES
*
tableRes
;
MYSQL_ROW
row
;
...
...
@@ -1396,10 +1396,9 @@ static uint getTableStructure(char *table, char* db)
/* Get MySQL specific create options */
if
(
create_options
)
{
char
show_name_buff
[
FN_REFLEN
];
char
show_name_buff
[
NAME_LEN
*
2
+
2
+
24
];
/* Check memory for quote_for_like() */
DBUG_ASSERT
(
2
*
sizeof
(
table
)
<
sizeof
(
show_name_buff
));
my_snprintf
(
buff
,
sizeof
(
buff
),
"show table status like %s"
,
quote_for_like
(
table
,
show_name_buff
));
...
...
mysql-test/r/olap.result
View file @
d8b078e4
...
...
@@ -378,6 +378,51 @@ a sum(b)
2 6
4 4
NULL 14
SELECT b, a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
b a sum(b)
4 1 4
NULL 1 4
1 2 2
2 2 4
NULL 2 6
1 4 4
NULL 4 4
NULL NULL 14
SELECT DISTINCT b,a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
b a sum(b)
4 1 4
NULL 1 4
1 2 2
2 2 4
NULL 2 6
1 4 4
NULL 4 4
NULL NULL 14
ALTER TABLE t1 ADD COLUMN c INT;
SELECT a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
a b sum(c)
1 4 NULL
1 4 NULL
1 NULL NULL
2 1 NULL
2 1 NULL
2 2 NULL
2 2 NULL
2 NULL NULL
4 1 NULL
4 1 NULL
4 NULL NULL
NULL NULL NULL
SELECT distinct a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
a b sum(c)
1 4 NULL
1 NULL NULL
2 1 NULL
2 2 NULL
2 NULL NULL
4 1 NULL
4 NULL NULL
NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES
...
...
mysql-test/t/olap.test
View file @
d8b078e4
...
...
@@ -153,6 +153,13 @@ SELECT DISTINCT SUM(b), COUNT(DISTINCT b), COUNT(*) FROM t1
SELECT
a
,
sum
(
b
)
FROM
t1
GROUP
BY
a
,
b
WITH
ROLLUP
;
SELECT
DISTINCT
a
,
sum
(
b
)
FROM
t1
GROUP
BY
a
,
b
WITH
ROLLUP
;
SELECT
b
,
a
,
sum
(
b
)
FROM
t1
GROUP
BY
a
,
b
WITH
ROLLUP
;
SELECT
DISTINCT
b
,
a
,
sum
(
b
)
FROM
t1
GROUP
BY
a
,
b
WITH
ROLLUP
;
ALTER
TABLE
t1
ADD
COLUMN
c
INT
;
SELECT
a
,
b
,
sum
(
c
)
FROM
t1
GROUP
BY
a
,
b
,
c
WITH
ROLLUP
;
SELECT
distinct
a
,
b
,
sum
(
c
)
FROM
t1
GROUP
BY
a
,
b
,
c
WITH
ROLLUP
;
DROP
TABLE
t1
;
#
...
...
sql/handler.cc
View file @
d8b078e4
...
...
@@ -767,14 +767,13 @@ static char* xid_to_str(char *buf, XID *xid)
for
(
i
=
0
;
i
<
xid
->
gtrid_length
+
xid
->
bqual_length
;
i
++
)
{
uchar
c
=
(
uchar
)
xid
->
data
[
i
];
bool
is_next_dig
;
/* is_next_dig is set if next character is a number */
bool
is_next_dig
=
FALSE
;
if
(
i
<
XIDDATASIZE
)
{
char
ch
=
xid
->
data
[
i
+
1
];
is_next_dig
=
(
c
>=
'0'
&&
c
<=
'9'
);
char
ch
=
xid
->
data
[
i
+
1
];
is_next_dig
=
(
ch
>=
'0'
&&
ch
<=
'9'
);
}
else
is_next_dig
=
FALSE
;
if
(
i
==
xid
->
gtrid_length
)
{
*
s
++=
'\''
;
...
...
@@ -787,6 +786,11 @@ static char* xid_to_str(char *buf, XID *xid)
if
(
c
<
32
||
c
>
126
)
{
*
s
++=
'\\'
;
/*
If next character is a number, write current character with
3 octal numbers to ensure that the next number is not seen
as part of the octal number
*/
if
(
c
>
077
||
is_next_dig
)
*
s
++=
_dig_vec_lower
[
c
>>
6
];
if
(
c
>
007
||
is_next_dig
)
...
...
sql/item.cc
View file @
d8b078e4
...
...
@@ -586,18 +586,8 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs)
return
NULL
;
}
conv
->
str_value
.
copy
();
/*
The above line executes str_value.realloc() internally,
which alligns Alloced_length using ALLIGN_SIZE.
In the case of Item_string::str_value we don't want
Alloced_length to be longer than str_length.
Otherwise, some functions like Item_func_concat::val_str()
try to reuse str_value as a buffer for concatenation result
for optimization purposes, so our string constant become
corrupted. See bug#8785 for more details.
Let's shrink Alloced_length to str_length to avoid this problem.
*/
conv
->
str_value
.
shrink_to_length
();
/* Ensure that no one is going to change the result string */
conv
->
str_value
.
mark_as_const
();
return
conv
;
}
...
...
sql/item_sum.cc
View file @
d8b078e4
...
...
@@ -2667,11 +2667,11 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
TABLE
*
table
=
item
->
table
;
char
*
record
=
(
char
*
)
table
->
record
[
0
]
+
table
->
s
->
null_bytes
;
String
tmp
(
table
->
record
[
1
],
table
->
s
->
reclength
,
default_charset_info
),
tmp2
;
String
&
result
=
item
->
result
;
String
*
result
=
&
item
->
result
;
Item
**
arg
=
item
->
args
,
**
arg_end
=
item
->
args
+
item
->
arg_count_field
;
if
(
result
.
length
())
result
.
append
(
*
item
->
separator
);
if
(
result
->
length
())
result
->
append
(
*
item
->
separator
);
tmp
.
length
(
0
);
...
...
@@ -2698,14 +2698,14 @@ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
else
res
=
(
*
arg
)
->
val_str
(
&
tmp
);
if
(
res
)
result
.
append
(
*
res
);
result
->
append
(
*
res
);
}
/* stop if length of result more than max_length */
if
(
result
.
length
()
>
item
->
max_length
)
if
(
result
->
length
()
>
item
->
max_length
)
{
item
->
count_cut_values
++
;
result
.
length
(
item
->
max_length
);
result
->
length
(
item
->
max_length
);
item
->
warning_for_row
=
TRUE
;
return
1
;
}
...
...
@@ -2906,8 +2906,6 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
MYF
(
0
));
return
TRUE
;
}
if
(
!
args
)
/* allocation in constructor may fail */
return
TRUE
;
thd
->
allow_sum_func
=
0
;
maybe_null
=
0
;
...
...
@@ -2968,12 +2966,10 @@ bool Item_func_group_concat::setup(THD *thd)
if
(
item
->
null_value
)
{
always_null
=
1
;
break
;
DBUG_RETURN
(
FALSE
)
;
}
}
}
if
(
always_null
)
DBUG_RETURN
(
FALSE
);
List
<
Item
>
all_fields
(
list
);
/*
...
...
sql/mysqld.cc
View file @
d8b078e4
...
...
@@ -3310,7 +3310,8 @@ default_service_handling(char **argv,
int
main
(
int
argc
,
char
**
argv
)
{
/* When several instances are running on the same machine, we
/*
When several instances are running on the same machine, we
need to have an unique named hEventShudown through the
application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
*/
...
...
sql/sql_select.cc
View file @
d8b078e4
...
...
@@ -10144,20 +10144,18 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
join
->
sum_funcs_end
[
send_group_parts
]);
if
(
join
->
having
&&
join
->
having
->
val_int
()
==
0
)
error
=
-
1
;
else
if
((
error
=
table
->
file
->
write_row
(
table
->
record
[
0
])))
else
if
((
error
=
table
->
file
->
write_row
(
table
->
record
[
0
])))
{
if
(
create_myisam_from_heap
(
join
->
thd
,
table
,
&
join
->
tmp_table_param
,
error
,
0
))
DBUG_RETURN
(
-
1
);
}
if
(
join
->
rollup
.
state
!=
ROLLUP
::
STATE_NONE
&&
error
<=
0
)
if
(
join
->
rollup
.
state
!=
ROLLUP
::
STATE_NONE
)
{
if
(
join
->
rollup_write_data
((
uint
)
(
idx
+
1
),
table
))
error
=
1
;
}
if
(
error
>
0
)
DBUG_RETURN
(
-
1
);
}
if
(
end_of_records
)
DBUG_RETURN
(
0
);
}
...
...
@@ -12684,17 +12682,21 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
{
/* Check if this is something that is part of this group by */
ORDER
*
group_tmp
;
for
(
group_tmp
=
start_group
,
i
--
;
for
(
group_tmp
=
start_group
,
i
=
pos
;
group_tmp
;
group_tmp
=
group_tmp
->
next
,
i
++
)
{
if
(
*
group_tmp
->
item
==
item
)
{
Item_null_result
*
null_item
;
/*
This is an element that is used by the GROUP BY and should be
set to NULL in this level
*/
item
->
maybe_null
=
1
;
// Value will be null sometimes
Item_null_result
*
null_item
=
rollup
.
null_items
[
i
];
null_item
=
rollup
.
null_items
[
i
];
DBUG_ASSERT
(
null_item
->
result_field
==
0
||
null_item
->
result_field
==
((
Item_field
*
)
item
)
->
result_field
);
null_item
->
result_field
=
((
Item_field
*
)
item
)
->
result_field
;
item
=
null_item
;
break
;
...
...
sql/sql_string.h
View file @
d8b078e4
...
...
@@ -84,6 +84,7 @@ public:
inline
char
&
operator
[]
(
uint32
i
)
const
{
return
Ptr
[
i
];
}
inline
void
length
(
uint32
len
)
{
str_length
=
len
;
}
inline
bool
is_empty
()
{
return
(
str_length
==
0
);
}
inline
void
mark_as_const
()
{
Alloced_length
=
0
;}
inline
const
char
*
ptr
()
const
{
return
Ptr
;
}
inline
char
*
c_ptr
()
{
...
...
@@ -205,10 +206,6 @@ public:
}
}
}
inline
void
shrink_to_length
()
{
Alloced_length
=
str_length
;
}
bool
is_alloced
()
{
return
alloced
;
}
inline
String
&
operator
=
(
const
String
&
s
)
{
...
...
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