summaryrefslogtreecommitdiff
path: root/sql/sql_analyse.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2003-03-13 13:44:03 +0100
committerunknown <serg@serg.mysql.com>2003-03-13 13:44:03 +0100
commit50da5c1858ca2343f950e748991714f2f6813a1e (patch)
tree7a057f11634bb468082003e00b9d3a2f310b8d91 /sql/sql_analyse.cc
parenta4aaac02f3b50f2009a163d531afb686a03e47dd (diff)
parentc7551b88408430007ed7c27ed5e9f40f584e29d0 (diff)
downloadmariadb-git-50da5c1858ca2343f950e748991714f2f6813a1e.tar.gz
merged
man/perror.1: Auto merged scripts/mysqld_safe.sh: Auto merged sql/gen_lex_hash.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/item.cc: Auto merged sql/sql_select.cc: Auto merged strings/ctype-tis620.c: Auto merged mysql-test/r/analyse.result: ul mysql-test/r/group_by.result: ul mysql-test/r/select.result: ul
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r--sql/sql_analyse.cc63
1 files changed, 37 insertions, 26 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index a75b7e304d1..5d3f9a0595c 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -241,14 +241,16 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
}
else
return 0;
-} //test_if_number
+}
-// Stores the biggest and the smallest value from current 'info'
-// to ev_num_info
-// If info contains an ulonglong number, which is bigger than
-// biggest positive number able to be stored in a longlong variable
-// and is marked as negative, function will return 0, else 1.
+/*
+ Stores the biggest and the smallest value from current 'info'
+ to ev_num_info
+ If info contains an ulonglong number, which is bigger than
+ biggest positive number able to be stored in a longlong variable
+ and is marked as negative, function will return 0, else 1.
+*/
bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num)
{
@@ -276,11 +278,13 @@ void free_string(String *s)
s->free();
}
+
void field_str::add()
{
char buff[MAX_FIELD_WIDTH], *ptr;
String s(buff, sizeof(buff)), *res;
ulong length;
+ TREE_ELEMENT *element;
if (!(res = item->val_str(&s)))
{
@@ -426,9 +430,11 @@ void field_real::add()
room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree);
}
- // if element->count == 1, this element can be found only once from tree
- // if element->count == 2, or more, this element is already in tree
- else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements)
+ /*
+ if element->count == 1, this element can be found only once from tree
+ if element->count == 2, or more, this element is already in tree
+ */
+ else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{
room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree);
@@ -457,6 +463,7 @@ void field_real::add()
}
} // field_real::add
+
void field_longlong::add()
{
char buff[MAX_FIELD_WIDTH];
@@ -479,9 +486,11 @@ void field_longlong::add()
room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree);
}
- // if element->count == 1, this element can be found only once from tree
- // if element->count == 2, or more, this element is already in tree
- else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements)
+ /*
+ if element->count == 1, this element can be found only once from tree
+ if element->count == 2, or more, this element is already in tree
+ */
+ else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{
room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree);
@@ -533,9 +542,11 @@ void field_ulonglong::add()
room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree);
}
- // if element->count == 1, this element can be found only once from tree
- // if element->count == 2, or more, this element is already in tree
- else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements)
+ /*
+ if element->count == 1, this element can be found only once from tree
+ if element->count == 2, or more, this element is already in tree
+ */
+ else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{
room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree);
@@ -615,14 +626,16 @@ bool analyse::end_of_records()
func_items[8]->null_value = 1;
else
func_items[8]->set(res->ptr(), res->length());
- // count the dots, quotas, etc. in (ENUM("a","b","c"...))
- // if tree has been removed, don't suggest ENUM.
- // treemem is used to measure the size of tree for strings,
- // tree_elements is used to count the elements in tree in case of numbers.
- // max_treemem tells how long the string starting from ENUM("... and
- // ending to ..") shall at maximum be. If case is about numbers,
- // max_tree_elements will tell the length of the above, now
- // every number is considered as length 1
+ /*
+ count the dots, quotas, etc. in (ENUM("a","b","c"...))
+ If tree has been removed, don't suggest ENUM.
+ treemem is used to measure the size of tree for strings,
+ tree_elements is used to count the elements
+ max_treemem tells how long the string starting from ENUM("... and
+ ending to ..") shall at maximum be. If case is about numbers,
+ max_tree_elements will tell the length of the above, now
+ every number is considered as length 1
+ */
if (((*f)->treemem || (*f)->tree_elements) &&
(*f)->tree.elements_in_tree &&
(((*f)->treemem ? max_treemem : max_tree_elements) >
@@ -665,6 +678,7 @@ bool analyse::end_of_records()
ans.append("DATETIME", 8);
break;
case FIELD_TYPE_DATE:
+ case FIELD_TYPE_NEWDATE:
ans.append("DATE", 4);
break;
case FIELD_TYPE_SET:
@@ -676,9 +690,6 @@ bool analyse::end_of_records()
case FIELD_TYPE_TIME:
ans.append("TIME", 4);
break;
- case FIELD_TYPE_NEWDATE:
- ans.append("NEWDATE", 7);
- break;
case FIELD_TYPE_DECIMAL:
ans.append("DECIMAL", 7);
// if item is FIELD_ITEM, it _must_be_ Field_num in this case