Loading BUILD/FINISH.sh +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ done commands="\ $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 (cd bdb/dist && sh s_all) Loading BUILD/compile-alpha-debug +1 −1 Original line number Diff line number Diff line Loading @@ -3,5 +3,5 @@ make -k clean /bin/rm -f config.cache 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 BUILD/compile-ia64-debug-max +1 −1 Original line number Diff line number Diff line 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 (cd bdb/dist && sh s_all) Loading Docs/manual.texi +66 −5 Original line number Diff line number Diff line Loading @@ -3390,13 +3390,9 @@ of contributing to the MySQL development while getting something useful in return, is to purchase support directly from MySQL AB. @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 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 @subsection Using the MySQL Server for Free Under GPL Loading Loading @@ -14663,6 +14659,7 @@ mysql> SELECT * FROM shop; * example-Foreign keys:: Using foreign keys * Searching on two keys:: Searching on Two Keys * Calculating days:: Calculating visits per day * example-AUTO_INCREMENT:: Using AUTO_INCREMENT @end menu Loading Loading @@ -14961,7 +14958,7 @@ DROP TABLE tmp; 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 @findex BIT_OR Loading Loading @@ -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. @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 @section Using @code{mysql} in Batch Mode Loading Loading @@ -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 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 compatibility, with ODBC To make MySQL compatible with some ODBC applications, you can find sql/sql_select.cc +1 −2 Original line number Diff line number Diff line Loading @@ -5092,8 +5092,7 @@ static bool test_if_ref(Item_field *left_item,Item *right_item) { if (right_item->type() == Item::FIELD_ITEM) return (field->eq_def(((Item_field *) right_item)->field)); if (right_item->const_item() && (right_item->val_int() || !right_item->null_value)) if (right_item->const_item() && !(right_item->is_null())) { // We can remove binary fields and numerical fields except float, // as float comparison isn't 100 % secure Loading Loading
BUILD/FINISH.sh +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ done commands="\ $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 (cd bdb/dist && sh s_all) Loading
BUILD/compile-alpha-debug +1 −1 Original line number Diff line number Diff line Loading @@ -3,5 +3,5 @@ make -k clean /bin/rm -f config.cache 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
BUILD/compile-ia64-debug-max +1 −1 Original line number Diff line number Diff line 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 (cd bdb/dist && sh s_all) Loading
Docs/manual.texi +66 −5 Original line number Diff line number Diff line Loading @@ -3390,13 +3390,9 @@ of contributing to the MySQL development while getting something useful in return, is to purchase support directly from MySQL AB. @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 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 @subsection Using the MySQL Server for Free Under GPL Loading Loading @@ -14663,6 +14659,7 @@ mysql> SELECT * FROM shop; * example-Foreign keys:: Using foreign keys * Searching on two keys:: Searching on Two Keys * Calculating days:: Calculating visits per day * example-AUTO_INCREMENT:: Using AUTO_INCREMENT @end menu Loading Loading @@ -14961,7 +14958,7 @@ DROP TABLE tmp; 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 @findex BIT_OR Loading Loading @@ -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. @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 @section Using @code{mysql} in Batch Mode Loading Loading @@ -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 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 compatibility, with ODBC To make MySQL compatible with some ODBC applications, you can find
sql/sql_select.cc +1 −2 Original line number Diff line number Diff line Loading @@ -5092,8 +5092,7 @@ static bool test_if_ref(Item_field *left_item,Item *right_item) { if (right_item->type() == Item::FIELD_ITEM) return (field->eq_def(((Item_field *) right_item)->field)); if (right_item->const_item() && (right_item->val_int() || !right_item->null_value)) if (right_item->const_item() && !(right_item->is_null())) { // We can remove binary fields and numerical fields except float, // as float comparison isn't 100 % secure Loading