summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-18 22:13:35 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-18 22:13:35 +0300
commitc66208cfbf2726a2c9fe6eed9f4d71e2fff5dfbd (patch)
tree1871cc5ec92569a72b53ed8d789d1a95b51384a9
parentc91a3df5c38ee5f4ebc7e42f0c17da79d4930801 (diff)
downloadmariadb-git-c66208cfbf2726a2c9fe6eed9f4d71e2fff5dfbd.tar.gz
Fix bug in SELECT EXPLAIN ... ORDER BY
Docs/internals.texi: Added more code style suggestions. Docs/manual.texi: Changelog myisam/mi_check.c: Removed dbug info
-rw-r--r--Docs/internals.texi52
-rw-r--r--Docs/manual.texi3
-rw-r--r--myisam/mi_check.c6
-rw-r--r--sql/sql_select.cc11
4 files changed, 60 insertions, 12 deletions
diff --git a/Docs/internals.texi b/Docs/internals.texi
index e0574df550b..2195b42d9a0 100644
--- a/Docs/internals.texi
+++ b/Docs/internals.texi
@@ -215,11 +215,14 @@ If you can write it in fewer lines, do it (as long as the code will not
be slower or much harder to read).
@item
+Don't use two commands on the same line.
+
+@item
Do not check the same pointer for @code{NULL} more than once.
@item
-Use long function and variable names in English; This makes your
-code easier to read.
+Use long function and variable names in English; This makes your code
+easier to read. Use the 'varible_name' style instead of 'VariableName'.
@item
Think assembly - make it easier for the compiler to optimize your code.
@@ -267,6 +270,25 @@ Any @code{#define}'s are in all-caps.
Matching @samp{@{} are in the same column.
@item
+Put the @samp{@{} after a 'switch' on the same line
+
+@example
+switch (arg) {
+@end example
+
+Because this gives better overall indentation for the switch statement.
+
+@item
+In all other cases, @{ and @} should be on their own line, except
+if there is nothing inside @{ @}.
+
+@item
+Have a space after 'if'
+
+@item
+Put a space after ',' for function arguments
+
+@item
Functions return 0 on success, and non-zero on error, so you can do:
@example
@@ -289,6 +311,32 @@ Use pointers rather than array indexing when operating on strings.
@end itemize
+Suggested mode in emacs:
+
+@example
+(load "cc-mode")
+(setq c-mode-common-hook '(lambda ()
+ (turn-on-font-lock)
+ (setq comment-column 48)))
+(setq c-style-alist
+ (cons
+ '("MY"
+ (c-basic-offset . 2)
+ (c-comment-only-line-offset . 0)
+ (c-offsets-alist . ((statement-block-intro . +)
+ (knr-argdecl-intro . 0)
+ (substatement-open . 0)
+ (label . -)
+ (statement-cont . +)
+ (arglist-intro . c-lineup-arglist-intro-after-paren)
+ (arglist-close . c-lineup-arglist)
+ ))
+ )
+ c-style-alist))
+(c-set-style "MY")
+(setq c-default-style "MY")
+@end example
+
@node mysys functions,,,
@chapter mysys functions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 9cf7f74feff..6dd44a79288 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46853,6 +46853,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.43
@itemize @bullet
@item
+Fixed a unlikely core-dump bug when doing @code{EXPLAIN SELECT} when using
+many tables and @code{ORDER BY}.
+@item
Fixed bug in @code{LOAD DATA FROM MASTER} when using table with
@code{CHECKSUM=1}.
@item
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index c4f37511ffa..fa4687e27f5 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1291,10 +1291,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
{
info->state->data_file_length=sort_info->max_pos;
if (param->testflag & T_CALC_CHECKSUM)
- {
- DBUG_PRINT("QQ",("set_checksum"));
share->state.checksum=param->glob_crc;
- }
}
if (!(param->testflag & T_SILENT))
@@ -2136,10 +2133,7 @@ static int sort_get_next_record(SORT_INFO *sort_info)
if (*sort_info->record)
{
if (param->calc_checksum)
- {
- DBUG_PRINT("QQ",("calc_checksum"));
param->glob_crc+= mi_static_checksum(info,sort_info->record);
- }
DBUG_RETURN(0);
}
if (!sort_info->fix_datafile)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b6c261d1463..56ba4baed30 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -531,8 +531,9 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if (!(select_options & SELECT_BIG_RESULT) &&
((group && join.const_tables != join.tables &&
- !test_if_skip_sort_order(&join.join_tab[join.const_tables], group,
- HA_POS_ERROR)) ||
+ (!simple_group ||
+ !test_if_skip_sort_order(&join.join_tab[join.const_tables], group,
+ HA_POS_ERROR))) ||
select_distinct) &&
join.tmp_table_param.quick_group && !procedure)
{
@@ -545,8 +546,10 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
order=group;
if (order &&
(join.const_tables == join.tables ||
- test_if_skip_sort_order(&join.join_tab[join.const_tables], order,
- (group ? HA_POS_ERROR : thd->select_limit))))
+ (simple_order &&
+ test_if_skip_sort_order(&join.join_tab[join.const_tables], order,
+ (group ? HA_POS_ERROR :
+ thd->select_limit)))))
order=0;
select_describe(&join,need_tmp,
(order != 0 &&