Author: jstephens
Date: 2005-10-21 13:18:53 +0200 (Fri, 21 Oct 2005)
New Revision: 128
Log:
refman-4.1/functions.xml,
refman-5.1/functions.xml,
refman-5.0/functions.xml
- Reworked description of LAST_INSERT_ID() and added example
(Fixes Bug#14173)
- Minimised unneeded diffs
- Removed section fulltext-todo (lots of promises)
refman-4.1/renamed-nodes.txt,
refman-5.1/renamed-nodes.txt,
refman-5.0/renamed-nodes.txt
- Added redirect for deleted section
refman-4.1/deleted-sections.txt,
refman-5.0/deleted-sections.txt,
refman-5.1/deleted-sections.txt,
- Added ID of deleted section
*Note*:
Renamed refman-4.1/removed-sections.txt to refman-4.1/deleted-sections.txt
to be consistent with refman-5.0 & refman-5.0 versions of file
Added:
trunk/refman-4.1/deleted-sections.txt
Removed:
trunk/refman-4.1/removed-sections.txt
Modified:
trunk/refman-4.1/functions.xml
trunk/refman-4.1/renamed-nodes.txt
trunk/refman-5.0/deleted-sections.txt
trunk/refman-5.0/functions.xml
trunk/refman-5.0/renamed-nodes.txt
trunk/refman-5.1/deleted-sections.txt
trunk/refman-5.1/functions.xml
trunk/refman-5.1/renamed-nodes.txt
Copied: trunk/refman-4.1/deleted-sections.txt (from rev 127,
trunk/refman-4.1/removed-sections.txt)
===================================================================
--- trunk/refman-4.1/removed-sections.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-4.1/deleted-sections.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -0,0 +1,223 @@
+# IDs of chapters/sections/appendices removed from RefMan-4.1 repository
+
+# NOTE: each of these had a corresponding title id as well, each
+# prefixed with "title-"
+
+# ----------------------------------------------------------------------
+
+# from stored-procedures.xml (deleted file):
+
+stored-procedures
+stored-procedure-privileges
+stored-procedure-syntax
+create-procedure
+alter-procedure
+drop-procedure
+show-create-procedure
+show-procedure-status
+call
+begin-end
+declare
+variables-in-stored-procedures
+declare-local-variables
+set-statement
+select-into-statement
+conditions-and-handlers
+declare-conditions
+declare-handlers
+cursors
+declare-cursors
+open
+fetch
+close
+flow-control-constructs
+if-statement
+case-statement
+loop-statement
+leave-statement
+iterate-statement
+repeat-statement
+while-statement
+
+# ----------------------------------------------------------------------
+
+# from todo.xml (deleted file):
+
+todo
+todo-mysql-5-0
+todo-mysql-5-1
+todo-future
+todo-sometime
+todo-unplanned
+
+# ----------------------------------------------------------------------
+
+# from introduction.xml:
+
+mysql-5-0-nutshell
+ansi-diff-triggers
+ansi-diff-views
+
+# ----------------------------------------------------------------------
+
+# from news.xml:
+
+news-5-0-x
+news-5-0-1
+news-5-0-2
+news-5-0-3
+news-5-0-4
+news-5-0-5
+news-5-0-6
+news-5-0-7
+news-5-0-8
+news-5-0-9
+mysql-cluster-news-5-0-7
+mysql-cluster-news-5-0-6
+mysql-cluster-news-5-0-5
+mysql-cluster-news-5-0-4
+mysql-cluster-news-5-0-3
+mysql-cluster-news-5-0-1
+
+# ----------------------------------------------------------------------
+
+# from replication.xml
+
+replication-upgrade-5-0
+
+# ----------------------------------------------------------------------
+
+# from installing.xml:
+
+upgrading-from-4-1
+upgrading-from-3-22
+upgrading-from-3-21
+upgrading-from-3-20
+downgrading-to-4-1
+open-bsd-2-8
+beos
+
+# ----------------------------------------------------------------------
+
+# from triggers.xml (deleted file):
+
+triggers
+create-trigger
+drop-trigger
+using-triggers
+
+# ----------------------------------------------------------------------
+
+# from views.xml (deleted file):
+
+views
+alter-view
+create-view
+drop-view
+show-create-view
+
+# ----------------------------------------------------------------------
+
+# from information-schema.xml (deleted file):
+
+information-schema
+information-schema-tables
+schemata-table
+tables-table
+columns-table
+statistics-table
+user-privileges-table
+schema-privileges-table
+table-privileges-table
+column-privileges-table
+character-sets-table
+collations-table
+collation-character-set-applicability-table
+table-constraints-table
+key-column-usage-table
+routines-table
+views-table
+other-information-schema-tables
+extended-show
+
+# ----------------------------------------------------------------------
+
+# from precision-math.xml (deleted file):
+
+precision-math
+precision-math-numbers
+precision-math-decimal-changes
+precision-math-expressions
+precision-math-rounding
+precision-math-examples
+
+# ----------------------------------------------------------------------
+
+# from mysql-database-administration.xml:
+
+instance-manager
+instance-manager-startup-process
+instance-manager-security
+instance-manager-command-line-options
+instance-manager-configuration-files
+instance-manager-commands
+secure-using-yassl
+
+# ----------------------------------------------------------------------
+
+# from sql-syntax.xml:
+
+create-user
+rename-user
+
+# ----------------------------------------------------------------------
+
+# from ndbcluster.xml:
+
+mysql-cluster-in-5-0-and-5-1
+
+# ----------------------------------------------------------------------
+
+# from functions.xml:
+
+fulltext-todo
+
+# ----------------------------------------------------------------------
+
+# from mysql-optimization.xml:
+
+index-merge-optimization
+controlling-optimizer
+
+# ----------------------------------------------------------------------
+
+# from client-side-scripts.xml:
+
+mysqlcc
+
+# ----------------------------------------------------------------------
+
+# from language-structure.xml:
+
+bit-field-values
+
+# ----------------------------------------------------------------------
+
+# from storage-engines.xml:
+
+federated-storage-engine
+
+# ----------------------------------------------------------------------
+
+# from mysql-apis.xml:
+
+libmysqld-todo
+
+
+# ----------------------------------------------------------------------
+
+
+# from functions.xml:
+
+fulltext-todo
+
Modified: trunk/refman-4.1/functions.xml
===================================================================
--- trunk/refman-4.1/functions.xml 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-4.1/functions.xml 2005-10-21 11:18:53 UTC (rev 128)
@@ -51,7 +51,7 @@
whitespace between a function name and the parenthesis following it.
This helps the MySQL parser distinguish between function calls and
references to tables or columns that happen to have the same name as
- a function. Spaces around function arguments are permitted, though.
+ a function. However, spaces around function arguments are permitted.
</para>
<para>
@@ -192,8 +192,8 @@
<para>
Comparison operations result in a value of <literal>1</literal>
- (<literal>TRUE</literal>), <literal>0</literal>
- (<literal>FALSE</literal>), or <literal>NULL</literal>.
These
+ (TRUE), <literal>0</literal> (FALSE), or
+ <literal>NULL</literal>. These
operations work for both numbers and strings. Strings are
automatically converted to numbers and numbers to strings as
necessary.
@@ -277,7 +277,7 @@
<para>
By default, string comparisons are not case sensitive and use
the current character set (cp1252 Latin1 by default, which also
- works excellently for English).
+ works well for English).
</para>
<para>
@@ -945,8 +945,8 @@
</para>
<para>
- From MySQL 4.1.0 on, <literal>IN()</literal> syntax also is
- used to write certain types of subqueries. See
+ From MySQL 4.1.0 on, <literal>IN()</literal> syntax can also be
used to write
+ certain types of subqueries. See
<xref linkend="any-in-some-subqueries"/>.
</para>
</listitem>
@@ -1091,7 +1091,7 @@
<para>
With two or more arguments, returns the smallest
(minimum-valued) argument. The arguments are compared using
- the following rules.
+ the following rules:
</para>
<itemizedlist>
@@ -1121,7 +1121,7 @@
<listitem>
<para>
- In other cases, the arguments are compared as
+ In all other cases, the arguments are compared as
case-insensitive strings.
</para>
</listitem>
@@ -1557,7 +1557,7 @@
(<literal><replaceable>expr1</replaceable> <>
0</literal> and
<literal><replaceable>expr1</replaceable>
<> NULL</literal>) then <literal>IF()</literal>
returns
- <replaceable>expr2</replaceable>, else it returns
+ <replaceable>expr2</replaceable>; otherwise it returns
<replaceable>expr3</replaceable>.
<literal>IF()</literal>
returns a numeric or string value, depending on the context in
which it is used.
@@ -1675,7 +1675,7 @@
<para>
If <replaceable>expr1</replaceable> is not
<literal>NULL</literal>, <literal>IFNULL()</literal>
returns
- <replaceable>expr1</replaceable>, else it returns
+ <replaceable>expr1</replaceable>; otherwise it returns
<replaceable>expr2</replaceable>.
<literal>IFNULL()</literal>
returns a numeric or string value, depending on the context in
which it is used.
@@ -1738,7 +1738,7 @@
<para>
Returns <literal>NULL</literal> if
<literal><replaceable>expr1</replaceable> =
- <replaceable>expr2</replaceable></literal> is true, else
+ <replaceable>expr2</replaceable></literal> is true, otherwise
returns <replaceable>expr1</replaceable>. This is the same as
<literal>CASE WHEN <replaceable>expr1</replaceable> =
<replaceable>expr2</replaceable> THEN NULL ELSE
@@ -1775,7 +1775,7 @@
<title id="title-string-functions">&title-string-functions;</title>
<remark role="todo">
- general 4.1 remarks about: lettercase and binary; collations
+ general remarks about: lettercase and binary; collations
</remark>
<indexterm type="function">
@@ -1943,8 +1943,9 @@
<remark role="help-description-begin"/>
<para>
- <literal>CHAR()</literal> interprets the arguments as integers
- and returns a string consisting of the characters given by the
+ <literal>CHAR()</literal> interprets each
+ argument <replaceable>N</replaceable> as an integer and
+ returns a string consisting of the characters given by the
code values of those integers. <literal>NULL</literal> values
are skipped.
</para>
@@ -2297,10 +2298,9 @@
<replaceable>bits</replaceable> are examined from right to
left (from low-order to high-order bits). Strings are added to
the result from left to right, separated by the
- <replaceable>separator</replaceable> string (default
- ‘<literal>,</literal>’). The number of bits
- examined is given by <replaceable>number_of_bits</replaceable>
- (default 64).
+ <replaceable>separator</replaceable> string (the default being
+ the comma character ‘<literal>,</literal>’).
The number of bits
+ examined is given by <replaceable>number_of_bits</replaceable>
(defaults to 64).
</para>
<remark role="help-description-end"/>
@@ -2386,7 +2386,7 @@
<remark role="help-description-begin"/>
<para>
- Returns a value <literal>1</literal> to
+ Returns a value in the range of 1 to
<replaceable>N</replaceable> if the string
<replaceable>str</replaceable> is in the string list
<replaceable>strlist</replaceable> consisting of
@@ -2468,7 +2468,7 @@
<para>
From MySQL 4.0.1 and up, if <replaceable>N_OR_S</replaceable>
- is a string, returns a hexadecimal string of
+ is a string, returns a hexadecimal string representation of
<replaceable>N_OR_S</replaceable> where each character in
<replaceable>N_OR_S</replaceable> is converted to two
hexadecimal digits.
@@ -2558,7 +2558,7 @@
<replaceable>substr</replaceable> in string
<replaceable>str</replaceable>. This is the same as the
two-argument form of <literal>LOCATE()</literal>, except that
- the arguments are swapped.
+ the order of the arguments is reversed.
</para>
<remark role="help-description-end"/>
@@ -2699,7 +2699,7 @@
file must be located on the server, you must specify the full
pathname to the file, and you must have the
<literal>FILE</literal> privilege. The file must be readable
- by all and be smaller than
+ by all and its size less than
<literal>max_allowed_packet</literal> bytes.
</para>
@@ -3388,9 +3388,10 @@
long, but the <literal>SOUNDEX()</literal> function returns an
arbitrarily long string. You can use
<literal>SUBSTRING()</literal> on the result to get a standard
- soundex string. All non-alphabetic characters are ignored in
- the given string. All international alphabetic characters
- outside the A-Z range are treated as vowels.
+ soundex string. All non-alphabetic characters in
+ <replaceable>str</replaceable> are ignored. All international
+ alphabetic characters outside the A-Z range are treated as
+ vowels.
</para>
<remark role="help-description-end"/>
@@ -3765,6 +3766,10 @@
<remark role="help-syntax-begin"/>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
<indexterm type="function">
<primary>UNHEX()</primary>
@@ -3773,12 +3778,8 @@
<literal>UNHEX(<replaceable>str</replaceable>)</literal>
</para>
- <remark role="help-syntax-end"/>
-
- <remark role="help-description-begin"/>
-
<para>
- Does the opposite of
+ Performs the opposite operation from
<literal>HEX(<replaceable>str</replaceable>)</literal>.
That
is, it interprets each pair of hexadecimal digits in the
argument as a number and converts it to the character
@@ -4060,18 +4061,19 @@
</programlisting>
<para>
- Note: Because MySQL uses the C escape syntax in strings (for
- example, ‘<literal>\n</literal>’ to represent
- newline), you must double any
- ‘<literal>\</literal>’ that you use in your
+ <emphasis role="bold">Note</emphasis>: Because MySQL uses C
+ escape syntax in strings (for example,
+ ‘<literal>\n</literal>’ to represent a
newline
+ character), you must double any
+ ‘<literal>\</literal>’ that you use in
<literal>LIKE</literal> strings. For example, to search for
‘<literal>\n</literal>’, specify it as
‘<literal>\\n</literal>’. To search for
‘<literal>\</literal>’, specify it as
- ‘<literal>\\\\</literal>’ (the backslashes
are
- stripped once by the parser and another time when the
- pattern match is done, leaving a single backslash to be
- matched).
+ ‘<literal>\\\\</literal>’; this is because
the
+ backslashes are stripped once by the parser and again when
+ the pattern match is made, leaving a single backslash to be
+ matched against.
</para>
</listitem>
@@ -4178,7 +4180,7 @@
expressions is discussed in <xref linkend="regexp"/>.
Returns <literal>1</literal> if
<replaceable>expr</replaceable> matches
- <replaceable>pat</replaceable>, otherwise returns
+ <replaceable>pat</replaceable>; otherwise it returns
<literal>0</literal>. If either
<replaceable>expr</replaceable> or
<replaceable>pat</replaceable> is
<literal>NULL</literal>,
@@ -4194,16 +4196,16 @@
</para>
<para>
- Note: Because MySQL uses the C escape syntax in strings (for
+ <emphasis role="bold">Note</emphasis>: Because MySQL uses the C
escape syntax in strings (for
example, ‘<literal>\n</literal>’ to represent
- newline), you must double any
+ the newline character), you must double any
‘<literal>\</literal>’ that you use in your
<literal>REGEXP</literal> strings.
</para>
<para>
- As of MySQL 3.23.4, <literal>REGEXP</literal> is not case
- sensitive for normal (not binary) strings.
+ As of MySQL 3.23.4, <literal>REGEXP</literal> is not case
sensitive, except when
+ used with binary strings.
</para>
<remark role="help-description-end"/>
@@ -4226,7 +4228,8 @@
<para>
<literal>REGEXP</literal> and
<literal>RLIKE</literal> use
the current character set (cp1252 Latin1 by default) when
- deciding the type of a character. However, these operators
+ deciding the type of a character.
+ <emphasis role="bold">Warning</emphasis>: These operators
are not multi-byte safe.
</para>
</listitem>
@@ -4431,10 +4434,10 @@
<para>
<emphasis role="bold">Note</emphasis>: If this operator is
- used with a <literal>BIGINT</literal>, the return value is a
- <literal>BIGINT</literal>. This means that you should avoid
- using <literal>-</literal> on integers that may have the
- value of
<literal>-2<superscript>63</superscript></literal>.
+ used with a <literal>BIGINT</literal>, the return value is
+ also a <literal>BIGINT</literal>. This means that you should
avoid
+ using <literal>−</literal> on integers that may have
the
+ value of
<literal>−2<superscript>63</superscript></literal>.
</para>
</listitem>
@@ -4479,7 +4482,8 @@
<para>
The result of the last expression is incorrect because the
result of the integer multiplication exceeds the 64-bit
- range of <literal>BIGINT</literal> calculations.
+ range of <literal>BIGINT</literal> calculations. (See
+ <xref linkend="numeric-types"/>.)
</para>
</listitem>
@@ -4529,7 +4533,7 @@
<para>
A division is calculated with <literal>BIGINT</literal>
arithmetic only if performed in a context where its result
- are converted to an integer.
+ is converted to an integer.
</para>
</listitem>
@@ -4584,8 +4588,8 @@
<remark role="help-category" condition="Numeric Functions@Functions"/>
<para>
- All mathematical functions return <literal>NULL</literal> in
- case of an error.
+ All mathematical functions return <literal>NULL</literal> in the
+ event of an error.
</para>
<indexterm type="function">
@@ -4924,7 +4928,8 @@
Computes a cyclic redundancy check value and returns a
32-bit unsigned value. The result is <literal>NULL</literal>
if the argument is <literal>NULL</literal>. The argument is
- expected be a string and is treated as one if it is not.
+ expected to be a string and (if possible) is treated as one
+ if it is not.
</para>
<remark role="help-description-end"/>
@@ -5090,7 +5095,9 @@
<para>
Returns the natural logarithm of
- <replaceable>X</replaceable>.
+ <replaceable>X</replaceable>, that is, the logarithm of
+ <replaceable>X</replaceable> to the base
+ <literal>e</literal>.
</para>
<remark role="help-description-end"/>
@@ -5106,8 +5113,7 @@
<para>
This function was added in MySQL 4.0.3. It is synonymous
- with
<literal>LOG(<replaceable>X</replaceable>)</literal> in
- MySQL.
+ with
<literal>LOG(<replaceable>X</replaceable>)</literal>.
</para>
</listitem>
@@ -5162,7 +5168,8 @@
The arbitrary base option was added in MySQL 4.0.3.
<literal>LOG(<replaceable>B</replaceable>,<replaceable>X</replaceable>)</literal>
is equivalent to
-
<literal>LOG(<replaceable>X</replaceable>)/LOG(<replaceable>B</replaceable>)</literal>.
+ <literal>LOG(<replaceable>X</replaceable>)
+ / LOG(<replaceable>B</replaceable>)</literal>.
</para>
</listitem>
@@ -5203,7 +5210,8 @@
<literal>LOG2()</literal> is useful for finding out how many
bits a number would require for storage. This function was
added in MySQL 4.0.3. In earlier versions, you can use
-
<literal>LOG(<replaceable>X</replaceable>)/LOG(2)</literal>
+ <literal>LOG(<replaceable>X</replaceable>) /
+ LOG(2)</literal>
instead.
</para>
</listitem>
@@ -5354,7 +5362,7 @@
<remark role="help-description-begin"/>
<para>
- Returns the value of <emphasis>pi</emphasis> (π). The
+ Returns the value of π (pi). The
default number of decimals displayed is five, but MySQL
internally uses the full double-precision value.
</para>
@@ -5434,7 +5442,8 @@
<para>
Returns the argument <replaceable>X</replaceable>, converted
- from degrees to radians.
+ from degrees to radians. (Note that π radians equals 180
+ degrees.)
</para>
<remark role="help-description-end"/>
@@ -5468,9 +5477,9 @@
<para>
Returns a random floating-point value in the range from
<literal>0</literal> to <literal>1.0</literal>. If an
- integer argument <replaceable>N</replaceable> is specified,
- it is used as the seed value (producing a repeatable
- sequence).
+ integer argument <replaceable>N</replaceable> is
+ specified, it is used as the seed value, which produces a
+ repeatable sequence.
</para>
<remark role="help-description-end"/>
@@ -5488,6 +5497,8 @@
-> 0.63553050033332
mysql> <userinput>SELECT RAND();</userinput>
-> 0.70100469486881
+mysql> <userinput>SELECT RAND(20);</userinput>
+ -> 0.15888261251047
</programlisting>
<para>
@@ -5505,7 +5516,7 @@
<para>
<literal>ORDER BY RAND()</literal> combined with
<literal>LIMIT</literal> is useful for selecting a random
- sample of a set of rows:
+ sample from a set of rows:
</para>
<programlisting>
@@ -5550,8 +5561,8 @@
to the nearest integer. With two arguments, returns
<replaceable>X</replaceable> rounded to
<replaceable>D</replaceable> decimals.
- <replaceable>D</replaceable> can be negative to round
- <replaceable>D</replaceable> digits left of the decimal
+ <replaceable>D</replaceable> can be negative in order to
+ round <replaceable>D</replaceable> digits left of the decimal
point of the value <replaceable>X</replaceable>.
</para>
@@ -5576,7 +5587,7 @@
<para>
The return type is the same type as that of the first
- argument (assuming it is integer, double, or decimal). This
+ argument (assuming that it is integer, double, or decimal). This
means that for an integer argument, the result is an integer
(no decimals).
</para>
@@ -5659,7 +5670,9 @@
<programlisting>
mysql> <userinput>SELECT SIN(PI());</userinput>
- -> 0.000000
+ -> 1.2246063538224e-16
+mysql> <userinput>SELECT ROUND(SIN(PI()));</userinput>
+ -> 0
</programlisting>
</listitem>
@@ -5681,7 +5694,7 @@
<remark role="help-description-begin"/>
<para>
- Returns the non-negative square root of
+ Returns the square root of a non-negative number
<replaceable>X</replaceable>.
</para>
@@ -5691,9 +5704,11 @@
<programlisting>
mysql> <userinput>SELECT SQRT(4);</userinput>
- -> 2.000000
+ -> 2
mysql> <userinput>SELECT SQRT(20);</userinput>
- -> 4.472136
+ -> 4.4721359549996
+mysql> <userinput>SELECT SQRT(-16);</userinput>
+ -> NULL
</programlisting>
</listitem>
@@ -5724,8 +5739,10 @@
<remark role="help-example" condition="TAN"/>
<programlisting>
+mysql> <userinput>SELECT TAN(PI());</userinput>
+ -> -1.2246063538224e-16
mysql> <userinput>SELECT TAN(PI()+1);</userinput>
- -> 1.557408
+ -> 1.5574077246549
</programlisting>
</listitem>
@@ -5751,8 +5768,9 @@
to <replaceable>D</replaceable> decimals. If
<replaceable>D</replaceable> is <literal>0</literal>,
the
result has no decimal point or fractional part.
- <replaceable>D</replaceable> can be negative to truncate
- (make zero) <replaceable>D</replaceable> digits left of the
+ <replaceable>D</replaceable> can
+ be negative in order to truncate (make zero)
+ <replaceable>D</replaceable> digits left of the
decimal point of the value <replaceable>X</replaceable>.
</para>
@@ -5771,6 +5789,8 @@
-> -1.9
mysql> <userinput>SELECT TRUNCATE(122,-2);</userinput>
-> 100
+mysql> <userinput>SELECT TRUNCATE(10.28*100,0);</userinput>
+ -> 1027
</programlisting>
<para>
@@ -5850,7 +5870,7 @@
<literal>CURRENT_DATE()</literal>, and
<literal>FROM_UNIXTIME()</literal> functions return values in the
connection's current time zone, which is available as the value of
- the <literal>time_zone</literal> system variable. Also,
+ the <literal>time_zone</literal> system variable. In addition,
<literal>UNIX_TIMESTAMP()</literal> assumes that its argument is a
datetime value in the current time zone. See
<xref linkend="time-zone-support"/>.
@@ -6002,7 +6022,7 @@
If the value falls out of the supported range of the
<literal>TIMESTAMP</literal> type when converted fom
<replaceable>from_tz</replaceable> to UTC, no conversion
- occurs. The <literal>TIMESTAMP</literal> range is described at
+ occurs. The <literal>TIMESTAMP</literal> range is described in
<xref linkend="date-and-time-type-overview"/>.
</para>
@@ -6011,12 +6031,13 @@
<programlisting>
mysql> <userinput>SELECT CONVERT_TZ('2004-01-01
12:00:00','GMT','MET');</userinput>
-> '2004-01-01 13:00:00'
-mysql> <userinput>SELECT CONVERT_TZ('2004-01-01
12:00:00','+00:00','-07:00');</userinput>
- -> '2004-01-01 05:00:00'
+mysql> <userinput>SELECT CONVERT_TZ('2004-01-01
12:00:00','+00:00','+10:00');</userinput>
+ -> '2004-01-01 22:00:00'
</programlisting>
<para>
- To use named time zones such as <literal>'MET'</literal> or
+ <emphasis role="bold">Note</emphasis>: To use named time zones
+ such as <literal>'MET'</literal> or
<literal>'Europe/Moscow'</literal>, the time zone tables must
be properly set up. See <xref linkend="time-zone-support"/>
for instructions.
@@ -6136,7 +6157,7 @@
<primary>CURRENT_TIME</primary>
</indexterm>
- <literal>CURRENT_TIME</literal>
+ <literal>CURRENT_TIME</literal>,
<literal>CURRENT_TIME()</literal>
</para>
@@ -6163,7 +6184,7 @@
<primary>CURRENT_TIMESTAMP</primary>
</indexterm>
- <literal>CURRENT_TIMESTAMP</literal>
+ <literal>CURRENT_TIMESTAMP</literal>,
<literal>CURRENT_TIMESTAMP()</literal>
</para>
@@ -6520,8 +6541,8 @@
seconds. In other words, <literal>'1:10' DAY_SECOND</literal>
is interpreted in such a way that it is equivalent to
<literal>'1:10' MINUTE_SECOND</literal>. This is analogous to
- the way that MySQL interprets <literal>TIME</literal> values
- as representing elapsed time rather than as time of day.
+ the way that MySQL interprets <literal>TIME</literal> values as
+ representing elapsed time rather than as a time of day.
</para>
<para>
@@ -6538,7 +6559,7 @@
</programlisting>
<para>
- If you use really malformed dates, the result is
+ If you use very badly malformed dates, the result is
<literal>NULL</literal>. If you add
<literal>MONTH</literal>,
<literal>YEAR_MONTH</literal>, or
<literal>YEAR</literal> and
the resulting date has a day that is larger than the maximum
@@ -6723,11 +6744,11 @@
</row>
<row>
<entry><literal>%y</literal></entry>
- <entry>Year, numeric, two digits</entry>
+ <entry>Year, numeric (two digits)</entry>
</row>
<row>
<entry><literal>%%</literal></entry>
- <entry>A literal
‘<literal>%</literal>’.</entry>
+ <entry>A literal
‘<literal>%</literal>’ character</entry>
</row>
</tbody>
</tgroup>
@@ -6753,9 +6774,9 @@
</para>
<para>
- The reason the ranges for the month and day specifiers begin
- with zero is that MySQL allows incomplete dates such as
- <literal>'2004-00-00'</literal> to be stored as of MySQL 3.23.
+ Ranges for the month and day specifiers begin with zero due to
+ the fact that MySQL allows the storing of incomplete dates
+ such as <literal>'2004-00-00'</literal> (as of MySQL 3.23).
</para>
<remark role="help-example" condition="DATE_FORMAT"/>
@@ -7101,11 +7122,16 @@
<remark role="help-description-end"/>
<remark>
- Following is commented out because not yet implemented: and
- when setting the server variables @code{DATE_FORMAT},
- @code{TIME_FORMAT}, and @code{DATETIME_FORMAT}.
+ Following is commented out because not yet implemented:
</remark>
+<!--
+ and when setting
+ the server variables <literal>DATE_FORMAT</literal>,
+ <literal>TIME_FORMAT</literal>, and
+ <literal>DATETIME_FORMAT</literal>.
+-->
+
<para>
The three possible values for the first argument and the five
possible values for the second argument result in 15 possible
@@ -7199,7 +7225,7 @@
<remark>
If the first argument of @code{GET_FORMAT()} is illegal or
missing, or if the second argument is missing, the function
- returns an error. If the second argument is illegal, the
+ returns an error. If the second argument is illegal,the
function returns @code{NULL}.
</remark>
@@ -7209,13 +7235,15 @@
mysql> <userinput>SELECT
DATE_FORMAT('2003-10-03',GET_FORMAT(DATE,'EUR'));</userinput>
-> '03.10.2003'
mysql> <userinput>SELECT
STR_TO_DATE('10.31.2003',GET_FORMAT(DATE,'USA'));</userinput>
- -> 2003-10-31
-<!--
- Following is commented out because not yet implemented
+ -> '2003-10-31'
+
+<remark>Following is commented out because not yet implemented:</remark>
+<!--
mysql> <userinput>SET DATE_FORMAT=GET_FORMAT(DATE, 'USA'); SELECT
'2003-10-31';</userinput>
- -> <userinput>10-31-2003</userinput>
+ -gt; '10-31-2003'
-->
+
</programlisting>
<para>
@@ -7223,10 +7251,7 @@
4.1.1. See <xref linkend="set-option"/>.
</para>
- <remark>
- INSERT STOP
- </remark>
- </listitem>
+ </listitem>
<listitem>
<remark role="help-topic" condition="HOUR"/>
@@ -7325,7 +7350,7 @@
<primary>LOCALTIME</primary>
</indexterm>
- <literal>LOCALTIME</literal>
<literal>LOCALTIME()</literal>
+ <literal>LOCALTIME</literal>,
<literal>LOCALTIME()</literal>
</para>
<remark role="help-syntax-end"/>
@@ -7340,10 +7365,7 @@
<remark role="help-description-end"/>
- <para>
- They were added in MySQL 4.0.6.
- </para>
- </listitem>
+ </listitem>
<listitem>
<remark role="help-topic" condition="LOCALTIMESTAMP"/>
@@ -7355,7 +7377,7 @@
<primary>LOCALTIMESTAMP</primary>
</indexterm>
- <literal>LOCALTIMESTAMP</literal>
+ <literal>LOCALTIMESTAMP</literal>,
<literal>LOCALTIMESTAMP()</literal>
</para>
@@ -7802,10 +7824,7 @@
-> 3938
</programlisting>
- <remark>
- INSERT START
- </remark>
- </listitem>
+ </listitem>
<listitem>
<remark role="help-topic" condition="STR_TO_DATE"/>
@@ -7825,8 +7844,7 @@
<remark role="help-description-begin"/>
<para>
- This is the reverse function of the
- <literal>DATE_FORMAT()</literal> function. It takes a string
+ This is the reverse of the <literal>DATE_FORMAT()</literal>
function. It takes a string
<replaceable>str</replaceable> and a format string
<replaceable>format</replaceable>.
<literal>STR_TO_DATE()</literal> returns a
@@ -7837,17 +7855,23 @@
</para>
<remark>
- NOT YET IMPLEMENTED START If @var{format_str} is not
- specified, values are expected to be in the following format
- (for the specifiers used. (See the table in the
- @code{DATE_FORMAT()} function description.) @multitable
- @columnfractions .20 .65 @item @strong{Type} @tab
+ NOT YET IMPLEMENTED START
+ </remark>
+
+ <remark>
+ If @var{format_str} is not specified, values are expected to
+ be in the following format (for the specifiers used. (See the
+ table in the @code{DATE_FORMAT()} function description.)
+ @multitable @columnfractions .20 .65 @item @strong{Type} @tab
@strong{Format} @item @code{DATE} @tab @code{'%Y-%m-%d'} @item
@code{TIME} @tab @code{'%h-%m-%s'} @item @code{TIMESTAMP} @tab
- @code{'%Y-%m-%d %H:%i:%s'} @end multitable NOT YET IMPLEMENTED
- STOP
+ @code{'%Y-%m-%d %H:%i:%s'} @end multitable
</remark>
+ <remark>
+ NOT YET IMPLEMENTED STOP
+ </remark>
+
<para>
The date, time, or datetime values contained in
<replaceable>str</replaceable> should be given in the format
@@ -7955,10 +7979,10 @@
<para>
<emphasis role="bold">Note</emphasis> that you cannot use
format <literal>"%X%V"</literal> to convert a year-week string
- to date as a year-week does not uniquely identify a year-month
- if the week crosses a month boundary. If you want to convert a
- year-week to a date you can do it by also specifying the week
- day:
+ to a date as the combination of a year and week does not
+ uniquely identify a year and month if the week crosses a month
+ boundary. To convert a year-week to a date, then you should
+ also specify the weekday:
</para>
<programlisting>
@@ -8004,8 +8028,7 @@
<remark role="help-example" condition="SUBTIME"/>
<programlisting>
-mysql> <userinput>SELECT SUBTIME('1997-12-31
23:59:59.999999',</userinput>
- -> <userinput>'1 1:1:1.000002');</userinput>
+mysql> <userinput>SELECT SUBTIME('1997-12-31 23:59:59.999999','1
1:1:1.000002');</userinput>
-> '1997-12-30 22:58:58.999997'
mysql> <userinput>SELECT SUBTIME('01:00:00.999999',
'02:00:00.999998');</userinput>
-> '-00:59:59.999999'
@@ -8066,7 +8089,7 @@
<para>
Extracts the time part of the time or datetime expression
- <replaceable>expr</replaceable>.
+ <replaceable>expr</replaceable> and returns it as a string.
</para>
<remark role="help-description-end"/>
@@ -8157,12 +8180,12 @@
<remark role="help-description-begin"/>
<para>
- With one argument, returns the date or datetime expression
- <replaceable>expr</replaceable> as a datetime value. With two
- arguments, adds the time expression
- <replaceable>expr2</replaceable> to the date or datetime
- expression <replaceable>expr</replaceable> and returns a
- datetime value.
+ With a single argument, this function returns the date or
+ datetime expression <replaceable>expr</replaceable> as a
+ datetime value. With two arguments, it adds the time
+ expression <replaceable>expr2</replaceable> to the date or datetime
+ expression <replaceable>expr</replaceable> and
+ returns theresult as a datetime value.
</para>
<remark role="help-description-end"/>
@@ -8296,7 +8319,8 @@
<literal>TO_DAYS()</literal> is not intended for use with
values that precede the advent of the Gregorian calendar
(1582), because it does not take into account the days that
- were lost when the calendar was changed.
+ were lost when the calendar was changed. See
+ <xref linkend="mysql-calendar"/>.
</para>
<para>
@@ -8313,8 +8337,9 @@
</programlisting>
<para>
- For other dates before 1582, results from this function are
- undefined.
+ For dates before 1582 (and possibly a later year in other
+ locales), results from this function are not reliable. See
+ <xref linkend="mysql-calendar"/> for details.
</para>
</listitem>
@@ -8516,7 +8541,7 @@
<remark role="help-description-begin"/>
<para>
- The function returns the week number for
+ This function returns the week number for
<replaceable>date</replaceable>. The two-argument form of
<literal>WEEK()</literal> allows you to specify whether the
week starts on Sunday or Monday and whether the return value
@@ -8857,7 +8882,7 @@
<para>
MySQL uses what is known as a <firstterm>proleptic Gregorian
- calendar</firstterm> .
+ calendar</firstterm>.
</para>
<para>
@@ -8925,8 +8950,8 @@
</para>
<para>
- A calendar applied to dates when it was not actually in use is
- called <emphasis>proleptic</emphasis>. Thus, if we assume there
+ A calendar applied to dates when it wasn't actually in use is
+ called <firstterm>proleptic</firstterm>. Thus, if we assume there
was never a cutover and Gregorian rules always rule, we have a
proleptic Gregorian calendar. This is what is used by MySQL, as is
required by standard SQL. For this reason, dates prior to the
@@ -8943,7 +8968,7 @@
</para>
<remark role="todo">
- Change node name to use "Full-text"; by convention, we use a dash.
+ Change node name to use "Full-text"; by convention, we use a dash
</remark>
</section>
@@ -8978,6 +9003,10 @@
<remark role="help-syntax-begin"/>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
<indexterm type="function">
<primary>MATCH ... AGAINST()</primary>
@@ -8989,26 +9018,20 @@
WITH QUERY EXPANSION])</literal>
</para>
- <remark role="help-syntax-end"/>
-
- <remark role="help-description-begin"/>
-
<para>
As of MySQL 3.23.23, MySQL has support for full-text indexing
and searching. A full-text index in MySQL is an index of type
<literal>FULLTEXT</literal>.
<literal>FULLTEXT</literal>
- indexes are used with <literal>MyISAM</literal> tables only
- and can be created from <literal>CHAR</literal>,
+ indexes can be used only with <literal>MyISAM</literal>
+ tables; they can be created from <literal>CHAR</literal>,
<literal>VARCHAR</literal>, or <literal>TEXT</literal>
columns
- at <literal>CREATE TABLE</literal> time or added later with
- <literal>ALTER TABLE</literal> or <literal>CREATE
- INDEX</literal>. For large datasets, it is much faster to load
- data into a table that has no <literal>FULLTEXT</literal>
- index, then create the index with <literal>ALTER
- TABLE</literal> (or <literal>CREATE INDEX</literal>). Loading
- data into a table that has an existing
- <literal>FULLTEXT</literal> index could be significantly
- slower.
+ as part of a <literal>CREATE TABLE</literal> statement or
+ added later using <literal>ALTER TABLE</literal> or
<literal>CREATE
+ INDEX</literal>. For large datasets, it is
+ much faster to load your data into a table that has no
+ <literal>FULLTEXT</literal> index, and then create the index
+ afterwards, than to load data into a table that has an
+ existing <literal>FULLTEXT</literal> index.
</para>
<remark role="help-description-end"/>
@@ -9061,7 +9084,7 @@
language search for a string against a text collection. A
collection is a set of one or more columns included in a
<literal>FULLTEXT</literal> index. The search string is given as
- the argument to <literal>AGAINST()</literal>. For every row in the
+ the argument to <literal>AGAINST()</literal>. For each row in the
table, <literal>MATCH()</literal> returns a relevance value, that
is, a similarity measure between the search string and the text in
that row in the columns named in the <literal>MATCH()</literal>
@@ -9072,8 +9095,8 @@
By default, the search is performed in case-insensitive fashion.
In MySQL 4.1 and up, you can make a full-text search by using a
binary collation for the indexed columns. For example, a column
- that has a character set of <literal>latin1</literal> can be
- assigned a collation of <literal>latin1_bin</literal> to make it
+ that has a character set of <literal>latin1</literal> character set of
+ can be assigned a collation of <literal>latin1_bin</literal> to make it
case sensitive for full-text searches.
</para>
@@ -9172,20 +9195,20 @@
<literal>aaa''bbb</literal> is regarded as two words. Apostrophes
at the beginning or the end of a word are stripped by the
<literal>FULLTEXT</literal> parser;
<literal>'aaa'bbb'</literal>
- are parsed as <literal>aaa'bbb</literal>.
+ would be parsed as <literal>aaa'bbb</literal>.
</para>
<para>
The <literal>FULLTEXT</literal> parser determines where words
start and end by looking for certain delimiters, for example
<literal>' '</literal> (the space character),
<literal>,</literal>
- (the comma), and <literal>.</literal> (the period). If words are
- not separated by delimiters, like for example Chinese words, the
+ (the comma), and <literal>.</literal> (the period). If words
+ are not separated by delimiters (as in, for example, Chinese), the
<literal>FULLTEXT</literal> parser cannot determine where a word
- starts and where it ends. To be able to add words or other indexed
- terms in such languages to a <literal>FULLTEXT</literal> index,
- you'd have to preprocess them so that they are separated by some
- delimiter (for example, by <literal>''</literal>).
+ begins or ends. To be able to add words or other indexed terms in
+ such languages to a <literal>FULLTEXT</literal> index, you must
+ preprocess them so that they are separated by some arbitrary
+ delimiter such as <literal>"</literal>.
</para>
<para>
@@ -9278,7 +9301,9 @@
insert only one or two rows of text into it, every word in the
text occurs in at least 50% of the rows. As a result, no search
returns any results. Be sure to insert at least three rows, and
- preferably many more.
+ preferably many more. Users who need to bypass the 50% limitation
+ can use the boolean search mode; see
+ <xref linkend="fulltext-boolean"/>.
</para>
<section id="fulltext-boolean">
@@ -9287,7 +9312,7 @@
<para>
As of version 4.0.1, MySQL can also perform boolean full-text
- searches using the <literal>IN BOOLEAN MODE</literal> modifier.
+ searches using the <literal>IN BOOLEAN MODE</literal> modifier:
</para>
<programlisting>
@@ -9335,7 +9360,8 @@
<listitem>
<para>
They can work even without a <literal>FULLTEXT</literal>
- index, although this would be <emphasis>slow</emphasis>.
+ index, although a search executed in this fashion would be
+ quite slow.
</para>
</listitem>
@@ -9376,8 +9402,8 @@
</para>
<para>
- A leading plus sign indicates that this word <emphasis>must
- be</emphasis> present in every row returned.
+ A leading plus sign indicates that this word
<emphasis>must</emphasis> be present in each row
+ that is returned.
</para>
</listitem>
@@ -9387,8 +9413,9 @@
</para>
<para>
- A leading minus sign indicates that this word <emphasis>must
- not be</emphasis> present in any row returned.
+ A leading minus sign indicates that this word must
+ <emphasis>not</emphasis> be present in any of
+ the rows that are returned.
</para>
</listitem>
@@ -9438,10 +9465,10 @@
<para>
A leading tilde acts as a negation operator, causing the
- word's contribution to the row relevance to be negative. It
- is useful for marking <quote>noise words</quote>. A row that
- contains such a word is rated lower than others, but is not
- excluded altogether, as it would be by the
+ word's contribution to the row's relevance to be negative.
+ This is useful for marking <quote>noise</quote> words. A row
+ containing such a word is rated lower than others, but is
+ not excluded altogether, as it would be with the
<literal>-</literal> operator.
</para>
</listitem>
@@ -9452,9 +9479,10 @@
</para>
<para>
- The asterisk is the truncation operator. Unlike the other
- operators, it should be <emphasis>appended</emphasis> to the
- word.
+ The asterisk serves as the truncation operator. Unlike the
+ other operators, it should be
+ <emphasis>appended</emphasis> to the word to be
+ affected.
</para>
</listitem>
@@ -9651,7 +9679,7 @@
<para>
<emphasis role="bold">Note</emphasis>: Because blind query
expansion tends to increase noise significantly by returning
- non-relevant documents, it is only meaningful to use when a
+ non-relevant documents, it is meaningful to use only when a
search phrase is rather short.
</para>
@@ -10460,18 +10488,19 @@
<para>
As of MySQL 4.1.1, full-text searches can be used with most
multi-byte character sets. The exception is that for
- Unicode, the <literal>utf8</literal> character set can be
+ Unicode; the <literal>utf8</literal> character set can be
used, but not the <literal>ucs2</literal> character set.
</para>
</listitem>
<listitem>
<para>
- Languages such as Chinese, Japanese, and so forth do not
- have word delimiters. You should be aware that the
- <literal>FULLTEXT</literal> parser cannot determine where a
- word starts and where it ends in these languages.
- Implications and workarounds are described in
+ Ideographic languages such as Chinese and Japanese do not
+ have word delimiters. Therefore, the
+ <literal>FULLTEXT</literal> parser <emphasis>cannot
+ determine where words begin and end in these and other such
+ languages</emphasis>. The implications of this and some
+ workarounds for the problem are described in
<xref linkend="fulltext-search"/>.
</para>
</listitem>
@@ -10480,15 +10509,15 @@
<para>
As of MySQL 4.1, the use of multiple character sets within a
single table is supported. However, all columns in a
- <literal>FULLTEXT</literal> index must have the same
+ <literal>FULLTEXT</literal> index must use the same
character set and collation.
</para>
</listitem>
<listitem>
<para>
- The <literal>MATCH()</literal> column list must exactly
- match the column list in some <literal>FULLTEXT</literal>
+ The <literal>MATCH()</literal> column list must match
+ exactly the column list in some <literal>FULLTEXT</literal>
index definition for the table, unless this
<literal>MATCH()</literal> is <literal>IN BOOLEAN
MODE</literal>.
@@ -10511,7 +10540,7 @@
<title
id="title-fulltext-fine-tuning">&title-fulltext-fine-tuning;</title>
<para>
- The MySQL full-text search capability has few user-tunable
+ MySQL's full-text search capability has few user-tunable
parameters. You can exert more control over full-text searching
behavior if you have a MySQL source distribution because some
changes require source code modifications. See
@@ -10519,17 +10548,16 @@
</para>
<para>
- Note that full-text search was carefully tuned for the best
- searching effectiveness. Modifying the default behavior, in most
- cases, makes the search results worse. <emphasis>Do not alter
+ Note that full-text search is carefully tuned for the most
+ effectiveness. Modifying the default behavior in most cases can
+ actually decrease it. <emphasis>Do not alter
the MySQL sources unless you know what you are doing</emphasis>.
</para>
<para>
- Most full-text variables described in the following items must
- be set at server startup time. For these variables, a server
- restart is required to change them and you cannot modify them
- dynamically while the server is running.
+ Most full-text variables described below must be set at server
+ startup time. A server restart is required to change them; they
+ cannot be modified while the server is running.
</para>
<para>
@@ -10546,9 +10574,9 @@
defined by the <literal>ft_min_word_len</literal> and
<literal>ft_max_word_len</literal> system variables
(available as of MySQL 4.0.0). See
- <xref linkend="server-system-variables"/>. The default
- minimum value is four characters. The default maximum
- depends on your version of MySQL. If you change either
+ <xref linkend="server-system-variables"/>.) The default
+ minimum value is four characters; the default maximum
+ depends on the MySQL version in use. If you change either
value, you must rebuild your <literal>FULLTEXT</literal>
indexes. For example, if you want three-character words to
be searchable, you can set the
@@ -10584,7 +10612,7 @@
To override the default stopword list, set the
<literal>ft_stopword_file</literal> system variable
(available as of MySQL 4.0.10). See
- <xref linkend="server-system-variables"/>. The variable
+ <xref linkend="server-system-variables"/>.) The variable
value should be the pathname of the file containing the
stopword list, or the empty string to disable stopword
filtering. After changing the value of this variable or the
@@ -10616,7 +10644,7 @@
</programlisting>
<para>
- Change the line to this:
+ Change that line to this:
</para>
<programlisting>
@@ -10641,10 +10669,10 @@
set the <literal>ft_boolean_syntax</literal> system variable
(available as of MySQL 4.0.1). The variable also can be
changed while the server is running, but you must have the
- <literal>SUPER</literal> privilege to do so. No index
- rebuilding is necessary.
- <xref linkend="server-system-variables"/> describes the
- rules that define how to set this variable.
+ <literal>SUPER</literal>
+ privilege to do so. No rebuilding of indexes is necessary in
+ this case. See <xref linkend="server-system-variables"/>, which
+ describes the rules governing how to set this variable.
</para>
</listitem>
@@ -11077,9 +11105,9 @@
</para>
<para>
- To cast a string to a numeric value in numeric context, you do not
- normally have to do anything. Just use the string value as though
- it were a number:
+ To cast a string to a numeric value in numeric context, you
+ normally do not have to do anything other than to use the string
+ value as though it were a number:
</para>
<programlisting>
@@ -11520,10 +11548,10 @@
<para>
These functions allow encryption and decryption of data
using the official AES (Advanced Encryption Standard)
- algorithm, previously known as "Rijndael." Encoding with a
+ algorithm, previously known as <quote>Rijndael</quote>. Encoding
with a
128-bit key length is used, but you can extend it up to 256
bits by modifying the source. We chose 128 bits because it
- is much faster and it is usually secure.
+ is much faster and it is secure enough for most purposes.
</para>
<para>
@@ -11536,7 +11564,9 @@
Because AES is a block-level algorithm, padding is used to
encode uneven length strings and so the result string length
may be calculated as
-
<literal>16*(trunc(<replaceable>string_length</replaceable>/16)+1)</literal>.
+ <literal>16 *
+ (trunc(<replaceable>string_length</replaceable> / 16) +
+ 1)</literal>.
</para>
<para>
@@ -11676,7 +11706,7 @@
<para>
If the <replaceable>crypt_str</replaceable> argument does
- not look like an encrypted string, MySQL returns the given
+ not appear to be an encrypted string, MySQL returns the given
<replaceable>crypt_str</replaceable>.
</para>
@@ -11862,7 +11892,8 @@
<para>
If <literal>crypt()</literal> is not available on your
- system, <literal>ENCRYPT()</literal> always returns
+ system (as is the case with Windows),
+ <literal>ENCRYPT()</literal> always returns
<literal>NULL</literal>. Because of this, we recommend that
you use <literal>MD5()</literal> or
<literal>SHA1()</literal> instead, because those two
@@ -11944,7 +11975,10 @@
<literal>PASSWORD()</literal> was changed to improve
security. <literal>OLD_PASSWORD()</literal> returns the
value of the pre-4.1 implementation of
- <literal>PASSWORD()</literal>.
+ <literal>PASSWORD()</literal>, and is intended to permit you
+ to reset passwords for any pre-4.1 clients that need to
+ connect to your version ¤t-series; MySQL server
+ without locking them out. See
<xref linkend="password-hashing"/>.
</para>
@@ -12006,12 +12040,12 @@
<para>
<emphasis role="bold">Note</emphasis>: The
<literal>PASSWORD()</literal> function is used by the
- authentication system in MySQL Server, you should
+ authentication system in MySQL Server; you should
<emphasis>not</emphasis> use it in your own applications.
For that purpose, use <literal>MD5()</literal> or
<literal>SHA1()</literal> instead. Also see RFC 2195 for
more information about handling passwords and authentication
- securely in your application.
+ securely in your applications.
</para>
</listitem>
@@ -12064,7 +12098,7 @@
<literal>SHA1()</literal> was added in MySQL 4.0.2, and can
be considered a cryptographically more secure equivalent of
<literal>MD5()</literal>. <literal>SHA()</literal> is
- synonym for <literal>SHA1()</literal>.
+ synonymous with <literal>SHA1()</literal>.
</para>
</listitem>
@@ -12110,7 +12144,7 @@
The <literal>BENCHMARK()</literal> function executes the
expression <replaceable>expr</replaceable> repeatedly
<replaceable>count</replaceable> times. It may be used to
- time how fast MySQL processes the expression. The result
+ time how quickly MySQL processes the expression. The result
value is always <literal>0</literal>. The intended use is
from within the <command>mysql</command> client, which
reports query execution times:
@@ -12409,10 +12443,13 @@
Returns the username and hostname combination that the
current session was authenticated as. This value corresponds
to the MySQL account that determines your access privileges.
- It can be different from the value of
- <literal>USER()</literal>.
</para>
+ <para>
+ The value of <literal>CURRENT_USER()</literal> can differ
+ from the value of <literal>USER()</literal>.
+ </para>
+
<remark role="help-description-end"/>
<remark role="help-example" condition="CURRENT_USER"/>
@@ -12440,7 +12477,7 @@
<para>
<literal>CURRENT_USER()</literal> was added in MySQL 4.0.6.
- As of MySQL 4.1.0, the string has the
+ As of MySQL 4.1.0, the string uses the
<literal>utf8</literal> character set.
</para>
</listitem>
@@ -12464,7 +12501,7 @@
<para>
Returns the default (current) database name. As of MySQL
- 4.1, the string has the <literal>utf8</literal> character
+ 4.1, the string uses the <literal>utf8</literal> character
set.
</para>
@@ -12513,7 +12550,7 @@
desirable to know how many rows the statement would have
returned without the <literal>LIMIT</literal>, but without
running the statement again. To get this row count, include
- <literal>SQL_CALC_FOUND_ROWS</literal> in the
+ a <literal>SQL_CALC_FOUND_ROWS</literal> option in the
<literal>SELECT</literal> statement, then invoke
<literal>FOUND_ROWS()</literal> afterward:
</para>
@@ -12533,8 +12570,8 @@
indicating how many rows the first <literal>SELECT</literal>
would have returned had it been written without the
<literal>LIMIT</literal> clause. (If the preceding
- <literal>SELECT</literal> statement does not include
- <literal>SQL_CALC_FOUND_ROWS</literal>, then
+ <literal>SELECT</literal> statement does not include the
+ <literal>SQL_CALC_FOUND_ROWS</literal> option, then
<literal>FOUND_ROWS()</literal> may return a different
result when <literal>LIMIT</literal> is used than when it is
not.)
@@ -12653,8 +12690,11 @@
<remark role="help-description-begin"/>
<para>
- Returns the last automatically generated value that was
- inserted into an <literal>AUTO_INCREMENT</literal> column.
+ Returns the <emphasis>first</emphasis> automatically
+ generated value that was set for an
+ <literal>AUTO_INCREMENT</literal> column by the
+ <emphasis>last</emphasis> <literal>INSERT</literal>
or
+ <literal>UPDATE</literal> query to affect such a column.
</para>
<remark role="help-description-end"/>
@@ -12667,43 +12707,111 @@
</programlisting>
<para>
- The last ID that was generated is maintained in the server
+ The ID that was generated is maintained in the server
on a <emphasis>per-connection basis</emphasis>. This means
that the value which the function returns to a given client
- is the most recent <literal>AUTO_INCREMENT</literal> value
- generated by that client. The value cannot be affected by
- other clients, even if they generate
- <literal>AUTO_INCREMENT</literal> values of their own. This
- behavior ensures that you can retrieve your own ID without
- concern for the activity of other clients, and without the
- need for locks or transactions.
+ is the first <literal>AUTO_INCREMENT</literal> value
+ generated for most recent statement affecting an
+ <literal>AUTO_INCREMENT</literal> column by that client.
+ This value cannot be affected by other clients, even if they
+ generate <literal>AUTO_INCREMENT</literal> values of their
+ own. This behavior ensures that you can retrieve your own ID
+ without concern for the activity of other clients, and
+ without the need for locks or transactions.
</para>
<para>
The value of <literal>LAST_INSERT_ID()</literal> is not
changed if you update the <literal>AUTO_INCREMENT</literal>
- column of a row with a non-magic value (that is, a value
- that is not <literal>NULL</literal> and not
+ column of a row with a non-<quote>magic</quote> value (that
+ is, a value that is not <literal>NULL</literal> and not
<literal>0</literal>).
</para>
<para>
- If you insert many rows at the same time with an insert
- statement, <literal>LAST_INSERT_ID()</literal> returns the
- value for the first inserted row. The reason for this is to
- make it possible to easily reproduce the same
+ <emphasis role="bold">Important</emphasis>: If you insert
+ mutliple rows using a single <literal>INSERT</literal>
+ statement, <literal>LAST_INSERT_ID()</literal> returns the
+ value generated for the <emphasis>first</emphasis> inserted
+ row <emphasis>only</emphasis>. The reason for this is to
+ make it possible to reproduce easily the same
<literal>INSERT</literal> statement against some other
server.
</para>
+
+ <para>
+ For example:
+ </para>
+<programlisting>
+mysql> <userinput>USE test;</userinput>
+Database changed
+mysql> <userinput>CREATE TABLE t (</userinput>
+ -> <userinput>id INT AUTO_INCREMENT NOT NULL PRIMARY
KEY,</userinput>
+ -> <userinput>name VARCHAR(10) NOT NULL</userinput>
+ -> <userinput>);</userinput>
+Query OK, 0 rows affected (0.09 sec)
+
+mysql> <literal>INSERT INTO t VALUES (NULL, 'Bob');</literal>
+Query OK, 1 row affected (0.01 sec)
+
+mysql> <userinput>SELECT * FROM t;</userinput>
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
++----+------+
+1 row in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 1 |
++------------------+
+1 row in set (0.00 sec)
+
+mysql> <userinput>INSERT INTO t VALUES</userinput>
+ -> <userinput>(NULL, 'Mary'), (NULL, 'Jane'), (NULL,
'Lisa');</userinput>
+Query OK, 3 rows affected (0.00 sec)
+Records: 3 Duplicates: 0 Warnings: 0
+
+mysql> SELECT * FROM t;
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
+| 2 | Mary |
+| 3 | Jane |
+| 4 | Lisa |
++----+------+
+4 rows in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 2 |
++------------------+
+1 row in set (0.00 sec)
+</programlisting>
+
<para>
+ Although the second query inserted 3 new rows into
+ <literal>t</literal>, the ID generated for the first of
+ these rows was <literal>2</literal>, and it is this value
+ that is returned by <literal>LAST_INSERT_ID()</literal>.
+ </para>
+
+ <para>
If you use <literal>INSERT IGNORE</literal> and the record
is ignored, the <literal>AUTO_INCREMENT</literal> counter is
not incremented and <literal>LAST_INSERT_ID()</literal>
- returns 0, which reflects that no record was inserted.
- (Before MySQL 4.1, the <literal>AUTO_INCREMENT</literal>
- counter is still incremented and
- <literal>LAST_INSERT_ID()</literal> returns the new value.)
+ returns <literal>0</literal>, which reflects that no record
+ was inserted. (Before MySQL 4.1, the
+ <literal>AUTO_INCREMENT</literal> counter is still
+ incremented and <literal>LAST_INSERT_ID()</literal> returns
+ the new value.)
</para>
<para>
@@ -12870,7 +12978,7 @@
<para>
Prior to MySQL 3.22.11, the function value does not include
- the client hostname. You can extract just the username part,
+ the client hostname. You can extract only the username part,
regardless of whether the value includes a hostname part,
like this:
</para>
@@ -12922,7 +13030,7 @@
<programlisting>
mysql> <userinput>SELECT VERSION();</userinput>
- -> '4.1.13-max-log'
+ -> '¤t-version;-standard'
</programlisting>
<para>
@@ -13349,9 +13457,9 @@
<replaceable>str</replaceable> that was obtained with
<literal>GET_LOCK()</literal>. Returns
<literal>1</literal>
if the lock was released, <literal>0</literal> if the lock
- was not locked by this thread (in which case the lock is not
+ was not established by this thread (in which case the lock is not
released), and <literal>NULL</literal> if the named lock
- didn't exist. The lock does not exist if it was never
+ did not exist. The lock does not exist if it was never
obtained by a call to <literal>GET_LOCK()</literal> or if it
has previously been released.
</para>
@@ -13564,7 +13672,7 @@
<para>
As of MySQL 4.0.17, this function returns
<literal>18446744073709551615</literal> if there were no
- matching rows. (This is an unsigned
+ matching rows. (This is the value of an unsigned
<literal>BIGINT</literal> value with all bits set to 1.)
Before 4.0.17, the function returns <literal>-1</literal> if
there were no matching rows.
@@ -13747,7 +13855,7 @@
</programlisting>
<para>
- In MySQL, you can get the number of distinct expression
+ In MySQL, you can obtain the number of distinct expression
combinations that do not contain <literal>NULL</literal> by
giving a list of expressions. In standard SQL, you would
have to do a concatenation of all expressions inside
@@ -13937,7 +14045,8 @@
<literal>ENUM</literal> and <literal>SET</literal>
columns
by their string value rather than by the string's relative
position in the set. This differs from how <literal>ORDER
- BY</literal> compares them. This will be rectified.
+ BY</literal> compares them. This is expected to be rectified in a
+ future MySQL release.
</para>
</listitem>
@@ -13980,7 +14089,7 @@
Returns the population standard deviation of
<replaceable>expr</replaceable>. This is an extension to
standard SQL. The <literal>STDDEV()</literal> form of this
- function is provided for Oracle compatibility.
+ function is provided for compatibility with Oracle.
</para>
<para>
@@ -14071,7 +14180,7 @@
<remark role="todo">
Comparison with UNION, WRT complexity, table accesses,
- optimization
+ optimization.
</remark>
<remark role="note">
@@ -14081,14 +14190,15 @@
<!--
DROP TABLE IF EXISTS sales;
-CREATE TABLE sales (
+CREATE TABLE sales
+(
year INT NOT NULL,
country VARCHAR(20) NOT NULL,
product VARCHAR(32) NOT NULL,
profit INT
);
-INSERT INTO sales (product,country,year,profit) VALUES
+INSERT INTO sales VALUES
('Computer', 'India', 2000, 1200),
('TV', 'USA', 2001, 150),
('Calculator', 'USA', 2001, 50),
@@ -14101,9 +14211,11 @@
('Computer', 'USA', 2001, 1200),
('Computer', 'Finland', 2000, 1500),
('Calculator', 'India', 2000, 75),
- ('Phone', 'Finland', 2001, 10);
+ ('Phone', 'Finland', 2001, 10);
-->
+ <remark role="help-category" condition="Functions and Modifiers for Use with
GROUP BY"/>
+
<para>
As of MySQL 4.1.1, the <literal>GROUP BY</literal> clause allows
a <literal>WITH ROLLUP</literal> modifier that causes extra rows
@@ -14116,8 +14228,7 @@
</para>
<para>
- As an illustration, suppose that a table named
- <literal>sales</literal> has <literal>year</literal>,
+ Suppose that a table named <literal>sales</literal> has
<literal>year</literal>,
<literal>country</literal>, <literal>product</literal>,
and
<literal>profit</literal> columns for recording sales
profitability:
@@ -14468,7 +14579,8 @@
</para>
<programlisting>
-mysql> <userinput>SELECT id,FLOOR(value/100) AS val FROM
<replaceable>tbl_name</replaceable></userinput>
+mysql> <userinput>SELECT id,FLOOR(value/100) AS val </userinput>
+ -> <userinput>FROM
<replaceable>tbl_name</replaceable></userinput>
-> <userinput>GROUP BY id, val ORDER BY val;</userinput>
</programlisting>
Deleted: trunk/refman-4.1/removed-sections.txt
Modified: trunk/refman-4.1/renamed-nodes.txt
===================================================================
--- trunk/refman-4.1/renamed-nodes.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-4.1/renamed-nodes.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -75,3 +75,5 @@
windows-binary-installation windows-installation
windows-prepare-environment windows-create-option-file
windows-running windows-testing
+
+fulltext-todo fulltext-search
\ No newline at end of file
Modified: trunk/refman-5.0/deleted-sections.txt
===================================================================
--- trunk/refman-5.0/deleted-sections.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.0/deleted-sections.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -342,3 +342,6 @@
mysqlcc
+# from functions.xml:
+
+fulltext-todo
Modified: trunk/refman-5.0/functions.xml
===================================================================
--- trunk/refman-5.0/functions.xml 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.0/functions.xml 2005-10-21 11:18:53 UTC (rev 128)
@@ -315,8 +315,8 @@
<para>
Note that when you are comparing a string column with a number,
- MySQL can't use an index on the column to quickly look up the
- value. If <replaceable>str_col</replaceable> is an indexed
+ MySQL cannot use an index on the column to look up the
+ value quickly. If <replaceable>str_col</replaceable> is an indexed
string column, the index cannot be used when performing the
lookup in the following statement:
</para>
@@ -398,8 +398,9 @@
<para>
<literal>NULL</literal>-safe equal. This operator performs
an equality comparison like the <literal>=</literal>
- operator, but returns 1 rather than <literal>NULL</literal>
- if both operands are <literal>NULL</literal>, and 0 rather
+ operator, but returns <literal>1</literal> rather than
+ <literal>NULL</literal>
+ if both operands are <literal>NULL</literal>, and
<literal>0</literal> rather
than <literal>NULL</literal> if one operand
is<literal>NULL</literal>.
</para>
@@ -767,7 +768,7 @@
<para>
This is needed to get some ODBC applications to work
- because ODBC doesn't support a
+ because ODBC does not support a
<literal>'0000-00-00'</literal> date value.
</para>
</listitem>
@@ -1215,7 +1216,7 @@
<programlisting>
mysql> <userinput>SELECT CAST(LEAST(3600, 9223372036854775808.0) as
SIGNED);</userinput>
- -> <userinput>-9223372036854775808</userinput>
+ -> -9223372036854775808
</programlisting>
<para>
@@ -1343,8 +1344,9 @@
<para>
Logical AND. Evaluates to <literal>1</literal> if all
- operands are non-zero and not <literal>NULL</literal>, to 0
- if one or more operands are <literal>0</literal>, otherwise
+ operands are non-zero and not <literal>NULL</literal>, to
+ <literal>0</literal> if one or more operands are
+ <literal>0</literal>, otherwise
<literal>NULL</literal> is returned.
</para>
@@ -1394,11 +1396,13 @@
<para>
Logical OR. When both operands are
- non-<literal>NULL</literal>, the result is 1 if any operand
- is non-zero, and 0 otherwise. With a <literal>NULL</literal>
- operand, the result is 1 if the other operand is non-zero,
- and <literal>NULL</literal> otherwise. If both operands are
- <literal>NULL</literal>, the result is also
+ non-<literal>NULL</literal>, the result is
+ <literal>1</literal> if any operand is non-zero, and
+ <literal>0</literal> otherwise. With a
+ <literal>NULL</literal> operand, the result is
+ <literal>1</literal> if the other operand is non-zero, and
+ <literal>NULL</literal> otherwise. If both operands are
+ <literal>NULL</literal>, the result is
<literal>NULL</literal>.
</para>
@@ -1441,8 +1445,9 @@
<para>
Logical XOR. Returns <literal>NULL</literal> if either
operand is <literal>NULL</literal>. For
- non-<literal>NULL</literal> operands, evaluates to 1 if an
- odd number of operands is non-zero, otherwise 0 is returned.
+ non-<literal>NULL</literal> operands, evaluates to
+ <literal>1</literal> if an odd number of operands is
+ non-zero, otherwise <literal>0</literal> is returned.
</para>
<remark role="help-description-end"/>
@@ -1607,15 +1612,15 @@
</programlisting>
<para>
- If only one of <literal>expr2</literal> or
- <literal>expr3</literal> is explicitly
+ If only one of <replaceable>expr2</replaceable> or
+ <replaceable>expr3</replaceable> is explicitly
<literal>NULL</literal>, the result type of the
- <literal>IF()</literal> function is the same type as the
- non-<literal>NULL</literal> expression.
+ <literal>IF()</literal> function is the type of
+ the non-<literal>NULL</literal> expression.
</para>
<para>
- <literal>expr1</literal> is evaluated as an integer value,
+ <replaceable>expr1</replaceable> is evaluated as an integer value,
which means that if you are testing floating-point or string
values, you should do so using a comparison operation.
</para>
@@ -1628,9 +1633,10 @@
</programlisting>
<para>
- In the first case shown, <literal>IF(0.1)</literal> returns 0
- because 0.1 is converted to an integer value, resulting in a
- test of <literal>IF(0)</literal>. This may not be what you
+ In the first case shown, <literal>IF(0.1)</literal> returns
+ <literal>0</literal> because <literal>0.1</literal> is
+ converted to an integer value, resulting in a test of
+ <literal>IF(0)</literal>. This may not be what you
expect. In the second case, the comparison tests the original
floating-point value to see whether it is non-zero. The result
of the comparison is used as an integer.
@@ -1652,16 +1658,16 @@
<entry><emphasis role="bold">Return
Value</emphasis></entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns a string</entry>
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns a string</entry>
<entry>string</entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns a
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns a
floating-point value</entry>
<entry>floating-point</entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns an integer</entry>
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns an integer</entry>
<entry>integer</entry>
</row>
</tbody>
@@ -1669,9 +1675,8 @@
</informaltable>
<para>
- If <literal>expr2</literal> and
<literal>expr3</literal> are
- strings, the result is case sensitive if either string is case
- sensitive.
+ If <replaceable>expr2</replaceable> and
<replaceable>expr3</replaceable> are both strings, the result
+ is case sensitive if either string is case sensitive.
</para>
</listitem>
@@ -1700,7 +1705,7 @@
<para>
If <replaceable>expr1</replaceable> is not
<literal>NULL</literal>, <literal>IFNULL()</literal>
returns
- <replaceable>expr1</replaceable>, otherwise it returns
+ <replaceable>expr1</replaceable>; otherwise it returns
<replaceable>expr2</replaceable>.
<literal>IFNULL()</literal>
returns a numeric or string value, depending on the context in
which it is used.
@@ -1842,11 +1847,11 @@
<para>
Returns the numeric value of the leftmost character of the
- string <replaceable>str</replaceable>. Returns 0 if
- <replaceable>str</replaceable> is the empty string. Returns
+ string <replaceable>str</replaceable>. Returns
+ <literal>0</literal> if <replaceable>str</replaceable>
is the empty string. Returns
<literal>NULL</literal> if
<replaceable>str</replaceable> is
- <literal>NULL</literal>. <literal>ASCII()</literal>
works for
- characters with numeric values from 0 to 255.
+ <literal>NULL</literal>. <literal>ASCII()</literal>
works for characters with numeric
+ values from <literal>0</literal> to
<literal>255</literal>.
</para>
<remark role="help-description-end"/>
@@ -1960,12 +1965,16 @@
<para>
<literal>CHAR()</literal> interprets each
- <replaceable>N</replaceable> argument as an integer and
+ argument <replaceable>N</replaceable> as an integer and
returns a string consisting of the characters given by the
code values of those integers. <literal>NULL</literal> values
are skipped.
</para>
+ <remark role="help-description-end"/>
+
+ <remark role="help-example" condition="CHAR function"/>
+
<programlisting>
mysql> <userinput>SELECT CHAR(77,121,83,81,'76');</userinput>
-> 'MySQL'
@@ -2022,7 +2031,7 @@
<para>
Before MySQL 5.0.15, <literal>CHAR()</literal> returns a
string in the connection character set and the
- <literal>USING</literal> clause is unavailable. Also, each
+ <literal>USING</literal> clause is unavailable. In addition, each
argument is interpreted modulo 256, so
<literal>CHAR(256)</literal> and
<literal>CHAR(256*256)</literal> both are equivalent to
@@ -2464,7 +2473,8 @@
argument is a constant string and the second is a column of
type <literal>SET</literal>, the
<literal>FIND_IN_SET()</literal> function is optimized to use
- bit arithmetic. Returns 0 if <replaceable>str</replaceable> is
+ bit arithmetic. Returns <literal>0</literal> if
+ <replaceable>str</replaceable> is
not in <replaceable>strlist</replaceable> or if
<replaceable>strlist</replaceable> is the empty string.
Returns <literal>NULL</literal> if either argument is
@@ -2534,10 +2544,10 @@
</para>
<para>
- If <replaceable>N_OR_S</replaceable> is a string, this
- function returns a hexadecimal string of
- <replaceable>N_OR_S</replaceable> characters, where each
- character in <replaceable>N_OR_S</replaceable> is converted to
+ If <replaceable>N_OR_S</replaceable>
+ is a string, returns a hexadecimal string representation of
+ <replaceable>N_OR_S</replaceable> where each character in
+ <replaceable>N_OR_S</replaceable> is converted to
two hexadecimal digits.
</para>
@@ -2725,8 +2735,9 @@
<replaceable>str</replaceable>, measured in bytes. A
multi-byte character counts as multiple bytes. This means that
for a string containing five two-byte characters,
- <literal>LENGTH()</literal> returns 10, whereas
- <literal>CHAR_LENGTH()</literal> returns 5.
+ <literal>LENGTH()</literal> returns
<literal>10</literal>,
+ whereas <literal>CHAR_LENGTH()</literal> returns
+ <literal>5</literal>.
</para>
<remark role="help-description-end"/>
@@ -2770,9 +2781,9 @@
</para>
<para>
- If the file doesn't exist or cannot be read because one of the
- preceding conditions is not satisfied, the function returns
- <literal>NULL</literal>.
+ If the file does not exist or cannot be read because one of
+ the preceding conditions is not satisfied, the function
+ returns <literal>NULL</literal>.
</para>
<remark role="help-description-end"/>
@@ -2785,21 +2796,10 @@
WHERE id=1;
</programlisting>
- <remark>
- Should be deleted?
- </remark>
-<!--
- <para>
- Before MySQL 3.23, you must read the file inside your application
- and create an <literal>INSERT</literal> statement to update the
- database with the file contents. If you are using the MySQL++
- library, one way to do this can be found in the MySQL++ manual,
- available at <ulink url="http://dev.mysql.com/doc/"/>.
- </para>
--->
- </listitem>
+</listitem>
+
<listitem>
<remark role="help-topic" condition="LOCATE"/>
@@ -2826,8 +2826,8 @@
position of the first occurrence of substring
<replaceable>substr</replaceable> in string
<replaceable>str</replaceable>, starting at position
- <replaceable>pos</replaceable>. Returns 0 if
- <replaceable>substr</replaceable> is not in
+ <replaceable>pos</replaceable>. Returns
<literal>0</literal>
+ if <replaceable>substr</replaceable> is not in
<replaceable>str</replaceable>.
</para>
@@ -3191,9 +3191,9 @@
properly escaped data value in an SQL statement. The string is
returned surrounded by single quotes and with each instance of
single quote (‘<literal>'</literal>’),
backslash
- (‘<literal>\</literal>’), ASCII NUL, and
Control-Z
- preceded by a backslash. If the argument is
- <literal>NULL</literal>, the return value is the word
+ (‘<literal>\</literal>’), ASCII
+ <literal>NUL</literal>, and Control-Z preceded by a backslash.
+ If the argument is <literal>NULL</literal>, the return value is the
word
<quote>NULL</quote> without surrounding single quotes.
</para>
@@ -3930,19 +3930,25 @@
<para>
If you want to convert a number to a string explicitly, use the
- <literal>CAST()</literal> function:
+ <literal>CAST()</literal> or <literal>CONCAT()</literal>
function:
</para>
<programlisting>
mysql> <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
-> 38.8, '38.8'
+mysql> <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
+ -> 38.8, '38.8'
</programlisting>
<para>
+ <literal>CAST()</literal> is preferable.
+ </para>
+
+ <para>
If a string function is given a binary string as an argument,
the resulting string is also a binary string. A number converted
- to a string is treated as a binary string (that is, it is case
- sensitive in comparisons). This affects only comparisons.
+ to a string is treated as a binary string. This affects only
+ comparisons.
</para>
<indexterm>
@@ -3988,11 +3994,12 @@
<para>
Pattern matching using SQL simple regular expression
- comparison. Returns 1 (<literal>TRUE</literal>) or 0
+ comparison. Returns <literal>1</literal>
+ (<literal>TRUE</literal>) or <literal>0</literal>
(<literal>FALSE</literal>). If either
<replaceable>expr</replaceable> or
<replaceable>pat</replaceable> is
<literal>NULL</literal>,
- the result is also <literal>NULL</literal>.
+ the result is <literal>NULL</literal>.
</para>
<para>
@@ -4039,8 +4046,8 @@
<para>
To test for literal instances of a wildcard character,
- precede the character with the escape character. If you
- don't specify the <literal>ESCAPE</literal> character,
+ precede the character with the escape character. If you do
+ not specify the <literal>ESCAPE</literal> character,
‘<literal>\</literal>’ is assumed.
</para>
@@ -4224,14 +4231,16 @@
<replaceable>pat</replaceable>. The pattern can be an
extended regular expression. The syntax for regular
expressions is discussed in <xref linkend="regexp"/>.
- Returns 1 if <replaceable>expr</replaceable> matches
- <replaceable>pat</replaceable>, otherwise returns 0. If
- either <replaceable>expr</replaceable> or
+ Returns <literal>1</literal> if
+ <replaceable>expr</replaceable> matches
+ <replaceable>pat</replaceable>; otherwise it returns
+ <literal>0</literal>. If either
+ <replaceable>expr</replaceable> or
<replaceable>pat</replaceable> is
<literal>NULL</literal>,
- the result is also <literal>NULL</literal>.
+ the result is <literal>NULL</literal>.
<literal>RLIKE</literal> is a synonym for
- <literal>REGEXP</literal>, provided for compatibility with
- <literal>mSQL</literal>.
+ <literal>REGEXP</literal>, provided for
+ <literal>mSQL</literal> compatibility.
</para>
<para>
@@ -4240,7 +4249,7 @@
</para>
<para>
- Note: Because MySQL uses the C escape syntax in strings (for
+ <emphasis role="bold">Note</emphasis>: Because MySQL uses the C
escape syntax in strings (for
example, ‘<literal>\n</literal>’ to represent
the newline character), you must double any
‘<literal>\</literal>’ that you use in your
@@ -4296,9 +4305,10 @@
<remark role="help-description-begin"/>
<para>
- <literal>STRCMP()</literal> returns 0 if the strings are
- identical, -1 if the first argument is smaller than the
- second according to the current sort order, and 1 otherwise.
+ <literal>STRCMP()</literal> returns
<literal>0</literal> if
+ the strings are the same, <literal>-1</literal> if the first
+ argument is smaller than the second according to the current
+ sort order, and <literal>1</literal> otherwise.
</para>
<remark role="help-description-end"/>
@@ -4477,8 +4487,8 @@
<emphasis role="bold">Note</emphasis>: If this operator is
used with a <literal>BIGINT</literal>, the return value is
also a <literal>BIGINT</literal>. This means that you should
- avoid using <literal>-</literal> on integers that may be
- equal to -2<superscript>63</superscript> or less.
+ avoid using <literal>−</literal> on integers that may
have the
+ value of
<literal>−2<superscript>63</superscript></literal>.
</para>
</listitem>
@@ -4696,20 +4706,17 @@
<remark role="help-description-begin"/>
<para>
- Returns the arccosine of <replaceable>X</replaceable>, that
+ Returns the arc cosine of <replaceable>X</replaceable>, that
is, the value whose cosine is <replaceable>X</replaceable>.
Returns <literal>NULL</literal> if
- <replaceable>X</replaceable> is not in the range -1 to 1.
+ <replaceable>X</replaceable> is not in the range
+ <literal>-1</literal> to <literal>1</literal>.
</para>
<remark role="help-description-end"/>
<remark role="help-example" condition="ACOS"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ACOS(1);</userinput>
-> 0
@@ -4738,20 +4745,17 @@
<remark role="help-description-begin"/>
<para>
- Returns the arcsine of <replaceable>X</replaceable>, that
+ Returns the arc sine of <replaceable>X</replaceable>, that
is, the value whose sine is <replaceable>X</replaceable>.
Returns <literal>NULL</literal> if
- <replaceable>X</replaceable> is not in the range -1 to 1.
+ <replaceable>X</replaceable> is not in the range
+ <literal>-1</literal> to <literal>1</literal>.
</para>
<remark role="help-description-end"/>
<remark role="help-example" condition="ASIN"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ASIN(0.2);</userinput>
-> 0.20135792079033
@@ -4791,16 +4795,12 @@
<remark role="help-description-begin"/>
<para>
- Returns the arctangent of <replaceable>X</replaceable>, that
+ Returns the arc tangent of <replaceable>X</replaceable>, that
is, the value whose tangent is <replaceable>X</replaceable>.
</para>
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="ATAN"/>
<programlisting>
@@ -4831,10 +4831,10 @@
<remark role="help-description-begin"/>
<para>
- Returns the arctangent of the two variables
+ Returns the arc tangent of the two variables
<replaceable>X</replaceable> and
<replaceable>Y</replaceable>. It is similar to calculating
- the arctangent of <literal><replaceable>Y</replaceable> /
+ the arc tangent of <literal><replaceable>Y</replaceable> /
<replaceable>X</replaceable></literal>, except that the
signs of both arguments are used to determine the quadrant
of the result.
@@ -4842,10 +4842,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="ATAN2"/>
<programlisting>
@@ -4924,10 +4920,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="COS"/>
<programlisting>
@@ -4959,10 +4951,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="COT"/>
<programlisting>
@@ -5034,10 +5022,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="DEGREES"/>
<programlisting>
@@ -5073,10 +5057,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="EXP"/>
<programlisting>
@@ -5173,7 +5153,7 @@
Returns the natural logarithm of
<replaceable>X</replaceable>, that is, the logarithm of
<replaceable>X</replaceable> to the base
- <replaceable>e</replaceable>.
+ <literal>e</literal>.
</para>
<remark role="help-description-end"/>
@@ -5315,10 +5295,6 @@
<remark role="help-example" condition="LOG10"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<programlisting>
mysql> <userinput>SELECT LOG10(2);</userinput>
-> 0.30102999566398
@@ -5483,10 +5459,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="POWER"/>
<programlisting>
@@ -5522,10 +5494,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output as of 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="RADIANS"/>
<programlisting>
@@ -5553,8 +5521,9 @@
<remark role="help-description-begin"/>
<para>
- Returns a random floating-point value in the range from 0 to
- 1.0. If an integer argument <replaceable>N</replaceable> is
+ Returns a random floating-point value in the range from
+ <literal>0</literal> to <literal>1.0</literal>. If an
+ integer argument <replaceable>N</replaceable> is
specified, it is used as the seed value, which produces a
repeatable sequence.
</para>
@@ -5568,6 +5537,8 @@
-> 0.9233482386203
mysql> <userinput>SELECT RAND(20);</userinput>
-> 0.15888261251047
+mysql> <userinput>SELECT RAND(20);</userinput>
+ -> 0.15888261251047
mysql> <userinput>SELECT RAND();</userinput>
-> 0.63553050033332
mysql> <userinput>SELECT RAND();</userinput>
@@ -5576,20 +5547,12 @@
-> 0.15888261251047
</programlisting>
- <remark role="todo">
- Rewrite the sentence I've commented out. It's *very*
- confusing, as it seems to contradict directly what follows.
- </remark>
-
<para>
-<!--
- You can't use a column with <literal>RAND()</literal> values in an
- <literal>ORDER BY</literal> clause, because <literal>ORDER
- BY</literal> would evaluate the column multiple times.
--->
-
- You can use this function to retrieve rows in random order
- as shown here:
+ You cannot use a column with <literal>RAND()</literal>
+ values in an <literal>ORDER BY</literal> clause, because
+ <literal>ORDER BY</literal> would evaluate the column
+ multiple times. However, you can retrieve rows in
+ random order like this:
</para>
<programlisting>
@@ -5615,9 +5578,9 @@
<para>
<literal>RAND()</literal> is not meant to be a perfect
- random generator, but instead a quick way of generating ad
- hoc random numbers that is portable between platforms for
- the same MySQL version.
+ random generator, but instead is a fast way to generate
+ <emphasis>ad hoc</emphasis> random numbers that is portable
+ between platforms for the same MySQL version.
</para>
</listitem>
@@ -5670,7 +5633,7 @@
<para>
The return type is the same type as that of the first
- argument (assuming it's integer, double, or decimal). This
+ argument (assuming that it is integer, double, or decimal). This
means that for an integer argument, the result is an integer
(no decimals).
</para>
@@ -5726,10 +5689,6 @@
and approximate values:
</para>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ROUND(2.5), ROUND(25E-1);</userinput>
+------------+--------------+
@@ -5840,16 +5799,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
- <remark role="todo">
- Mention how and why behavior has changed from earlier
- versions, e.g., in older versions SELECT SQRT(4); returned
- 2.00
- </remark>
-
<remark role="help-example" condition="SQRT"/>
<programlisting>
@@ -5886,10 +5835,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="TAN"/>
<programlisting>
@@ -5920,8 +5865,9 @@
<para>
Returns the number <replaceable>X</replaceable>, truncated
to <replaceable>D</replaceable> decimals. If
- <replaceable>D</replaceable> is 0, the result has no decimal
- point or fractional part. <replaceable>D</replaceable> can
+ <replaceable>D</replaceable> is <literal>0</literal>,
the
+ result has no decimal point or fractional part.
+ <replaceable>D</replaceable> can
be negative in order to truncate (make zero)
<replaceable>D</replaceable> digits left of the decimal
point of the value <replaceable>X</replaceable>.
@@ -5929,10 +5875,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="TRUNCATE"/>
<programlisting>
@@ -6036,8 +5978,10 @@
The return value ranges in the following function descriptions
apply for complete dates. If a date is a <quote>zero</quote> value
or an incomplete date such as <literal>'2001-11-00'</literal>,
- functions that extract a part of a date may return 0. For example,
- <literal>DAYOFMONTH('2001-11-00')</literal> returns 0.
+ functions that extract a part of a date may return
+ <literal>0</literal>. For example,
+ <literal>DAYOFMONTH('2001-11-00')</literal> returns
+ <literal>0</literal>.
</para>
<itemizedlist>
@@ -6087,10 +6031,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="ADDDATE"/>
<programlisting>
@@ -6131,10 +6071,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="ADDTIME"/>
<programlisting>
@@ -6346,6 +6282,7 @@
<remark role="help-description-begin"/>
<para>
+ <literal>CURRENT_TIMESTAMP</literal> and
<literal>CURRENT_TIMESTAMP()</literal> are synonyms for
<literal>NOW()</literal>.
</para>
@@ -6356,6 +6293,10 @@
<listitem>
<remark role="help-topic" condition="DATE function"/>
+ <remark role="help-keywords">
+ DATE
+ </remark>
+
<remark role="help-syntax-begin"/>
<para>
@@ -6475,7 +6416,7 @@
<para>
The <literal>INTERVAL</literal> keyword and the
- <literal>type</literal> specifier are not case sensitive.
+ <replaceable>type</replaceable> specifier are not case sensitive.
</para>
<para>
@@ -6609,10 +6550,6 @@
or datetime value from an interval. (See examples below.)
</para>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
<remark role="help-example" condition="DATE OPERATIONS"/>
<programlisting>
@@ -6653,9 +6590,9 @@
<literal>DAY_SECOND</literal>, the value of
<replaceable>expr</replaceable> is expected to have days,
hours, minutes, and seconds parts. If you specify a value like
- '1:10', MySQL assumes that the days and hours parts are
- missing and the value represents minutes and seconds. In other
- words, <literal>'1:10' DAY_SECOND</literal> is interpreted in
+ <literal>'1:10'</literal>, MySQL assumes that the days and
+ hours parts are missing and the value represents minutes and
+ seconds. In other words, <literal>'1:10' DAY_SECOND</literal> is
interpreted in
such a way that it is equivalent to <literal>'1:10'
MINUTE_SECOND</literal>. This is analogous to the way that
MySQL interprets <literal>TIME</literal> values as
@@ -6668,11 +6605,7 @@
a datetime value:
</para>
- <remark role="note">
- Output from 5.0.7-beta
- </remark>
-
-<programlisting>
+ <programlisting>
mysql> <userinput>SELECT DATE_ADD('1999-01-01', INTERVAL 1
DAY);</userinput>
-> '1999-01-02'
mysql> <userinput>SELECT DATE_ADD('1999-01-01', INTERVAL 1
HOUR);</userinput>
@@ -7018,8 +6951,9 @@
<para>
Returns the weekday index for <replaceable>date</replaceable>
- (1 = Sunday, 2 = Monday, ..., 7 = Saturday). These index
- values correspond to the ODBC standard.
+ (<literal>1</literal> = Sunday, <literal>2</literal> =
Monday,
+ ..., <literal>7</literal> = Saturday). These index values
+ correspond to the ODBC standard.
</para>
<remark role="help-description-end"/>
@@ -7045,9 +6979,14 @@
<literal>DAYOFYEAR(<replaceable>date</replaceable>)</literal>
</para>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
Returns the day of the year for
- <replaceable>date</replaceable>, in the range 1 to 366.
+ <replaceable>date</replaceable>, in the range
+ <literal>1</literal> to <literal>366</literal>.
</para>
<remark role="help-description-end"/>
@@ -7371,7 +7310,8 @@
<para>
Returns the hour for <replaceable>time</replaceable>. The
- range of the return value is 0 to 23 for time-of-day values.
+ range of the return value is <literal>0</literal> to
+ <literal>23</literal> for time-of-day values.
</para>
<remark role="help-description-end"/>
@@ -8058,7 +7998,7 @@
<para>
<emphasis role="bold">Note</emphasis> that you cannot use
format <literal>"%X%V"</literal> to convert a year-week string
- to date as the combination of a year and week does not
+ to a date as the combination of a year and week does not
uniquely identify a year and month if the week crosses a month
boundary. To convert a year-week to a date, then you should
also specify the weekday:
@@ -8804,10 +8744,10 @@
<para>
Note that if a date falls in the last week of the previous
- year, MySQL returns <literal>0</literal> if you don't use
+ year, MySQL returns <literal>0</literal> if you do not use
<literal>2</literal>, <literal>3</literal>,
<literal>6</literal>, or <literal>7</literal> as the
optional
- <literal>mode</literal> argument:
+ <replaceable>mode</replaceable> argument:
</para>
<programlisting>
@@ -8821,7 +8761,7 @@
date actually occurs in the 52nd week of 1999. We decided to
return <literal>0</literal> instead because we want the
function to return <quote>the week number in the given
- year.</quote> This makes use of the <literal>WEEK()</literal>
+ year</quote>. This makes use of the <literal>WEEK()</literal>
function reliable when combined with other functions that
extract a date part from a date.
</para>
@@ -8831,7 +8771,7 @@
the year that contains the first day of the week for the given
date, you should use <literal>0</literal>,
<literal>2</literal>, <literal>5</literal>, or
- <literal>7</literal> as the optional
<literal>mode</literal>
+ <literal>7</literal> as the optional
<replaceable>mode</replaceable>
argument.
</para>
@@ -9012,8 +8952,8 @@
</indexterm>
<para>
- MySQL uses what is known as a <emphasis role="bold">proleptic
- Gregorian calendar</emphasis>.
+ MySQL uses what is known as a <firstterm>proleptic
+ Gregorian calendar</firstterm>.
</para>
<para>
@@ -9334,7 +9274,7 @@
start and end by looking for certain delimiters, for example
<literal>' '</literal> (the space character),
<literal>,</literal>
(the comma), and <literal>.</literal> (the period). If words
- aren't separated by delimiters as in, for example, Chinese, the
+ are not separated by delimiters (as in, for example, Chinese), the
<literal>FULLTEXT</literal> parser cannot determine where a word
begins or ends. To be able to add words or other indexed terms in
such languages to a <literal>FULLTEXT</literal> index, you must
@@ -9410,13 +9350,13 @@
The search result is empty because the word <quote>MySQL</quote>
is present in at least 50% of the rows. As such, it is effectively
treated as a stopword. For large datasets, this is the most
- desirable behavior---a natural language query should not return
- every second row from a 1GB table. For small datasets, it may be
- less desirable.
+ desirable behavior — a natural language query should not
+ return every second row from a 1GB table. For small datasets, it
+ may be less desirable.
</para>
<para>
- A word that matches half of rows in a table is less likely to
+ A word that matches half of the rows in a table is less likely to
locate relevant documents. In fact, it most likely finds plenty of
irrelevant documents. We all know this happens far too often when
we are trying to find something on the Internet with a search
@@ -9433,7 +9373,7 @@
text occurs in at least 50% of the rows. As a result, no search
returns any results. Be sure to insert at least three rows, and
preferably many more. Users who need to bypass the 50% limitation
- can use the boolean search mode, see
+ can use the boolean search mode; see
<xref linkend="fulltext-boolean"/>.
</para>
@@ -9534,7 +9474,7 @@
<para>
A leading plus sign indicates that this word
- <emphasis role="bold">must</emphasis> be present in each row
+ <emphasis>must</emphasis> be present in each row
that is returned.
</para>
</listitem>
@@ -9546,7 +9486,7 @@
<para>
A leading minus sign indicates that this word must
- <emphasis role="bold">not</emphasis> be present in any of
+ <emphasis>not</emphasis> be present in any of
the rows that are returned.
</para>
</listitem>
@@ -9613,7 +9553,7 @@
<para>
The asterisk serves as the truncation operator. Unlike the
other operators, it should be
- <emphasis role="bold">appended</emphasis> to the word to be
+ <emphasis>appended</emphasis> to the word to be
affected.
</para>
</listitem>
@@ -9814,9 +9754,10 @@
</para>
<para>
- Note: Because blind query expansion tends to increase noise
- significantly by returning non-relevant documents, it's only
- meaningful to use when a search phrase is rather short.
+ <emphasis role="bold">Note</emphasis>: Because blind query
+ expansion tends to increase noise significantly by returning
+ non-relevant documents, it is meaningful to use only when a
+ search phrase is rather short.
</para>
</section>
@@ -10624,7 +10565,7 @@
<para>
In MySQL ¤t-series;, full-text searches can be used
with most multi-byte character sets. The exception is that
- for Unicode, the <literal>utf8</literal> character set can
+ for Unicode; the <literal>utf8</literal> character set can
be used, but not the <literal>ucs2</literal> character set.
</para>
</listitem>
@@ -10677,8 +10618,7 @@
<para>
MySQL's full-text search capability has few user-tunable
- parameters at present, although adding more is very high on the
- TODO list. You can exert more control over full-text searching
+ parameters. You can exert more control over full-text searching
behavior if you have a MySQL source distribution because some
changes require source code modifications. See
<xref linkend="installing-source"/>.
@@ -10805,13 +10745,7 @@
variable. This variable also can be changed while the server
is running, but you must have the <literal>SUPER</literal>
privilege to do so. No rebuilding of indexes is necessary in
- this case.
-
- <remark>
- Don't change this to an xref due to capitalisation.
- </remark>
-
- <link
linkend="server-system-variables">&title-server-system-variables;</link>
+ this case. See <xref linkend="server-system-variables"/>, which
describes the rules governing how to set this variable.
</para>
</listitem>
@@ -10886,79 +10820,6 @@
</section>
- <section id="fulltext-todo">
-
- <title id="title-fulltext-todo">&title-fulltext-todo;</title>
-
- <itemizedlist>
-
- <listitem>
- <para>
- Improved performance for all <literal>FULLTEXT</literal>
- operations.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Proximity operators.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for <quote>always-index words.</quote> These could
- be any strings the user wants to treat as words, such as
- <quote>C++</quote>, <quote>AS/400</quote>, or
- <quote>TCP/IP</quote>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for full-text search in <literal>MERGE</literal>
- tables.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for the <literal>ucs2</literal> character set.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Make the stopword list dependent on the language of the
- dataset.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Stemming
- </para>
- </listitem>
-
- <listitem>
- <para>
- Generic user-suppliable UDF preparser.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Make the model more flexible (by adding some adjustable
- parameters to <literal>FULLTEXT</literal> in
<literal>CREATE
- TABLE</literal> and <literal>ALTER TABLE</literal>
- statements).
- </para>
- </listitem>
-
- </itemizedlist>
-
- </section>
-
</section>
<section id="cast-functions">
@@ -11663,10 +11524,10 @@
<para>
These functions allow encryption and decryption of data
using the official AES (Advanced Encryption Standard)
- algorithm, previously known as "Rijndael." Encoding with a
+ algorithm, previously known as <quote>Rijndael</quote>. Encoding
with a
128-bit key length is used, but you can extend it up to 256
bits by modifying the source. We chose 128 bits because it
- is much faster and it is usually secure enough.
+ is much faster and it is secure enough for most purposes.
</para>
<para>
@@ -11819,8 +11680,8 @@
</para>
<para>
- If the <replaceable>crypt_str</replaceable> argument doesn't
- look like an encrypted string, MySQL returns the given
+ If the <replaceable>crypt_str</replaceable> argument does
+ not appear to be an encrypted string, MySQL returns the given
<replaceable>crypt_str</replaceable>.
</para>
@@ -11916,6 +11777,8 @@
Each line in the DES key file has the following format:
</para>
+<remark role="help-example" condition="DES_ENCRYPT"/>
+
<programlisting>
<replaceable>key_num</replaceable>
<replaceable>des_key_str</replaceable>
</programlisting>
@@ -11927,7 +11790,7 @@
<replaceable>des_key_str</replaceable> is the string that is
used to encrypt the message. Between the number and the key
there should be at least one space. The first key is the
- default key that is used if you don't specify any key
+ default key that is used if you do not specify any key
argument to <literal>DES_ENCRYPT()</literal>
</para>
@@ -11995,7 +11858,7 @@
<para>
If <literal>crypt()</literal> is not available on your
- system (such as is the case with Windows),
+ system (as is the case with Windows),
<literal>ENCRYPT()</literal> always returns
<literal>NULL</literal>. Because of this, we recommend that
you use <literal>MD5()</literal> or
@@ -12769,8 +12632,11 @@
<remark role="help-description-begin"/>
<para>
- Returns the last automatically generated value that was
- inserted into an <literal>AUTO_INCREMENT</literal> column.
+ Returns the <emphasis>first</emphasis> automatically
+ generated value that was set for an
+ <literal>AUTO_INCREMENT</literal> column by the
+ <emphasis>last</emphasis> <literal>INSERT</literal>
or
+ <literal>UPDATE</literal> query to affect such a column.
</para>
<remark role="help-description-end"/>
@@ -12783,12 +12649,14 @@
</programlisting>
<para>
- The last ID that was generated is maintained in the server
- on a per-connection basis. This means the value the function
- returns to a given client is the most recent
- <literal>AUTO_INCREMENT</literal> value generated by that
- client. The value cannot be affected by other clients, even
- if they generate <literal>AUTO_INCREMENT</literal> values of
+ The ID that was generated is maintained in the server
+ on a <emphasis>per-connection basis</emphasis>. This means
+ that the value which the function returns to a given client
+ is the first <literal>AUTO_INCREMENT</literal> value
+ generated for most recent statement affecting an
+ <literal>AUTO_INCREMENT</literal> column by that client.
+ This value cannot be affected by other clients, even if they
+ generate <literal>AUTO_INCREMENT</literal> values of
their own. This behavior ensures that you can retrieve your
own ID without concern for the activity of other clients,
and without the need for locks or transactions.
@@ -12797,28 +12665,91 @@
<para>
The value of <literal>LAST_INSERT_ID()</literal> is not
changed if you update the <literal>AUTO_INCREMENT</literal>
- column of a row with a non-magic value (that is, a value
- that is not <literal>NULL</literal> and not
+ column of a row with a non-<quote>magic</quote> value (that
+ is, a value that is not <literal>NULL</literal> and not
<literal>0</literal>).
</para>
<para>
- If you insert many rows at the same time with an insert
- statement, <literal>LAST_INSERT_ID()</literal> returns the
- value for the first inserted row. The reason for this is to
- make it possible to easily reproduce the same
+ <emphasis role="bold">Important</emphasis>: If you insert
+ mutliple rows using a single <literal>INSERT</literal>
+ statement, <literal>LAST_INSERT_ID()</literal> returns the
+ value generated for the <emphasis>first</emphasis> inserted
+ row <emphasis>only</emphasis>. The reason for this is to
+ make it possible to reproduce easily the same
<literal>INSERT</literal> statement against some other
server.
</para>
<para>
+ For example:
+ </para>
+
+<programlisting>
+mysql> <userinput>USE test;</userinput>
+Database changed
+mysql> <userinput>CREATE TABLE t (</userinput>
+ -> <userinput>id INT AUTO_INCREMENT NOT NULL PRIMARY
KEY,</userinput>
+ -> <userinput>name VARCHAR(10) NOT NULL</userinput>
+ -> <userinput>);</userinput>
+Query OK, 0 rows affected (0.09 sec)
+
+mysql> <literal>INSERT INTO t VALUES (NULL, 'Bob');</literal>
+Query OK, 1 row affected (0.01 sec)
+
+mysql> <userinput>SELECT * FROM t;</userinput>
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
++----+------+
+1 row in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 1 |
++------------------+
+1 row in set (0.00 sec)
+
+mysql> <userinput>INSERT INTO t VALUES</userinput>
+ -> <userinput>(NULL, 'Mary'), (NULL, 'Jane'), (NULL,
'Lisa');</userinput>
+Query OK, 3 rows affected (0.00 sec)
+Records: 3 Duplicates: 0 Warnings: 0
+
+mysql> SELECT * FROM t;
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
+| 2 | Mary |
+| 3 | Jane |
+| 4 | Lisa |
++----+------+
+4 rows in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 2 |
++------------------+
+1 row in set (0.00 sec)
+</programlisting>
+
+ <para>
+ Although the second query inserted 3 new rows into
+ <literal>t</literal>, the ID generated for the first of
+ these rows was <literal>2</literal>, and it is this value
+ that is returned by <literal>LAST_INSERT_ID()</literal>.
+ </para>
+
+ <para>
If you use <literal>INSERT IGNORE</literal> and the record
is ignored, the <literal>AUTO_INCREMENT</literal> counter is
not incremented and <literal>LAST_INSERT_ID()</literal>
- returns 0, which reflects that no record was inserted.
- (Before MySQL 4.1, <literal>AUTO_INCREMENT</literal> counter
- still is incremented and <literal>LAST_INSERT_ID()</literal>
- returns the new value.)
+ returns <literal>0</literal>, which reflects that no record was
inserted.
</para>
<para>
@@ -13068,7 +12999,7 @@
</para>
<para>
- You can extract just the username part like this:
+ You can extract only the username part like this:
</para>
<programlisting>
@@ -13520,9 +13451,9 @@
<replaceable>str</replaceable> that was obtained with
<literal>GET_LOCK()</literal>. Returns
<literal>1</literal>
if the lock was released, <literal>0</literal> if the lock
- wasn't locked by this thread (in which case the lock is not
+ was not established by this thread (in which case the lock is not
released), and <literal>NULL</literal> if the named lock
- didn't exist. The lock does not exist if it was never
+ did not exist. The lock does not exist if it was never
obtained by a call to <literal>GET_LOCK()</literal> or if it
has previously been released.
</para>
@@ -13780,7 +13711,7 @@
In MySQL ¤t-series;, this function returns
<literal>18446744073709551615</literal> if there were no
matching rows. (This is the value of an unsigned
- <literal>BIGINT</literal> with all bits set to 1.)
+ <literal>BIGINT</literal> value with all bits set to 1.)
</para>
</listitem>
@@ -13955,8 +13886,8 @@
</programlisting>
<para>
- In MySQL, you can get the number of distinct expression
- combinations that don't contain <literal>NULL</literal> by
+ In MySQL, you can obtain the number of distinct expression
+ combinations that do not contain <literal>NULL</literal> by
giving a list of expressions. In standard SQL, you would
have to do a concatenation of all expressions inside
<literal>COUNT(DISTINCT ...)</literal>.
@@ -14147,7 +14078,7 @@
<literal>ENUM</literal> and <literal>SET</literal>
columns
by their string value rather than by the string's relative
position in the set. This differs from how <literal>ORDER
- BY</literal> compares them. This will be rectified in a
+ BY</literal> compares them. This is expected to be rectified in a
future MySQL release.
</para>
</listitem>
@@ -14451,7 +14382,6 @@
profit INT
);
-INSERT INTO sales (product,country,year,profit) VALUES
INSERT INTO sales VALUES
('Computer', 'India', 2000, 1200),
('TV', 'USA', 2001, 150),
@@ -14751,11 +14681,11 @@
<para>
MySQL extends the use of <literal>GROUP BY</literal> so that you
can use columns or calculations in the <literal>SELECT</literal>
- list that don't appear in the <literal>GROUP BY</literal>
- clause. This stands for <emphasis>any possible value for this
- group</emphasis>. You can use this to get better performance by
+ list that do not appear in the <literal>GROUP BY</literal>
+ clause. This stands for <quote>any possible value for this
+ group</quote>. You can use this to get better performance by
avoiding sorting and grouping on unnecessary items. For example,
- you don't need to group on <literal>customer.name</literal> in
+ you do not need to group on <literal>customer.name</literal> in
the following query:
</para>
@@ -14769,8 +14699,8 @@
<para>
In standard SQL, you would have to add
<literal>customer.name</literal> to the <literal>GROUP
- BY</literal> clause. In MySQL, the name is redundant if you
- don't run in ANSI mode.
+ BY</literal> clause. In MySQL, the name is redundant if you do
+ not run in ANSI mode.
</para>
<para>
@@ -14833,8 +14763,8 @@
<programlisting>
mysql> <userinput>SELECT id,FLOOR(value/100) AS val </userinput>
- -> <userinput>FROM
<replaceable>tbl_name</replaceable></userinput>
- -> <userinput>GROUP BY id, val ORDER BY val;</userinput>
+ -> <userinput>FROM
<replaceable>tbl_name</replaceable></userinput>
+ -> <userinput>GROUP BY id, val ORDER BY val;</userinput>
</programlisting>
<para>
Modified: trunk/refman-5.0/renamed-nodes.txt
===================================================================
--- trunk/refman-5.0/renamed-nodes.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.0/renamed-nodes.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -372,4 +372,5 @@
todo-sometime mysql-5-0-nutshell
todo-unplanned mysql-5-0-nutshell
beos operating-system-specific-notes
-open-bsd-2-8 operating-system-specific-notes
\ No newline at end of file
+open-bsd-2-8 operating-system-specific-notes
+fulltext-todo fulltext-search
\ No newline at end of file
Modified: trunk/refman-5.1/deleted-sections.txt
===================================================================
--- trunk/refman-5.1/deleted-sections.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.1/deleted-sections.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -372,3 +372,8 @@
errors-in-3-23 (also cut from RefMan-5.0)
# ----------------------------------------------------------------------
+
+
+# from functions.xml:
+
+fulltext-todo (also cut from RefMan-5.0)
Modified: trunk/refman-5.1/functions.xml
===================================================================
--- trunk/refman-5.1/functions.xml 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.1/functions.xml 2005-10-21 11:18:53 UTC (rev 128)
@@ -314,8 +314,8 @@
<para>
Note that when you are comparing a string column with a number,
- MySQL can't use an index on the column to quickly look up the
- value. If <replaceable>str_col</replaceable> is an indexed
+ MySQL cannot use an index on the column to look up the
+ value quickly. If <replaceable>str_col</replaceable> is an indexed
string column, the index cannot be used when performing the
lookup in the following statement:
</para>
@@ -397,8 +397,9 @@
<para>
<literal>NULL</literal>-safe equal. This operator performs
an equality comparison like the <literal>=</literal>
- operator, but returns 1 rather than <literal>NULL</literal>
- if both operands are <literal>NULL</literal>, and 0 rather
+ operator, but returns <literal>1</literal> rather than
+ <literal>NULL</literal>
+ if both operands are <literal>NULL</literal>, and
<literal>0</literal> rather
than <literal>NULL</literal> if one operand
is<literal>NULL</literal>.
</para>
@@ -760,7 +761,7 @@
<para>
This is needed to get some ODBC applications to work
- because ODBC doesn't support a
+ because ODBC does not support a
<literal>'0000-00-00'</literal> date value.
</para>
</listitem>
@@ -1203,7 +1204,7 @@
<programlisting>
mysql> <userinput>SELECT CAST(LEAST(3600, 9223372036854775808.0) as
SIGNED);</userinput>
- -> <userinput>-9223372036854775808</userinput>
+ -> -9223372036854775808
</programlisting>
<para>
@@ -1331,8 +1332,9 @@
<para>
Logical AND. Evaluates to <literal>1</literal> if all
- operands are non-zero and not <literal>NULL</literal>, to 0
- if one or more operands are <literal>0</literal>, otherwise
+ operands are non-zero and not <literal>NULL</literal>, to
+ <literal>0</literal> if one or more operands are
+ <literal>0</literal>, otherwise
<literal>NULL</literal> is returned.
</para>
@@ -1382,11 +1384,13 @@
<para>
Logical OR. When both operands are
- non-<literal>NULL</literal>, the result is 1 if any operand
- is non-zero, and 0 otherwise. With a <literal>NULL</literal>
- operand, the result is 1 if the other operand is non-zero,
- and <literal>NULL</literal> otherwise. If both operands are
- <literal>NULL</literal>, the result is also
+ non-<literal>NULL</literal>, the result is
+ <literal>1</literal> if any operand is non-zero, and
+ <literal>0</literal> otherwise. With a
+ <literal>NULL</literal> operand, the result is
+ <literal>1</literal> if the other operand is non-zero, and
+ <literal>NULL</literal> otherwise. If both operands are
+ <literal>NULL</literal>, the result is
<literal>NULL</literal>.
</para>
@@ -1429,8 +1433,9 @@
<para>
Logical XOR. Returns <literal>NULL</literal> if either
operand is <literal>NULL</literal>. For
- non-<literal>NULL</literal> operands, evaluates to 1 if an
- odd number of operands is non-zero, otherwise 0 is returned.
+ non-<literal>NULL</literal> operands, evaluates to
+ <literal>1</literal> if an odd number of operands is
+ non-zero, otherwise <literal>0</literal> is returned.
</para>
<remark role="help-description-end"/>
@@ -1590,15 +1595,15 @@
</programlisting>
<para>
- If only one of <literal>expr2</literal> or
- <literal>expr3</literal> is explicitly
+ If only one of <replaceable>expr2</replaceable> or
+ <replaceable>expr3</replaceable> is explicitly
<literal>NULL</literal>, the result type of the
- <literal>IF()</literal> function is the same type as the
- non-<literal>NULL</literal> expression.
+ <literal>IF()</literal> function is the type of
+ the non-<literal>NULL</literal> expression.
</para>
<para>
- <literal>expr1</literal> is evaluated as an integer value,
+ <replaceable>expr1</replaceable> is evaluated as an integer value,
which means that if you are testing floating-point or string
values, you should do so using a comparison operation.
</para>
@@ -1611,9 +1616,10 @@
</programlisting>
<para>
- In the first case shown, <literal>IF(0.1)</literal> returns 0
- because 0.1 is converted to an integer value, resulting in a
- test of <literal>IF(0)</literal>. This may not be what you
+ In the first case shown, <literal>IF(0.1)</literal> returns
+ <literal>0</literal> because <literal>0.1</literal> is
+ converted to an integer value, resulting in a test of
+ <literal>IF(0)</literal>. This may not be what you
expect. In the second case, the comparison tests the original
floating-point value to see whether it is non-zero. The result
of the comparison is used as an integer.
@@ -1635,16 +1641,16 @@
<entry><emphasis role="bold">Return
Value</emphasis></entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns a string</entry>
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns a string</entry>
<entry>string</entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns a
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns a
floating-point value</entry>
<entry>floating-point</entry>
</row>
<row>
- <entry><literal>expr2</literal> or
<literal>expr3</literal> returns an integer</entry>
+ <entry><replaceable>expr2</replaceable> or
<replaceable>expr3</replaceable> returns an integer</entry>
<entry>integer</entry>
</row>
</tbody>
@@ -1652,9 +1658,8 @@
</informaltable>
<para>
- If <literal>expr2</literal> and
<literal>expr3</literal> are
- strings, the result is case sensitive if either string is case
- sensitive.
+ If <replaceable>expr2</replaceable> and
<replaceable>expr3</replaceable> are both strings, the result
+ is case sensitive if either string is case sensitive.
</para>
</listitem>
@@ -1683,7 +1688,7 @@
<para>
If <replaceable>expr1</replaceable> is not
<literal>NULL</literal>, <literal>IFNULL()</literal>
returns
- <replaceable>expr1</replaceable>, otherwise it returns
+ <replaceable>expr1</replaceable>; otherwise it returns
<replaceable>expr2</replaceable>.
<literal>IFNULL()</literal>
returns a numeric or string value, depending on the context in
which it is used.
@@ -1825,11 +1830,11 @@
<para>
Returns the numeric value of the leftmost character of the
- string <replaceable>str</replaceable>. Returns 0 if
- <replaceable>str</replaceable> is the empty string. Returns
+ string <replaceable>str</replaceable>. Returns
+ <literal>0</literal> if <replaceable>str</replaceable>
is the empty string. Returns
<literal>NULL</literal> if
<replaceable>str</replaceable> is
- <literal>NULL</literal>. <literal>ASCII()</literal>
works for
- characters with numeric values from 0 to 255.
+ <literal>NULL</literal>. <literal>ASCII()</literal>
works for characters with numeric
+ values from <literal>0</literal> to
<literal>255</literal>.
</para>
<remark role="help-description-end"/>
@@ -1933,7 +1938,8 @@
<primary>CHAR()</primary>
</indexterm>
-
<literal>CHAR(<replaceable>N</replaceable>,...)</literal>
+ <literal>CHAR(<replaceable>N</replaceable>,... [USING
+ <replaceable>charset</replaceable>])</literal>
</para>
<remark role="help-syntax-end"/>
@@ -1941,8 +1947,9 @@
<remark role="help-description-begin"/>
<para>
- <literal>CHAR()</literal> interprets the arguments as integers
- and returns a string consisting of the characters given by the
+ <literal>CHAR()</literal> interprets each
+ argument <replaceable>N</replaceable> as an integer and
+ returns a string consisting of the characters given by the
code values of those integers. <literal>NULL</literal> values
are skipped.
</para>
@@ -1959,20 +1966,51 @@
</programlisting>
<para>
- In MySQL ¤t-series;, the <literal>CHAR()</literal>
- function takes into account the character set and collation
- given by the <literal>character_set_connection</literal> and
- <literal>collation_connection</literal> system variables. For
- an argument <replaceable>n</replaceable> to
- <literal>CHAR()</literal>, the result is
- <replaceable>n</replaceable> mod 256 for single-byte character
- sets. For multi-byte character sets,
- <replaceable>n</replaceable> must be a valid code point in the
- character set. Also, the result string from
- <literal>CHAR()</literal> is checked for well-formedness. For
- invalid arguments, or a result that is not well-formed, MySQL
- generates a warning (or, in strict SQL mode, an error).
+ <literal>CHAR()</literal> arguments larger
+ than 255 are converted into multiple result bytes. For
+ example, <literal>CHAR(256)</literal> is equivalent to
+ <literal>CHAR(1,0)</literal>, and
+ <literal>CHAR(256*256)</literal> is equivalent to
+ <literal>CHAR(1,0,0)</literal>:
</para>
+
+<programlisting>
+mysql> <userinput>SELECT HEX(CHAR(1,0)), HEX(CHAR(256));</userinput>
++----------------+----------------+
+| HEX(CHAR(1,0)) | HEX(CHAR(256)) |
++----------------+----------------+
+| 0100 | 0100 |
++----------------+----------------+
+mysql> <userinput>SELECT HEX(CHAR(1,0,0)),
HEX(CHAR(256*256));</userinput>
++------------------+--------------------+
+| HEX(CHAR(1,0,0)) | HEX(CHAR(256*256)) |
++------------------+--------------------+
+| 010000 | 010000 |
++------------------+--------------------+
+</programlisting>
+
+ <para>
+ <literal>CHAR()</literal> returns a binary string. To produce
+ a string in a given character set, the optional
+ <literal>USING</literal> clause may be used:
+ </para>
+ <programlisting>
+mysql> <userinput>SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING
utf8));</userinput>
++---------------------+--------------------------------+
+| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |
++---------------------+--------------------------------+
+| binary | utf8 |
++---------------------+--------------------------------+
+</programlisting>
+
+ <para>
+ If <literal>USING</literal> is given and the result string is
+ illegal for the given character set, a warning is issued. Also
+ if strict SQL mode is enabled, the result from
+ <literal>CHAR()</literal> becomes
<literal>NULL</literal>.
+ </para>
+
+ <remark role="help-description-end"/>
</listitem>
<listitem>
@@ -2407,7 +2445,8 @@
argument is a constant string and the second is a column of
type <literal>SET</literal>, the
<literal>FIND_IN_SET()</literal> function is optimized to use
- bit arithmetic. Returns 0 if <replaceable>str</replaceable> is
+ bit arithmetic. Returns <literal>0</literal> if
+ <replaceable>str</replaceable> is
not in <replaceable>strlist</replaceable> or if
<replaceable>strlist</replaceable> is the empty string.
Returns <literal>NULL</literal> if either argument is
@@ -2477,10 +2516,10 @@
</para>
<para>
- If <replaceable>N_OR_S</replaceable> is a string, this
- function returns a hexadecimal string of
- <replaceable>N_OR_S</replaceable> characters, where each
- character in <replaceable>N_OR_S</replaceable> is converted to
+ If <replaceable>N_OR_S</replaceable>
+ is a string, returns a hexadecimal string representation of
+ <replaceable>N_OR_S</replaceable> where each character in
+ <replaceable>N_OR_S</replaceable> is converted to
two hexadecimal digits.
</para>
@@ -2668,8 +2707,9 @@
<replaceable>str</replaceable>, measured in bytes. A
multi-byte character counts as multiple bytes. This means that
for a string containing five two-byte characters,
- <literal>LENGTH()</literal> returns 10, whereas
- <literal>CHAR_LENGTH()</literal> returns 5.
+ <literal>LENGTH()</literal> returns
<literal>10</literal>,
+ whereas <literal>CHAR_LENGTH()</literal> returns
+ <literal>5</literal>.
</para>
<remark role="help-description-end"/>
@@ -2713,9 +2753,9 @@
</para>
<para>
- If the file doesn't exist or cannot be read because one of the
- preceding conditions is not satisfied, the function returns
- <literal>NULL</literal>.
+ If the file does not exist or cannot be read because one of
+ the preceding conditions is not satisfied, the function
+ returns <literal>NULL</literal>.
</para>
<remark role="help-description-end"/>
@@ -2728,21 +2768,8 @@
WHERE id=1;
</programlisting>
- <remark>
- Should be deleted?
- </remark>
+ </listitem>
-<!--
- <para>
- Before MySQL 3.23, you must read the file inside your application
- and create an <literal>INSERT</literal> statement to update the
- database with the file contents. If you are using the MySQL++
- library, one way to do this can be found in the MySQL++ manual,
- available at <ulink url="http://dev.mysql.com/doc/"/>.
- </para>
--->
- </listitem>
-
<listitem>
<remark role="help-topic" condition="LOCATE"/>
@@ -2769,8 +2796,8 @@
position of the first occurrence of substring
<replaceable>substr</replaceable> in string
<replaceable>str</replaceable>, starting at position
- <replaceable>pos</replaceable>. Returns 0 if
- <replaceable>substr</replaceable> is not in
+ <replaceable>pos</replaceable>. Returns
<literal>0</literal>
+ if <replaceable>substr</replaceable> is not in
<replaceable>str</replaceable>.
</para>
@@ -3134,9 +3161,9 @@
properly escaped data value in an SQL statement. The string is
returned surrounded by single quotes and with each instance of
single quote (‘<literal>'</literal>’),
backslash
- (‘<literal>\</literal>’), ASCII NUL, and
Control-Z
- preceded by a backslash. If the argument is
- <literal>NULL</literal>, the return value is the word
+ (‘<literal>\</literal>’), ASCII
+ <literal>NUL</literal>, and Control-Z preceded by a backslash.
+ If the argument is <literal>NULL</literal>, the return value is the
word
<quote>NULL</quote> without surrounding single quotes.
</para>
@@ -3873,19 +3900,25 @@
<para>
If you want to convert a number to a string explicitly, use the
- <literal>CAST()</literal> function:
+ <literal>CAST()</literal> or <literal>CONCAT()</literal>
function:
</para>
<programlisting>
mysql> <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
-> 38.8, '38.8'
+mysql> <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
+ -> 38.8, '38.8'
</programlisting>
<para>
+ <literal>CAST()</literal> is preferable.
+ </para>
+
+ <para>
If a string function is given a binary string as an argument,
the resulting string is also a binary string. A number converted
- to a string is treated as a binary string (that is, it is case
- sensitive in comparisons). This affects only comparisons.
+ to a string is treated as a binary string. This affects only
+ comparisons.
</para>
<indexterm>
@@ -3931,11 +3964,12 @@
<para>
Pattern matching using SQL simple regular expression
- comparison. Returns 1 (<literal>TRUE</literal>) or 0
+ comparison. Returns <literal>1</literal>
+ (<literal>TRUE</literal>) or <literal>0</literal>
(<literal>FALSE</literal>). If either
<replaceable>expr</replaceable> or
<replaceable>pat</replaceable> is
<literal>NULL</literal>,
- the result is also <literal>NULL</literal>.
+ the result is <literal>NULL</literal>.
</para>
<para>
@@ -3982,8 +4016,8 @@
<para>
To test for literal instances of a wildcard character,
- precede the character with the escape character. If you
- don't specify the <literal>ESCAPE</literal> character,
+ precede the character with the escape character. If you do
+ not specify the <literal>ESCAPE</literal> character,
‘<literal>\</literal>’ is assumed.
</para>
@@ -4167,14 +4201,16 @@
<replaceable>pat</replaceable>. The pattern can be an
extended regular expression. The syntax for regular
expressions is discussed in <xref linkend="regexp"/>.
- Returns 1 if <replaceable>expr</replaceable> matches
- <replaceable>pat</replaceable>, otherwise returns 0. If
- either <replaceable>expr</replaceable> or
+ Returns <literal>1</literal> if
+ <replaceable>expr</replaceable> matches
+ <replaceable>pat</replaceable>; otherwise it returns
+ <literal>0</literal>. If either
+ <replaceable>expr</replaceable> or
<replaceable>pat</replaceable> is
<literal>NULL</literal>,
- the result is also <literal>NULL</literal>.
+ the result is <literal>NULL</literal>.
<literal>RLIKE</literal> is a synonym for
- <literal>REGEXP</literal>, provided for compatibility with
- <literal>mSQL</literal>.
+ <literal>REGEXP</literal>, provided for
+ <literal>mSQL</literal> compatibility.
</para>
<para>
@@ -4183,7 +4219,7 @@
</para>
<para>
- Note: Because MySQL uses the C escape syntax in strings (for
+ <emphasis role="bold">Note</emphasis>: Because MySQL uses the C
escape syntax in strings (for
example, ‘<literal>\n</literal>’ to represent
the newline character), you must double any
‘<literal>\</literal>’ that you use in your
@@ -4239,9 +4275,10 @@
<remark role="help-description-begin"/>
<para>
- <literal>STRCMP()</literal> returns 0 if the strings are
- identical, -1 if the first argument is smaller than the
- second according to the current sort order, and 1 otherwise.
+ <literal>STRCMP()</literal> returns
<literal>0</literal> if
+ the strings are the same, <literal>-1</literal> if the first
+ argument is smaller than the second according to the current
+ sort order, and <literal>1</literal> otherwise.
</para>
<remark role="help-description-end"/>
@@ -4420,8 +4457,8 @@
<emphasis role="bold">Note</emphasis>: If this operator is
used with a <literal>BIGINT</literal>, the return value is
also a <literal>BIGINT</literal>. This means that you should
- avoid using <literal>-</literal> on integers that may be
- equal to -2<superscript>63</superscript> or less.
+ avoid using <literal>−</literal> on integers that may
have the
+ value of
<literal>−2<superscript>63</superscript></literal>.
</para>
</listitem>
@@ -4639,20 +4676,17 @@
<remark role="help-description-begin"/>
<para>
- Returns the arccosine of <replaceable>X</replaceable>, that
+ Returns the arc cosine of <replaceable>X</replaceable>, that
is, the value whose cosine is <replaceable>X</replaceable>.
Returns <literal>NULL</literal> if
- <replaceable>X</replaceable> is not in the range -1 to 1.
+ <replaceable>X</replaceable> is not in the range
+ <literal>-1</literal> to <literal>1</literal>.
</para>
<remark role="help-description-end"/>
<remark role="help-example" condition="ACOS"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ACOS(1);</userinput>
-> 0
@@ -4681,20 +4715,17 @@
<remark role="help-description-begin"/>
<para>
- Returns the arcsine of <replaceable>X</replaceable>, that
+ Returns the arc sine of <replaceable>X</replaceable>, that
is, the value whose sine is <replaceable>X</replaceable>.
Returns <literal>NULL</literal> if
- <replaceable>X</replaceable> is not in the range -1 to 1.
+ <replaceable>X</replaceable> is not in the range
+ <literal>-1</literal> to <literal>1</literal>.
</para>
<remark role="help-description-end"/>
<remark role="help-example" condition="ASIN"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ASIN(0.2);</userinput>
-> 0.20135792079033
@@ -4729,17 +4760,17 @@
<literal>ATAN(<replaceable>X</replaceable>)</literal>
</para>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
- Returns the arctangent of <replaceable>X</replaceable>, that
+ Returns the arc tangent of <replaceable>X</replaceable>, that
is, the value whose tangent is <replaceable>X</replaceable>.
</para>
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="ATAN"/>
<programlisting>
@@ -4770,10 +4801,10 @@
<remark role="help-description-begin"/>
<para>
- Returns the arctangent of the two variables
+ Returns the arc tangent of the two variables
<replaceable>X</replaceable> and
<replaceable>Y</replaceable>. It is similar to calculating
- the arctangent of <literal><replaceable>Y</replaceable> /
+ the arc tangent of <literal><replaceable>Y</replaceable> /
<replaceable>X</replaceable></literal>, except that the
signs of both arguments are used to determine the quadrant
of the result.
@@ -4781,10 +4812,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="ATAN2"/>
<programlisting>
@@ -4852,6 +4879,10 @@
<literal>COS(<replaceable>X</replaceable>)</literal>
</para>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
Returns the cosine of <replaceable>X</replaceable>, where
<replaceable>X</replaceable> is given in radians.
@@ -4859,10 +4890,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="COS"/>
<programlisting>
@@ -4884,16 +4911,16 @@
<literal>COT(<replaceable>X</replaceable>)</literal>
</para>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
Returns the cotangent of <replaceable>X</replaceable>.
</para>
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="COT"/>
<programlisting>
@@ -4965,12 +4992,8 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
+ <remark role="help-example" condition="DEGREES"/>
- <remark role="help-example" condition="DEGRESS"/>
-
<programlisting>
mysql> <userinput>SELECT DEGREES(PI());</userinput>
-> 180
@@ -5004,10 +5027,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="EXP"/>
<programlisting>
@@ -5104,7 +5123,7 @@
Returns the natural logarithm of
<replaceable>X</replaceable>, that is, the logarithm of
<replaceable>X</replaceable> to the base
- <replaceable>e</replaceable>.
+ <literal>e</literal>.
</para>
<remark role="help-description-end"/>
@@ -5246,10 +5265,6 @@
<remark role="help-example" condition="LOG10"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<programlisting>
mysql> <userinput>SELECT LOG10(2);</userinput>
-> 0.30102999566398
@@ -5414,12 +5429,8 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
+ <remark role="help-example" condition="POWER"/>
- <remark role="help-example" condition="POW"/>
-
<programlisting>
mysql> <userinput>SELECT POW(2,2);</userinput>
-> 4
@@ -5453,10 +5464,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="RADIANS"/>
<programlisting>
@@ -5484,8 +5491,9 @@
<remark role="help-description-begin"/>
<para>
- Returns a random floating-point value in the range from 0 to
- 1.0. If an integer argument <replaceable>N</replaceable> is
+ Returns a random floating-point value in the range from
+ <literal>0</literal> to <literal>1.0</literal>. If an
+ integer argument <replaceable>N</replaceable> is
specified, it is used as the seed value, which produces a
repeatable sequence.
</para>
@@ -5499,6 +5507,8 @@
-> 0.9233482386203
mysql> <userinput>SELECT RAND(20);</userinput>
-> 0.15888261251047
+mysql> <userinput>SELECT RAND(20);</userinput>
+ -> 0.15888261251047
mysql> <userinput>SELECT RAND();</userinput>
-> 0.63553050033332
mysql> <userinput>SELECT RAND();</userinput>
@@ -5507,20 +5517,12 @@
-> 0.15888261251047
</programlisting>
- <remark role="todo">
- Rewrite the sentence I've commented out. It's *very*
- confusing, as it seems to contradict directly what follows.
- </remark>
-
<para>
-<!--
- You can't use a column with <literal>RAND()</literal> values in an
- <literal>ORDER BY</literal> clause, because <literal>ORDER
- BY</literal> would evaluate the column multiple times.
--->
-
- You can use this function to retrieve rows in random order
- as shown here:
+ You cannot use a column with <literal>RAND()</literal>
+ values in an <literal>ORDER BY</literal> clause, because
+ <literal>ORDER BY</literal> would evaluate the column
+ multiple times. However, you can retrieve rows in
+ random order like this:
</para>
<programlisting>
@@ -5546,9 +5548,9 @@
<para>
<literal>RAND()</literal> is not meant to be a perfect
- random generator, but instead a quick way of generating ad
- hoc random numbers that is portable between platforms for
- the same MySQL version.
+ random generator, but instead is a fast way to generate
+ <emphasis>ad hoc</emphasis> random numbers that is portable
+ between platforms for the same MySQL version.
</para>
</listitem>
@@ -5601,7 +5603,7 @@
<para>
The return type is the same type as that of the first
- argument (assuming it's integer, double, or decimal). This
+ argument (assuming that it is integer, double, or decimal). This
means that for an integer argument, the result is an integer
(no decimals).
</para>
@@ -5645,10 +5647,6 @@
and approximate values:
</para>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<programlisting>
mysql> <userinput>SELECT ROUND(2.5), ROUND(25E-1);</userinput>
+------------+--------------+
@@ -5759,10 +5757,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="SQRT"/>
<programlisting>
@@ -5799,10 +5793,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="TAN"/>
<programlisting>
@@ -5833,8 +5823,9 @@
<para>
Returns the number <replaceable>X</replaceable>, truncated
to <replaceable>D</replaceable> decimals. If
- <replaceable>D</replaceable> is 0, the result has no decimal
- point or fractional part. <replaceable>D</replaceable> can
+ <replaceable>D</replaceable> is <literal>0</literal>,
the
+ result has no decimal point or fractional part.
+ <replaceable>D</replaceable> can
be negative in order to truncate (make zero)
<replaceable>D</replaceable> digits left of the decimal
point of the value <replaceable>X</replaceable>.
@@ -5842,10 +5833,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="TRUNCATE"/>
<programlisting>
@@ -5949,8 +5936,10 @@
The return value ranges in the following function descriptions
apply for complete dates. If a date is a <quote>zero</quote> value
or an incomplete date such as <literal>'2001-11-00'</literal>,
- functions that extract a part of a date may return 0. For example,
- <literal>DAYOFMONTH('2001-11-00')</literal> returns 0.
+ functions that extract a part of a date may return
+ <literal>0</literal>. For example,
+ <literal>DAYOFMONTH('2001-11-00')</literal> returns
+ <literal>0</literal>.
</para>
<itemizedlist>
@@ -6000,10 +5989,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="ADDDATE"/>
<programlisting>
@@ -6044,10 +6029,6 @@
<remark role="help-description-end"/>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="ADDTIME"/>
<programlisting>
@@ -6259,6 +6240,7 @@
<remark role="help-description-begin"/>
<para>
+ <literal>CURRENT_TIMESTAMP</literal> and
<literal>CURRENT_TIMESTAMP()</literal> are synonyms for
<literal>NOW()</literal>.
</para>
@@ -6269,6 +6251,10 @@
<listitem>
<remark role="help-topic" condition="DATE function"/>
+ <remark role="help-keywords">
+ DATE
+ </remark>
+
<remark role="help-syntax-begin"/>
<para>
@@ -6388,7 +6374,7 @@
<para>
The <literal>INTERVAL</literal> keyword and the
- <literal>type</literal> specifier are not case sensitive.
+ <replaceable>type</replaceable> specifier are not case sensitive.
</para>
<para>
@@ -6516,10 +6502,6 @@
or datetime value from an interval. (See examples below.)
</para>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
<remark role="help-example" condition="DATE OPERATIONS"/>
<programlisting>
@@ -6560,9 +6542,9 @@
<literal>DAY_SECOND</literal>, the value of
<replaceable>expr</replaceable> is expected to have days,
hours, minutes, and seconds parts. If you specify a value like
- '1:10', MySQL assumes that the days and hours parts are
- missing and the value represents minutes and seconds. In other
- words, <literal>'1:10' DAY_SECOND</literal> is interpreted in
+ <literal>'1:10'</literal>, MySQL assumes that the days and
+ hours parts are missing and the value represents minutes and
+ seconds. In other words, <literal>'1:10' DAY_SECOND</literal> is
interpreted in
such a way that it is equivalent to <literal>'1:10'
MINUTE_SECOND</literal>. This is analogous to the way that
MySQL interprets <literal>TIME</literal> values as
@@ -6575,11 +6557,7 @@
a datetime value:
</para>
- <remark role="note">
- Output from 5.1.2-alpha
- </remark>
-
-<programlisting>
+ <programlisting>
mysql> <userinput>SELECT DATE_ADD('1999-01-01', INTERVAL 1
DAY);</userinput>
-> '1999-01-02'
mysql> <userinput>SELECT DATE_ADD('1999-01-01', INTERVAL 1
HOUR);</userinput>
@@ -6925,8 +6903,9 @@
<para>
Returns the weekday index for <replaceable>date</replaceable>
- (1 = Sunday, 2 = Monday, ..., 7 = Saturday). These index
- values correspond to the ODBC standard.
+ (<literal>1</literal> = Sunday, <literal>2</literal> =
Monday,
+ ..., <literal>7</literal> = Saturday). These index values
+ correspond to the ODBC standard.
</para>
<remark role="help-description-end"/>
@@ -6952,9 +6931,14 @@
<literal>DAYOFYEAR(<replaceable>date</replaceable>)</literal>
</para>
+ <remark role="help-syntax-end"/>
+
+ <remark role="help-description-begin"/>
+
<para>
Returns the day of the year for
- <replaceable>date</replaceable>, in the range 1 to 366.
+ <replaceable>date</replaceable>, in the range
+ <literal>1</literal> to <literal>366</literal>.
</para>
<remark role="help-description-end"/>
@@ -7278,7 +7262,8 @@
<para>
Returns the hour for <replaceable>time</replaceable>. The
- range of the return value is 0 to 23 for time-of-day values.
+ range of the return value is <literal>0</literal> to
+ <literal>23</literal> for time-of-day values.
</para>
<remark role="help-description-end"/>
@@ -7965,7 +7950,7 @@
<para>
<emphasis role="bold">Note</emphasis> that you cannot use
format <literal>"%X%V"</literal> to convert a year-week string
- to date as the combination of a year and week does not
+ to a date as the combination of a year and week does not
uniquely identify a year and month if the week crosses a month
boundary. To convert a year-week to a date, then you should
also specify the weekday:
@@ -8701,10 +8686,10 @@
<para>
Note that if a date falls in the last week of the previous
- year, MySQL returns <literal>0</literal> if you don't use
+ year, MySQL returns <literal>0</literal> if you do not use
<literal>2</literal>, <literal>3</literal>,
<literal>6</literal>, or <literal>7</literal> as the
optional
- <literal>mode</literal> argument:
+ <replaceable>mode</replaceable> argument:
</para>
<programlisting>
@@ -8718,7 +8703,7 @@
date actually occurs in the 52nd week of 1999. We decided to
return <literal>0</literal> instead because we want the
function to return <quote>the week number in the given
- year.</quote> This makes use of the <literal>WEEK()</literal>
+ year</quote>. This makes use of the <literal>WEEK()</literal>
function reliable when combined with other functions that
extract a date part from a date.
</para>
@@ -8728,7 +8713,7 @@
the year that contains the first day of the week for the given
date, you should use <literal>0</literal>,
<literal>2</literal>, <literal>5</literal>, or
- <literal>7</literal> as the optional
<literal>mode</literal>
+ <literal>7</literal> as the optional
<replaceable>mode</replaceable>
argument.
</para>
@@ -8909,8 +8894,8 @@
</indexterm>
<para>
- MySQL uses what is known as a <emphasis role="bold">proleptic
- Gregorian calendar</emphasis>.
+ MySQL uses what is known as a <firstterm>proleptic
+ Gregorian calendar</firstterm>.
</para>
<para>
@@ -9231,7 +9216,7 @@
start and end by looking for certain delimiters, for example
<literal>' '</literal> (the space character),
<literal>,</literal>
(the comma), and <literal>.</literal> (the period). If words
- aren't separated by delimiters as in, for example, Chinese, the
+ are not separated by delimiters (as in, for example, Chinese), the
<literal>FULLTEXT</literal> parser cannot determine where a word
begins or ends. To be able to add words or other indexed terms in
such languages to a <literal>FULLTEXT</literal> index, you must
@@ -9307,13 +9292,13 @@
The search result is empty because the word <quote>MySQL</quote>
is present in at least 50% of the rows. As such, it is effectively
treated as a stopword. For large datasets, this is the most
- desirable behavior---a natural language query should not return
- every second row from a 1GB table. For small datasets, it may be
- less desirable.
+ desirable behavior — a natural language query should not
+ return every second row from a 1GB table. For small datasets, it
+ may be less desirable.
</para>
<para>
- A word that matches half of rows in a table is less likely to
+ A word that matches half of the rows in a table is less likely to
locate relevant documents. In fact, it most likely finds plenty of
irrelevant documents. We all know this happens far too often when
we are trying to find something on the Internet with a search
@@ -9330,7 +9315,7 @@
text occurs in at least 50% of the rows. As a result, no search
returns any results. Be sure to insert at least three rows, and
preferably many more. Users who need to bypass the 50% limitation
- can use the boolean search mode, see
+ can use the boolean search mode; see
<xref linkend="fulltext-boolean"/>.
</para>
@@ -9431,7 +9416,7 @@
<para>
A leading plus sign indicates that this word
- <emphasis role="bold">must</emphasis> be present in each row
+ <emphasis>must</emphasis> be present in each row
that is returned.
</para>
</listitem>
@@ -9443,7 +9428,7 @@
<para>
A leading minus sign indicates that this word must
- <emphasis role="bold">not</emphasis> be present in any of
+ <emphasis>not</emphasis> be present in any of
the rows that are returned.
</para>
</listitem>
@@ -9510,7 +9495,7 @@
<para>
The asterisk serves as the truncation operator. Unlike the
other operators, it should be
- <emphasis role="bold">appended</emphasis> to the word to be
+ <emphasis>appended</emphasis> to the word to be
affected.
</para>
</listitem>
@@ -9707,9 +9692,10 @@
</para>
<para>
- Note: Because blind query expansion tends to increase noise
- significantly by returning non-relevant documents, it's only
- meaningful to use when a search phrase is rather short.
+ <emphasis role="bold">Note</emphasis>: Because blind query
+ expansion tends to increase noise significantly by returning
+ non-relevant documents, it is meaningful to use only when a
+ search phrase is rather short.
</para>
</section>
@@ -10517,7 +10503,7 @@
<para>
In MySQL ¤t-series;, full-text searches can be used
with most multi-byte character sets. The exception is that
- for Unicode, the <literal>utf8</literal> character set can
+ for Unicode; the <literal>utf8</literal> character set can
be used, but not the <literal>ucs2</literal> character set.
</para>
</listitem>
@@ -10570,8 +10556,7 @@
<para>
MySQL's full-text search capability has few user-tunable
- parameters at present, although adding more is very high on the
- TODO list. You can exert more control over full-text searching
+ parameters. You can exert more control over full-text searching
behavior if you have a MySQL source distribution because some
changes require source code modifications. See
<xref linkend="installing-source"/>.
@@ -10698,13 +10683,7 @@
variable. This variable also can be changed while the server
is running, but you must have the <literal>SUPER</literal>
privilege to do so. No rebuilding of indexes is necessary in
- this case.
-
- <remark>
- Don't change this to an xref due to capitalisation.
- </remark>
-
- <link
linkend="server-system-variables">&title-server-system-variables;</link>
+ this case. See <xref linkend="server-system-variables"/>, which
describes the rules governing how to set this variable.
</para>
</listitem>
@@ -10779,81 +10758,8 @@
</section>
- <section id="fulltext-todo">
-
- <title id="title-fulltext-todo">&title-fulltext-todo;</title>
-
- <itemizedlist>
-
- <listitem>
- <para>
- Improved performance for all <literal>FULLTEXT</literal>
- operations.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Proximity operators.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for <quote>always-index words.</quote> These could
- be any strings the user wants to treat as words, such as
- <quote>C++</quote>, <quote>AS/400</quote>, or
- <quote>TCP/IP</quote>.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for full-text search in <literal>MERGE</literal>
- tables.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Support for the <literal>ucs2</literal> character set.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Make the stopword list dependent on the language of the
- dataset.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Stemming
- </para>
- </listitem>
-
- <listitem>
- <para>
- Generic user-suppliable UDF preparser.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Make the model more flexible (by adding some adjustable
- parameters to <literal>FULLTEXT</literal> in
<literal>CREATE
- TABLE</literal> and <literal>ALTER TABLE</literal>
- statements).
- </para>
- </listitem>
-
- </itemizedlist>
-
</section>
- </section>
-
<section id="cast-functions">
<title id="title-cast-functions">&title-cast-functions;</title>
@@ -11551,10 +11457,10 @@
<para>
These functions allow encryption and decryption of data
using the official AES (Advanced Encryption Standard)
- algorithm, previously known as "Rijndael." Encoding with a
+ algorithm, previously known as <quote>Rijndael</quote>. Encoding
with a
128-bit key length is used, but you can extend it up to 256
bits by modifying the source. We chose 128 bits because it
- is much faster and it is usually secure enough.
+ is much faster and it is secure enough for most purposes.
</para>
<para>
@@ -11707,8 +11613,8 @@
</para>
<para>
- If the <replaceable>crypt_str</replaceable> argument doesn't
- look like an encrypted string, MySQL returns the given
+ If the <replaceable>crypt_str</replaceable> argument does
+ not appear to be an encrypted string, MySQL returns the given
<replaceable>crypt_str</replaceable>.
</para>
@@ -11804,6 +11710,8 @@
Each line in the DES key file has the following format:
</para>
+<remark role="help-example" condition="DES_ENCRYPT"/>
+
<programlisting>
<replaceable>key_num</replaceable>
<replaceable>des_key_str</replaceable>
</programlisting>
@@ -11815,7 +11723,7 @@
<replaceable>des_key_str</replaceable> is the string that is
used to encrypt the message. Between the number and the key
there should be at least one space. The first key is the
- default key that is used if you don't specify any key
+ default key that is used if you do not specify any key
argument to <literal>DES_ENCRYPT()</literal>
</para>
@@ -11883,7 +11791,7 @@
<para>
If <literal>crypt()</literal> is not available on your
- system (such as is the case with Windows),
+ system (as is the case with Windows),
<literal>ENCRYPT()</literal> always returns
<literal>NULL</literal>. Because of this, we recommend that
you use <literal>MD5()</literal> or
@@ -11968,6 +11876,7 @@
without locking them out. See
<xref linkend="password-hashing"/>.
</para>
+ <remark role="help-description-end"/>
</listitem>
<listitem>
@@ -12614,8 +12523,11 @@
<remark role="help-description-begin"/>
<para>
- Returns the last automatically generated value that was
- inserted into an <literal>AUTO_INCREMENT</literal> column.
+ Returns the <emphasis>first</emphasis> automatically
+ generated value that was set for an
+ <literal>AUTO_INCREMENT</literal> column by the
+ <emphasis>last</emphasis> <literal>INSERT</literal>
or
+ <literal>UPDATE</literal> query to affect such a column.
</para>
<remark role="help-description-end"/>
@@ -12628,12 +12540,14 @@
</programlisting>
<para>
- The last ID that was generated is maintained in the server
- on a per-connection basis. This means the value the function
- returns to a given client is the most recent
- <literal>AUTO_INCREMENT</literal> value generated by that
- client. The value cannot be affected by other clients, even
- if they generate <literal>AUTO_INCREMENT</literal> values of
+ The ID that was generated is maintained in the server
+ on a <emphasis>per-connection basis</emphasis>. This means
+ that the value which the function returns to a given client
+ is the first <literal>AUTO_INCREMENT</literal> value
+ generated for most recent statement affecting an
+ <literal>AUTO_INCREMENT</literal> column by that client.
+ This value cannot be affected by other clients, even if they
+ generate <literal>AUTO_INCREMENT</literal> values of
their own. This behavior ensures that you can retrieve your
own ID without concern for the activity of other clients,
and without the need for locks or transactions.
@@ -12642,28 +12556,91 @@
<para>
The value of <literal>LAST_INSERT_ID()</literal> is not
changed if you update the <literal>AUTO_INCREMENT</literal>
- column of a row with a non-magic value (that is, a value
- that is not <literal>NULL</literal> and not
+ column of a row with a non-<quote>magic</quote> value (that
+ is, a value that is not <literal>NULL</literal> and not
<literal>0</literal>).
</para>
<para>
- If you insert many rows at the same time with an insert
- statement, <literal>LAST_INSERT_ID()</literal> returns the
- value for the first inserted row. The reason for this is to
- make it possible to easily reproduce the same
+ <emphasis role="bold">Important</emphasis>: If you insert
+ mutliple rows using a single <literal>INSERT</literal>
+ statement, <literal>LAST_INSERT_ID()</literal> returns the
+ value generated for the <emphasis>first</emphasis> inserted
+ row <emphasis>only</emphasis>. The reason for this is to
+ make it possible to reproduce easily the same
<literal>INSERT</literal> statement against some other
server.
</para>
<para>
+ For example:
+ </para>
+
+<programlisting>
+mysql> <userinput>USE test;</userinput>
+Database changed
+mysql> <userinput>CREATE TABLE t (</userinput>
+ -> <userinput>id INT AUTO_INCREMENT NOT NULL PRIMARY
KEY,</userinput>
+ -> <userinput>name VARCHAR(10) NOT NULL</userinput>
+ -> <userinput>);</userinput>
+Query OK, 0 rows affected (0.09 sec)
+
+mysql> <literal>INSERT INTO t VALUES (NULL, 'Bob');</literal>
+Query OK, 1 row affected (0.01 sec)
+
+mysql> <userinput>SELECT * FROM t;</userinput>
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
++----+------+
+1 row in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 1 |
++------------------+
+1 row in set (0.00 sec)
+
+mysql> <userinput>INSERT INTO t VALUES</userinput>
+ -> <userinput>(NULL, 'Mary'), (NULL, 'Jane'), (NULL,
'Lisa');</userinput>
+Query OK, 3 rows affected (0.00 sec)
+Records: 3 Duplicates: 0 Warnings: 0
+
+mysql> SELECT * FROM t;
++----+------+
+| id | name |
++----+------+
+| 1 | Bob |
+| 2 | Mary |
+| 3 | Jane |
+| 4 | Lisa |
++----+------+
+4 rows in set (0.01 sec)
+
+mysql> <userinput>SELECT LAST_INSERT_ID();</userinput>
++------------------+
+| LAST_INSERT_ID() |
++------------------+
+| 2 |
++------------------+
+1 row in set (0.00 sec)
+</programlisting>
+
+ <para>
+ Although the second query inserted 3 new rows into
+ <literal>t</literal>, the ID generated for the first of
+ these rows was <literal>2</literal>, and it is this value
+ that is returned by <literal>LAST_INSERT_ID()</literal>.
+ </para>
+
+ <para>
If you use <literal>INSERT IGNORE</literal> and the record
is ignored, the <literal>AUTO_INCREMENT</literal> counter is
not incremented and <literal>LAST_INSERT_ID()</literal>
- returns 0, which reflects that no record was inserted.
- (Before MySQL 4.1, <literal>AUTO_INCREMENT</literal> counter
- still is incremented and <literal>LAST_INSERT_ID()</literal>
- returns the new value.)
+ returns <literal>0</literal>, which reflects that no record was
inserted.
</para>
<para>
@@ -12909,7 +12886,7 @@
</para>
<para>
- You can extract just the username part like this:
+ You can extract only the username part like this:
</para>
<programlisting>
@@ -13361,9 +13338,9 @@
<replaceable>str</replaceable> that was obtained with
<literal>GET_LOCK()</literal>. Returns
<literal>1</literal>
if the lock was released, <literal>0</literal> if the lock
- wasn't locked by this thread (in which case the lock is not
+ was not established by this thread (in which case the lock is not
released), and <literal>NULL</literal> if the named lock
- didn't exist. The lock does not exist if it was never
+ did not exist. The lock does not exist if it was never
obtained by a call to <literal>GET_LOCK()</literal> or if it
has previously been released.
</para>
@@ -13621,7 +13598,7 @@
In MySQL ¤t-series;, this function returns
<literal>18446744073709551615</literal> if there were no
matching rows. (This is the value of an unsigned
- <literal>BIGINT</literal> with all bits set to 1.)
+ <literal>BIGINT</literal> value with all bits set to 1.)
</para>
</listitem>
@@ -13796,8 +13773,8 @@
</programlisting>
<para>
- In MySQL, you can get the number of distinct expression
- combinations that don't contain <literal>NULL</literal> by
+ In MySQL, you can obtain the number of distinct expression
+ combinations that do not contain <literal>NULL</literal> by
giving a list of expressions. In standard SQL, you would
have to do a concatenation of all expressions inside
<literal>COUNT(DISTINCT ...)</literal>.
@@ -13988,7 +13965,7 @@
<literal>ENUM</literal> and <literal>SET</literal>
columns
by their string value rather than by the string's relative
position in the set. This differs from how <literal>ORDER
- BY</literal> compares them. This will be rectified in a
+ BY</literal> compares them. This is expected to be rectified in a
future MySQL release.
</para>
</listitem>
@@ -14288,7 +14265,6 @@
profit INT
);
-INSERT INTO sales (product,country,year,profit) VALUES
INSERT INTO sales VALUES
('Computer', 'India', 2000, 1200),
('TV', 'USA', 2001, 150),
@@ -14588,11 +14564,11 @@
<para>
MySQL extends the use of <literal>GROUP BY</literal> so that you
can use columns or calculations in the <literal>SELECT</literal>
- list that don't appear in the <literal>GROUP BY</literal>
- clause. This stands for <emphasis>any possible value for this
- group</emphasis>. You can use this to get better performance by
+ list that do not appear in the <literal>GROUP BY</literal>
+ clause. This stands for <quote>any possible value for this
+ group</quote>. You can use this to get better performance by
avoiding sorting and grouping on unnecessary items. For example,
- you don't need to group on <literal>customer.name</literal> in
+ you do not need to group on <literal>customer.name</literal> in
the following query:
</para>
@@ -14606,8 +14582,8 @@
<para>
In standard SQL, you would have to add
<literal>customer.name</literal> to the <literal>GROUP
- BY</literal> clause. In MySQL, the name is redundant if you
- don't run in ANSI mode.
+ BY</literal> clause. In MySQL, the name is redundant if you do
+ not run in ANSI mode.
</para>
<para>
Modified: trunk/refman-5.1/renamed-nodes.txt
===================================================================
--- trunk/refman-5.1/renamed-nodes.txt 2005-10-21 02:10:57 UTC (rev 127)
+++ trunk/refman-5.1/renamed-nodes.txt 2005-10-21 11:18:53 UTC (rev 128)
@@ -75,3 +75,5 @@
windows-binary-installation windows-installation
windows-prepare-environment windows-create-option-file
windows-running windows-testing
+
+fulltext-todo fulltext-search
\ No newline at end of file
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r128 - in trunk: refman-4.1 refman-5.0 refman-5.1 | jstephens | 21 Oct |