Commit 460a3481 authored by unknown's avatar unknown

merge


Docs/manual.texi:
  Auto merged
parents c3185990 fef5292a
...@@ -10,7 +10,7 @@ done ...@@ -10,7 +10,7 @@ done
commands="\ commands="\
$make -k clean || true $make -k clean || true
/bin/rm -f */.deps/*.P config.cache /bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache
aclocal && autoheader && aclocal && automake && autoconf aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all) (cd bdb/dist && sh s_all)
......
...@@ -3,5 +3,5 @@ make -k clean ...@@ -3,5 +3,5 @@ make -k clean
/bin/rm -f config.cache /bin/rm -f config.cache
aclocal; autoheader; aclocal; automake; autoconf aclocal; autoheader; aclocal; automake; autoconf
CFLAGS=-O6 CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug CFLAGS=-O6 CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex
make make
gmake -k clean || true gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache /bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache
aclocal && autoheader && aclocal && automake && autoconf aclocal && autoheader && aclocal && automake && autoconf
(cd bdb/dist && sh s_all) (cd bdb/dist && sh s_all)
......
...@@ -3390,13 +3390,9 @@ of contributing to the MySQL development while getting something useful ...@@ -3390,13 +3390,9 @@ of contributing to the MySQL development while getting something useful
in return, is to purchase support directly from MySQL AB. in return, is to purchase support directly from MySQL AB.
@end itemize @end itemize
For examples of situations when a commercial license is needed, please
visit the online manual at @uref{http://www.mysql.com/doc/}.
For buying commercial licenses and support, please visit the order section For buying commercial licenses and support, please visit the order section
at @uref{https://order.mysql.com/}. at @uref{https://order.mysql.com/}.
@node Using the MySQL server for free under GPL, , Using the MySQL server under a commercial license, MySQL server licenses @node Using the MySQL server for free under GPL, , Using the MySQL server under a commercial license, MySQL server licenses
@subsection Using the MySQL Server for Free Under GPL @subsection Using the MySQL Server for Free Under GPL
...@@ -14663,6 +14659,7 @@ mysql> SELECT * FROM shop; ...@@ -14663,6 +14659,7 @@ mysql> SELECT * FROM shop;
* example-Foreign keys:: Using foreign keys * example-Foreign keys:: Using foreign keys
* Searching on two keys:: Searching on Two Keys * Searching on two keys:: Searching on Two Keys
* Calculating days:: Calculating visits per day * Calculating days:: Calculating visits per day
* example-AUTO_INCREMENT:: Using AUTO_INCREMENT
@end menu @end menu
...@@ -14961,7 +14958,7 @@ DROP TABLE tmp; ...@@ -14961,7 +14958,7 @@ DROP TABLE tmp;
The above way to solve this query is in effect a @code{UNION} of two queries. The above way to solve this query is in effect a @code{UNION} of two queries.
@node Calculating days, , Searching on two keys, Examples @node Calculating days, example-AUTO_INCREMENT, Searching on two keys, Examples
@subsection Calculating visits per day @subsection Calculating visits per day
@findex BIT_OR @findex BIT_OR
...@@ -14992,6 +14989,67 @@ The above calculates how many different days was used for a given ...@@ -14992,6 +14989,67 @@ The above calculates how many different days was used for a given
year/month combination, with automatic removal of duplicate entries. year/month combination, with automatic removal of duplicate entries.
@node example-AUTO_INCREMENT, , Calculating days, Examples
@subsection Using AUTO_INCREMENT
@cindex AUTO_INCREMENT
The @code{AUTO_INCREMENT} attribute can be used to generate an unique
identity for new rows:
@example
CREATE TABLE animals (id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
INSERT INTO animals (name) values ("dog"),("cat"),("penguin"),("lax"),("whale");
SELECT * FROM animals;
Which returns:
+----+---------+
| id | name |
+----+---------+
| 1 | dog |
| 2 | cat |
| 3 | penguin |
| 4 | lax |
| 5 | whale |
+----+---------+
@end example
For MyISAM and BDB tables you can specify @code{AUTO_INCREMENT} on
secondary column in a multi-column key. In this case the generated
value for the autoincrement column is calculated as
@code{MAX(auto_increment_column)+1) WHERE prefix=given-prefix}. This is
useful when you want to put data into ordered groups.
@example
CREATE TABLE animals (grp enum ('fish','mammal','bird') not null,
id mediumint not null auto_increment,
name char(30) not null,
primary key (grp,id));
INSERT INTO animals (grp,name) values ("mammal","dog"),("mammal","cat"),("bird","penguin"),("fish","lax"),("mammal","whale");
SELECT * FROM animals order by grp,id;
Which returns:
+--------+----+---------+
| grp | id | name |
+--------+----+---------+
| fish | 1 | lax |
| mammal | 1 | dog |
| mammal | 2 | cat |
| mammal | 3 | whale |
| bird | 1 | penguin |
+--------+----+---------+
@end example
Note that in this case, the auto_increment value will be reused if you
delete the row with the biggest auto_increment value in any group.
You can get the used @code{AUTO_INCREMENT} key with the
@code{LAST_INSERT_ID()} SQL function or the @code{mysql_insert_id()} API
function.
@node Batch mode, Twin, Examples, Tutorial @node Batch mode, Twin, Examples, Tutorial
@section Using @code{mysql} in Batch Mode @section Using @code{mysql} in Batch Mode
...@@ -35073,6 +35131,9 @@ positive number. This is done to avoid precision problems when ...@@ -35073,6 +35131,9 @@ positive number. This is done to avoid precision problems when
numbers 'wrap' over from positive to negative and also to ensure that one numbers 'wrap' over from positive to negative and also to ensure that one
doesn't accidentally get an auto_increment column that contains 0. doesn't accidentally get an auto_increment column that contains 0.
In MyISAM and BDB tables you can specify @code{AUTO_INCREMENT} secondary
column in a multi-column key. @xref{example-AUTO_INCREMENT}.
@cindex ODBC compatibility @cindex ODBC compatibility
@cindex compatibility, with ODBC @cindex compatibility, with ODBC
To make MySQL compatible with some ODBC applications, you can find To make MySQL compatible with some ODBC applications, you can find
...@@ -5092,8 +5092,7 @@ static bool test_if_ref(Item_field *left_item,Item *right_item) ...@@ -5092,8 +5092,7 @@ static bool test_if_ref(Item_field *left_item,Item *right_item)
{ {
if (right_item->type() == Item::FIELD_ITEM) if (right_item->type() == Item::FIELD_ITEM)
return (field->eq_def(((Item_field *) right_item)->field)); return (field->eq_def(((Item_field *) right_item)->field));
if (right_item->const_item() && if (right_item->const_item() && !(right_item->is_null()))
(right_item->val_int() || !right_item->null_value))
{ {
// We can remove binary fields and numerical fields except float, // We can remove binary fields and numerical fields except float,
// as float comparison isn't 100 % secure // as float comparison isn't 100 % secure
......
...@@ -1562,10 +1562,10 @@ simple_expr: ...@@ -1562,10 +1562,10 @@ simple_expr:
| '{' ident expr '}' { $$= $3; } | '{' ident expr '}' { $$= $3; }
| MATCH ident_list_arg AGAINST '(' expr ')' | MATCH ident_list_arg AGAINST '(' expr ')'
{ Select->ftfunc_list.push_back((Item_func_match *) { Select->ftfunc_list.push_back((Item_func_match *)
$$=new Item_func_match_nl(*$2,$5)); } ($$=new Item_func_match_nl(*$2,$5))); }
| MATCH ident_list_arg AGAINST '(' expr IN_SYM BOOLEAN_SYM MODE_SYM ')' | MATCH ident_list_arg AGAINST '(' expr IN_SYM BOOLEAN_SYM MODE_SYM ')'
{ Select->ftfunc_list.push_back((Item_func_match *) { Select->ftfunc_list.push_back((Item_func_match *)
$$=new Item_func_match_bool(*$2,$5)); } ($$=new Item_func_match_bool(*$2,$5))); }
| BINARY expr %prec NEG { $$= new Item_func_binary($2); } | BINARY expr %prec NEG { $$= new Item_func_binary($2); }
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END | CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ) } { $$= new Item_func_case(* $4, $2, $5 ) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment