List:Commits« Previous MessageNext Message »
From:paul Date:January 20 2006 4:33am
Subject:svn commit - mysqldoc@docsrva: r943 - in trunk: . refman-4.1 refman-5.0 refman-5.1
View as plain text  
Author: paul
Date: 2006-01-20 05:33:02 +0100 (Fri, 20 Jan 2006)
New Revision: 943

Log:
 r6471@frost:  paul | 2006-01-19 21:20:42 -0600
 Set up explicit type-conversion section.


Modified:
   trunk/
   trunk/refman-4.1/functions.xml
   trunk/refman-5.0/functions.xml
   trunk/refman-5.1/functions.xml


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:6470
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2335
   + b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:6471
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:2335

Modified: trunk/refman-4.1/functions.xml
===================================================================
--- trunk/refman-4.1/functions.xml	2006-01-20 04:32:46 UTC (rev 942)
+++ trunk/refman-4.1/functions.xml	2006-01-20 04:33:02 UTC (rev 943)
@@ -169,45 +169,50 @@
 
     </section>
 
-    <section id="comparison-operators">
+    <section id="type-conversion">
 
-      <title>&title-comparison-operators;</title>
+      <title>&title-type-conversion;</title>
 
-      <indexterm type="function">
-        <primary>comparison operators</primary>
+      <indexterm>
+        <primary>type conversions</primary>
       </indexterm>
 
-      <remark role="help-category" condition="Comparison operators@Functions"/>
-
       <indexterm>
         <primary>casts</primary>
       </indexterm>
 
-      <indexterm>
-        <primary>type conversions</primary>
-      </indexterm>
-
       <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
-        operations work for both numbers and strings. Strings are
-        automatically converted to numbers and numbers to strings as
-        necessary.
+        When an operator is used with operands of different types, type
+        conversion occurs to make the operands compatible. Some
+        conversions occur implicitly. For example, MySQL automatically
+        converts numbers to strings as necessary, and vice versa.
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 1+'1';</userinput>
+        -&gt; 2
+mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
+        -&gt; '2 test'
+</programlisting>
+
       <para>
-        Some of the functions in this section (such as
-        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
-        return values other than <literal>1</literal>
-        (<literal>TRUE</literal>), <literal>0</literal>
-        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
-        the value they return is based on comparison operations
-        performed as described by the following rules.
+        It is also possible to perform explicit conversions. If you want
+        to convert a number to a string explicitly, use the
+        <literal>CAST()</literal> or <literal>CONCAT()</literal>
+        function (<literal>CAST()</literal> is preferable, but is
+        unavailable before MySQL 4.0.2):
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
+        -&gt; 38.8, '38.8'
+mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
+        -&gt; 38.8, '38.8'
+</programlisting>
+
       <para>
-        MySQL compares values using the following rules:
+        The following rules describe how conversion occurs for
+        comparison operations:
       </para>
 
       <itemizedlist>
@@ -218,6 +223,8 @@
             result of the comparison is <literal>NULL</literal>, except
             for the <literal>NULL</literal>-safe
             <literal>&lt;=&gt;</literal> equality comparison operator.
+            For <literal>NULL &lt;=&gt; NULL</literal>, the result is
+            true.
           </para>
         </listitem>
 
@@ -257,8 +264,8 @@
             <literal>DATETIME</literal> column and the other argument is
             a constant, the constant is converted to a timestamp before
             the comparison is performed. This is done to be more
-            ODBC-friendly. Note that this is not done for arguments in
-            <literal>IN()</literal>! To be safe, always use complete
+            ODBC-friendly. Note that this is not done for the arguments
+            to <literal>IN()</literal>! To be safe, always use complete
             datetime/date/time strings when doing comparisons.
           </para>
         </listitem>
@@ -273,21 +280,6 @@
       </itemizedlist>
 
       <para>
-        By default, string comparisons are not case sensitive and use
-        the current character set. The default is
-        <literal>latin1</literal> (cp1252 West European), which also
-        works well for English).
-      </para>
-
-      <para>
-        To convert a value to a specific type for comparison purposes,
-        you can use the <literal>CAST()</literal> function. String
-        values can be converted to a different character set using
-        <literal>CONVERT()</literal>. See
-        <xref linkend="cast-functions"/>.
-      </para>
-
-      <para>
         The following examples illustrate conversion of strings to
         numbers for comparison operations:
       </para>
@@ -322,6 +314,61 @@
         <literal>'1a'</literal>, ...
       </para>
 
+    </section>
+
+    <section id="comparison-operators">
+
+      <title>&title-comparison-operators;</title>
+
+      <indexterm type="function">
+        <primary>comparison operators</primary>
+      </indexterm>
+
+      <remark role="help-category" condition="Comparison operators@Functions"/>
+
+      <indexterm>
+        <primary>casts</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>type conversions</primary>
+      </indexterm>
+
+      <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
+        operations work for both numbers and strings. Strings are
+        automatically converted to numbers and numbers to strings as
+        necessary.
+      </para>
+
+      <para>
+        Some of the functions in this section (such as
+        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
+        return values other than <literal>1</literal>
+        (<literal>TRUE</literal>), <literal>0</literal>
+        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
+        the value they return is based on comparison operations
+        performed as described by the rules in
+        <xref linkend="type-conversion"/>.
+      </para>
+
+      <para>
+        To convert a value to a specific type for comparison purposes,
+        you can use the <literal>CAST()</literal> function. String
+        values can be converted to a different character set using
+        <literal>CONVERT()</literal>. See
+        <xref linkend="cast-functions"/>.
+      </para>
+
+      <para>
+        By default, string comparisons are not case sensitive and use
+        the current character set. The default is
+        <literal>latin1</literal> (cp1252 West European), which also
+        works well for English.
+      </para>
+
       <itemizedlist>
 
         <listitem>
@@ -3887,36 +3934,6 @@
       <remark role="help-category" condition="String Functions@Functions"/>
 
       <para>
-        MySQL automatically converts numbers to strings as necessary,
-        and vice versa.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 1+'1';</userinput>
-        -&gt; 2
-mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
-        -&gt; '2 test'
-</programlisting>
-
-      <para>
-        If you want to convert a number to a string explicitly, use the
-        <literal>CAST()</literal> or <literal>CONCAT()</literal>
-        function:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
-        -&gt; 38.8, '38.8'
-mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
-        -&gt; 38.8, '38.8'
-</programlisting>
-
-      <para>
-        <literal>CAST()</literal> is preferable, but it is unavailable
-        before MySQL 4.0.2.
-      </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. This affects only

Modified: trunk/refman-5.0/functions.xml
===================================================================
--- trunk/refman-5.0/functions.xml	2006-01-20 04:32:46 UTC (rev 942)
+++ trunk/refman-5.0/functions.xml	2006-01-20 04:33:02 UTC (rev 943)
@@ -189,45 +189,49 @@
 
     </section>
 
-    <section id="comparison-operators">
+    <section id="type-conversion">
 
-      <title>&title-comparison-operators;</title>
+      <title>&title-type-conversion;</title>
 
-      <indexterm type="function">
-        <primary>comparison operators</primary>
+      <indexterm>
+        <primary>type conversions</primary>
       </indexterm>
 
-      <remark role="help-category" condition="Comparison operators@Functions"/>
-
       <indexterm>
         <primary>casts</primary>
       </indexterm>
 
-      <indexterm>
-        <primary>type conversions</primary>
-      </indexterm>
-
       <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
-        operations work for both numbers and strings. Strings are
-        automatically converted to numbers and numbers to strings as
-        necessary.
+        When an operator is used with operands of different types, type
+        conversion occurs to make the operands compatible. Some
+        conversions occur implicitly. For example, MySQL automatically
+        converts numbers to strings as necessary, and vice versa.
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 1+'1';</userinput>
+        -&gt; 2
+mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
+        -&gt; '2 test'
+</programlisting>
+
       <para>
-        Some of the functions in this section (such as
-        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
-        return values other than <literal>1</literal>
-        (<literal>TRUE</literal>), <literal>0</literal>
-        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
-        the value they return is based on comparison operations
-        performed as described by the following rules.
+        It is also possible to perform explicit conversions. If you want
+        to convert a number to a string explicitly, use the
+        <literal>CAST()</literal> or <literal>CONCAT()</literal>
+        function (<literal>CAST()</literal> is preferable):
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
+        -&gt; 38.8, '38.8'
+mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
+        -&gt; 38.8, '38.8'
+</programlisting>
+
       <para>
-        MySQL compares values using the following rules:
+        The following rules describe how conversion occurs for
+        comparison operations:
       </para>
 
       <itemizedlist>
@@ -238,6 +242,8 @@
             result of the comparison is <literal>NULL</literal>, except
             for the <literal>NULL</literal>-safe
             <literal>&lt;=&gt;</literal> equality comparison operator.
+            For <literal>NULL &lt;=&gt; NULL</literal>, the result is
+            true.
           </para>
         </listitem>
 
@@ -277,8 +283,8 @@
             <literal>DATETIME</literal> column and the other argument is
             a constant, the constant is converted to a timestamp before
             the comparison is performed. This is done to be more
-            ODBC-friendly. Note that this is not done for arguments in
-            <literal>IN()</literal>! To be safe, always use complete
+            ODBC-friendly. Note that this is not done for the arguments
+            to <literal>IN()</literal>! To be safe, always use complete
             datetime/date/time strings when doing comparisons.
           </para>
         </listitem>
@@ -293,21 +299,6 @@
       </itemizedlist>
 
       <para>
-        By default, string comparisons are not case sensitive and use
-        the current character set. The default is
-        <literal>latin1</literal> (cp1252 West European), which also
-        works well for English).
-      </para>
-
-      <para>
-        To convert a value to a specific type for comparison purposes,
-        you can use the <literal>CAST()</literal> function. String
-        values can be converted to a different character set using
-        <literal>CONVERT()</literal>. See
-        <xref linkend="cast-functions"/>.
-      </para>
-
-      <para>
         The following examples illustrate conversion of strings to
         numbers for comparison operations:
       </para>
@@ -342,6 +333,61 @@
         <literal>'1a'</literal>, ...
       </para>
 
+    </section>
+
+    <section id="comparison-operators">
+
+      <title>&title-comparison-operators;</title>
+
+      <indexterm type="function">
+        <primary>comparison operators</primary>
+      </indexterm>
+
+      <remark role="help-category" condition="Comparison operators@Functions"/>
+
+      <indexterm>
+        <primary>casts</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>type conversions</primary>
+      </indexterm>
+
+      <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
+        operations work for both numbers and strings. Strings are
+        automatically converted to numbers and numbers to strings as
+        necessary.
+      </para>
+
+      <para>
+        Some of the functions in this section (such as
+        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
+        return values other than <literal>1</literal>
+        (<literal>TRUE</literal>), <literal>0</literal>
+        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
+        the value they return is based on comparison operations
+        performed as described by the rules in
+        <xref linkend="type-conversion"/>.
+      </para>
+
+      <para>
+        To convert a value to a specific type for comparison purposes,
+        you can use the <literal>CAST()</literal> function. String
+        values can be converted to a different character set using
+        <literal>CONVERT()</literal>. See
+        <xref linkend="cast-functions"/>.
+      </para>
+
+      <para>
+        By default, string comparisons are not case sensitive and use
+        the current character set. The default is
+        <literal>latin1</literal> (cp1252 West European), which also
+        works well for English.
+      </para>
+
       <itemizedlist>
 
         <listitem>
@@ -3953,35 +3999,6 @@
       <remark role="help-category" condition="String Functions@Functions"/>
 
       <para>
-        MySQL automatically converts numbers to strings as necessary,
-        and vice versa.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 1+'1';</userinput>
-        -&gt; 2
-mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
-        -&gt; '2 test'
-</programlisting>
-
-      <para>
-        If you want to convert a number to a string explicitly, use the
-        <literal>CAST()</literal> or <literal>CONCAT()</literal>
-        function:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
-        -&gt; 38.8, '38.8'
-mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
-        -&gt; 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. This affects only

Modified: trunk/refman-5.1/functions.xml
===================================================================
--- trunk/refman-5.1/functions.xml	2006-01-20 04:32:46 UTC (rev 942)
+++ trunk/refman-5.1/functions.xml	2006-01-20 04:33:02 UTC (rev 943)
@@ -188,45 +188,49 @@
 
     </section>
 
-    <section id="comparison-operators">
+    <section id="type-conversion">
 
-      <title>&title-comparison-operators;</title>
+      <title>&title-type-conversion;</title>
 
-      <indexterm type="function">
-        <primary>comparison operators</primary>
+      <indexterm>
+        <primary>type conversions</primary>
       </indexterm>
 
-      <remark role="help-category" condition="Comparison operators@Functions"/>
-
       <indexterm>
         <primary>casts</primary>
       </indexterm>
 
-      <indexterm>
-        <primary>type conversions</primary>
-      </indexterm>
-
       <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
-        operations work for both numbers and strings. Strings are
-        automatically converted to numbers and numbers to strings as
-        necessary.
+        When an operator is used with operands of different types, type
+        conversion occurs to make the operands compatible. Some
+        conversions occur implicitly. For example, MySQL automatically
+        converts numbers to strings as necessary, and vice versa.
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 1+'1';</userinput>
+        -&gt; 2
+mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
+        -&gt; '2 test'
+</programlisting>
+
       <para>
-        Some of the functions in this section (such as
-        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
-        return values other than <literal>1</literal>
-        (<literal>TRUE</literal>), <literal>0</literal>
-        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
-        the value they return is based on comparison operations
-        performed as described by the following rules.
+        It is also possible to perform explicit conversions. If you want
+        to convert a number to a string explicitly, use the
+        <literal>CAST()</literal> or <literal>CONCAT()</literal>
+        function (<literal>CAST()</literal> is preferable):
       </para>
 
+<programlisting>
+mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
+        -&gt; 38.8, '38.8'
+mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
+        -&gt; 38.8, '38.8'
+</programlisting>
+
       <para>
-        MySQL compares values using the following rules:
+        The following rules describe how conversion occurs for
+        comparison operations:
       </para>
 
       <itemizedlist>
@@ -237,6 +241,8 @@
             result of the comparison is <literal>NULL</literal>, except
             for the <literal>NULL</literal>-safe
             <literal>&lt;=&gt;</literal> equality comparison operator.
+            For <literal>NULL &lt;=&gt; NULL</literal>, the result is
+            true.
           </para>
         </listitem>
 
@@ -276,8 +282,8 @@
             <literal>DATETIME</literal> column and the other argument is
             a constant, the constant is converted to a timestamp before
             the comparison is performed. This is done to be more
-            ODBC-friendly. Note that this is not done for arguments in
-            <literal>IN()</literal>! To be safe, always use complete
+            ODBC-friendly. Note that this is not done for the arguments
+            to <literal>IN()</literal>! To be safe, always use complete
             datetime/date/time strings when doing comparisons.
           </para>
         </listitem>
@@ -292,21 +298,6 @@
       </itemizedlist>
 
       <para>
-        By default, string comparisons are not case sensitive and use
-        the current character set. The default is
-        <literal>latin1</literal> (cp1252 West European), which also
-        works well for English).
-      </para>
-
-      <para>
-        To convert a value to a specific type for comparison purposes,
-        you can use the <literal>CAST()</literal> function. String
-        values can be converted to a different character set using
-        <literal>CONVERT()</literal>. See
-        <xref linkend="cast-functions"/>.
-      </para>
-
-      <para>
         The following examples illustrate conversion of strings to
         numbers for comparison operations:
       </para>
@@ -341,6 +332,61 @@
         <literal>'1a'</literal>, ...
       </para>
 
+    </section>
+
+    <section id="comparison-operators">
+
+      <title>&title-comparison-operators;</title>
+
+      <indexterm type="function">
+        <primary>comparison operators</primary>
+      </indexterm>
+
+      <remark role="help-category" condition="Comparison operators@Functions"/>
+
+      <indexterm>
+        <primary>casts</primary>
+      </indexterm>
+
+      <indexterm>
+        <primary>type conversions</primary>
+      </indexterm>
+
+      <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
+        operations work for both numbers and strings. Strings are
+        automatically converted to numbers and numbers to strings as
+        necessary.
+      </para>
+
+      <para>
+        Some of the functions in this section (such as
+        <literal>LEAST()</literal> and <literal>GREATEST()</literal>)
+        return values other than <literal>1</literal>
+        (<literal>TRUE</literal>), <literal>0</literal>
+        (<literal>FALSE</literal>), or <literal>NULL</literal>. However,
+        the value they return is based on comparison operations
+        performed as described by the rules in
+        <xref linkend="type-conversion"/>.
+      </para>
+
+      <para>
+        To convert a value to a specific type for comparison purposes,
+        you can use the <literal>CAST()</literal> function. String
+        values can be converted to a different character set using
+        <literal>CONVERT()</literal>. See
+        <xref linkend="cast-functions"/>.
+      </para>
+
+      <para>
+        By default, string comparisons are not case sensitive and use
+        the current character set. The default is
+        <literal>latin1</literal> (cp1252 West European), which also
+        works well for English.
+      </para>
+
       <itemizedlist>
 
         <listitem>
@@ -3925,35 +3971,6 @@
       <remark role="help-category" condition="String Functions@Functions"/>
 
       <para>
-        MySQL automatically converts numbers to strings as necessary,
-        and vice versa.
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 1+'1';</userinput>
-        -&gt; 2
-mysql&gt; <userinput>SELECT CONCAT(2,' test');</userinput>
-        -&gt; '2 test'
-</programlisting>
-
-      <para>
-        If you want to convert a number to a string explicitly, use the
-        <literal>CAST()</literal> or <literal>CONCAT()</literal>
-        function:
-      </para>
-
-<programlisting>
-mysql&gt; <userinput>SELECT 38.8, CAST(38.8 AS CHAR);</userinput>
-        -&gt; 38.8, '38.8'
-mysql&gt; <userinput>SELECT 38.8, CONCAT(38.8);</userinput>
-        -&gt; 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. This affects only

Thread
svn commit - mysqldoc@docsrva: r943 - in trunk: . refman-4.1 refman-5.0 refman-5.1paul20 Jan