db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r601910 - in /db/derby/docs/trunk/src: devguide/cdevcollation.dita ref/rrefsqlj23075.dita
Date Thu, 06 Dec 2007 23:23:53 GMT
Author: myrnavl
Date: Thu Dec  6 15:23:52 2007
New Revision: 601910

URL: http://svn.apache.org/viewvc?rev=601910&view=rev
Log:
DERBY-3166 - update docs to address improvements to LIKE code of DERBY-2967.
  Patch by Laura Stewart

Modified:
    db/derby/docs/trunk/src/devguide/cdevcollation.dita
    db/derby/docs/trunk/src/ref/rrefsqlj23075.dita

Modified: db/derby/docs/trunk/src/devguide/cdevcollation.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/devguide/cdevcollation.dita?rev=601910&r1=601909&r2=601910&view=diff
==============================================================================
--- db/derby/docs/trunk/src/devguide/cdevcollation.dita (original)
+++ db/derby/docs/trunk/src/devguide/cdevcollation.dita Thu Dec  6 15:23:52 2007
@@ -41,21 +41,34 @@
 rule is based on the binary Unicode values of the characters. So a character
 is greater than (<), equal to (=), or less than (>) another character based
 on the numeric comparison of the Unicode values. This rule allows for very
-efficient comparisons of character strings.</p><p><ph conref="../conrefs.dita#prod/productshortname"></ph>
also
+efficient comparisons of character strings.</p><note>When LIKE comparisons
+are used, <ph conref="../conrefs.dita#prod/productshortname"></ph> compares
+one character at a time for non-metacharacters. This is different than the
+way <ph conref="../conrefs.dita#prod/productshortname"></ph> processes = comparisons.
+The comparisons with the = operator compare the entire character string on
+left side of the = operator with the entire character string on the right
+side of the = operator. See the <xref href="#cdevcollation/territorylike"></xref>
section
+below.</note></section>
+<section><title>Territory-based collation</title><p><ph conref="../conrefs.dita#prod/productshortname"></ph>
also
 supports the ability to define collation rules that are appropriate to a territory,
-and is referred to as <i><term>territory-based collation</term></i>.
 You
-can specifically set the territory of a database when you create the database.
-If you do not specify a territory, <ph conref="../conrefs.dita#prod/productshortname"></ph>
uses
+and is referred to as <i><term>territory-based collation</term></i>.
 <ph
+conref="../conrefs.dita#prod/productshortname"></ph> supports the territories
+that Java supports.</p><p>You can specifically set the territory of a database
+when you create the database. If you do not specify a territory, <ph conref="../conrefs.dita#prod/productshortname"></ph>
uses
 the default territory of the JVM in which the database is created. Each JVM
 can support many territories that are independent from the default territory
 for the JVM. Collation support for these additional territories is provided
-through the<codeph> java.text.RuleBasedCollator</codeph> class and the set
+through the <codeph>java.text.RuleBasedCollator</codeph> class and the set
 of rules for these territories. Refer to the JVM specification for details
 of how these rules are used to provide territory specific collation. <ph conref="../conrefs.dita#prod/productshortname"></ph>
currently
 supports only running those rules that can be loaded dynamically from the
 running JVM based on the territory attribute. Overrides to these rules by
-the user are not supported. </p><p>Territory-based collation does add extra
-processing overhead to all character-based comparison operations.</p><p>When
+the user are not supported. </p><p>The territory-based collation in <ph conref="../conrefs.dita#prod/productshortname"></ph>
affects
+how the CHAR and VARCHAR data types are compared. Specifying territory-based
+collation also impacts how the LIKE Boolean operator processes CHAR, VARCHAR,
+CLOB, and LONG VARCHAR data. </p><p>Territory-based collation does add extra
+processing overhead to all character-based comparison operations.</p></section>
+<section><title>Database attributes that control collation</title><p>When
 you create a <ph conref="../conrefs.dita#prod/productshortname"></ph> database,
 the attributes that you set determine the collation that is used with all
 of character data in the database. For example: <table><title>The create database
@@ -89,11 +102,7 @@
 </row>
 </tbody>
 </tgroup>
-</table></p><p>The territory-based collation in <ph conref="../conrefs.dita#prod/productshortname"></ph>
affects
-how the CHAR and VARCHAR data types are compared. Specifying territory-based
-collation also impacts how the LIKE Boolean operator processes CHAR, VARCHAR,
-CLOB, and LONG VARCHAR data. <ph conref="../conrefs.dita#prod/productshortname"></ph>
supports
-the territories that Java supports.</p></section>
+</table></p></section>
 <section><title>Collation examples</title><p>With Unicode codepoint
collation
 (UCS_BASIC), the numerical values of the Unicode encoding of the characters
 is used directly for ordering. For example, the FRUIT table contains the NAME
@@ -126,5 +135,23 @@
                 Grape                                Grape
                 Pineapple                           orange
                                                          Pineapple</lines></p>
</section>
+<section id="territorylike"><title>Differences between LIKE and equal (=)
+comparisons</title><p>When you use territory-based collation, the comparisons
+can <?Pub Caret?>return different results when you use the LIKE and equal
+(=) operators. For example, suppose that the <ph conref="../conrefs.dita#prod/productshortname"></ph>
database
+is set to use a territory where the character 'z' has same collation elements
+as 'xy'. Consider the following two WHERE clauses: <ol>
+<li>WHERE 'zcb' = 'xycb'</li>
+<li>WHERE 'zcb' LIKE 'xy_b</li>
+</ol></p><p>For WHERE clause 1, <ph conref="../conrefs.dita#prod/productshortname"></ph>
returns
+TRUE because the collation elements for the entire string 'zcb' will match
+the collation elements of the entire string 'xycb'.  </p><p>For WHERE clause
+2, <ph conref="../conrefs.dita#prod/productshortname"></ph> returns FALSE
+because collation element for character 'z' does not match the collation element
+for character 'x'. In addition, when metacharacter such as an underscore is
+used with the LIKE operator, the metacharacter counts for one character in
+the string value. A clause like WHERE 'xycb' LIKE '_cb' returns FALSE because
+'x' is compared to the metacharacter _ and 'y' does not match 'c'.</p></section>
 </conbody>
 </concept>
+<?Pub *0000009279?>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj23075.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj23075.dita?rev=601910&r1=601909&r2=601910&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj23075.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj23075.dita Thu Dec  6 15:23:52 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
- 
+
 <!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
  "../dtd/reference.dtd">
 <!-- 
@@ -22,7 +22,14 @@
 <title>Boolean expressions</title>
 <prolog><metadata>
 <keywords><indexterm>Boolean expressions</indexterm><indexterm>Boolean
operators<indexterm>part
-of WHERE clause</indexterm></indexterm></keywords>
+of WHERE clause</indexterm></indexterm><indexterm>AND boolean operator</indexterm>
+<indexterm>OR boolean operator</indexterm><indexterm>NOT boolean operator</indexterm>
+<indexterm>Comparison boolean operators</indexterm><indexterm>IS NULL boolean
+operator</indexterm><indexterm>IS NOT NULL boolean operator</indexterm><indexterm>LIKE
+boolean operator</indexterm><indexterm>LIKE<indexterm>escape character
for</indexterm></indexterm>
+<indexterm>BETWEEN boolean operator</indexterm><indexterm>IN boolean operator</indexterm>
+<indexterm>EXISTS boolean operator</indexterm><indexterm>Quantified comparison
+boolean operator</indexterm></keywords>
 </metadata></prolog>
 <refbody>
 <section><p>Boolean expressions are allowed in WHERE clauses and in check
@@ -35,7 +42,7 @@
 These are listed in <xref href="rrefsqlj23075.dita#rrefsqlj23075/sqlj34517"></xref>.
   <table frame="all" id="sqlj34517" pgwide="1"><title>SQL Boolean Operators</title>
 <tgroup cols="3" colsep="1" rowsep="1"><colspec colname="1" colnum="1" colwidth="24*"/>
-<colspec colname="2" colnum="2" colwidth="46*"/><colspec colname="3" colnum="3"
+<colspec colname="2" colnum="2" colwidth="45*"/><colspec colname="3" colnum="3"
 colwidth="30*"/>
 <thead>
 <row>
@@ -46,9 +53,7 @@
 </thead>
 <tbody>
 <row>
-<entry colname="1"><indexterm>AND boolean operator</indexterm><indexterm>OR
-boolean operator</indexterm><indexterm>NOT boolean operator</indexterm>AND,
-OR, NOT</entry>
+<entry colname="1">AND, OR, NOT</entry>
 <entry colname="2">Evaluate any operand(s) that are boolean expressions   <codeblock><b>(orig_airport
= 'SFO') OR
     (dest_airport = 'GRU')
 <ph>    -- returns true</ph></b></codeblock></entry>
@@ -61,7 +66,7 @@
 }</b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">Comparisons<indexterm>Comparison boolean operators</indexterm>
</entry>
+<entry colname="1">Comparisons </entry>
 <entry colname="2">&lt;, =, &gt;, &lt;=, &gt;=, &lt;&gt; are
applicable to
 all of the built-in types.   <codeblock><b>DATE('1998-02-26') &lt;
     DATE('1998-03-01')
@@ -78,16 +83,14 @@
 <b><i>Expression</i></b></b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">IS NULL, IS NOT NULL<indexterm>IS NULL boolean operator</indexterm><indexterm>IS
-NOT NULL boolean operator</indexterm></entry>
+<entry colname="1">IS NULL, IS NOT NULL</entry>
 <entry colname="2">Test whether the result of an expression is null or not.
   <codeblock><b>WHERE MiddleName IS NULL</b></codeblock></entry>
 <entry colname="3"> <codeblock><b><b><i>Expression</i></b>
IS [ NOT ]
   NULL</b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">LIKE<indexterm>LIKE boolean operator</indexterm><indexterm>LIKE<indexterm>escape
-character for</indexterm></indexterm></entry>
+<entry colname="1">LIKE</entry>
 <entry colname="2">Attempts to match a character expression to a character
 pattern, which is a character string that includes one or more wildcards.
   <p>% matches any number (zero or more) of characters in the corresponding
@@ -97,7 +100,14 @@
 character expression.   <codeblock><b>city LIKE 'Sant_'</b></codeblock></p>
 <p>To
 treat % or _ as constant characters, escape the character with an optional
 escape character, which you specify with the ESCAPE clause.   <codeblock><b>SELECT
a FROM tabA WHERE a 
-LIKE '%=_' ESCAPE '='</b></codeblock></p></entry>
+LIKE '%=_' ESCAPE '='</b></codeblock></p><note>When LIKE comparisons
are used,<?Pub Caret?><ph
+conref="../conrefs.dita#prod/productshortname"></ph> compares one character
+at a time for non-metacharacters. This is different than the way <ph conref="../conrefs.dita#prod/productshortname"></ph>
processes
+= comparisons. The comparisons with the = operator compare the entire character
+string on left side of the = operator with the entire character string on
+the right side of the = operator. For more information, see <b>Character-based
+collation in <ph conref="../conrefs.dita#prod/productshortname"></ph></b>
in
+the <ph conref="../conrefs.dita#pub/citdevelop"></ph>.</note></entry>
 <entry colname="3"> <codeblock><b><b><i>CharacterExpression</i></b>
   [ NOT ] LIKE
 <b><i>  CharacterExpression
@@ -107,7 +117,7 @@
 '<b><i>escapeCharacter</i></b>']</b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">BETWEEN<indexterm>BETWEEN boolean operator</indexterm></entry>
+<entry colname="1">BETWEEN</entry>
 <entry colname="2">Tests whether the first operand is between the second and
 third operands. The second operand must be less than the third operand. Applicable
 only to types to which &lt;= and &gt;= can be applied.   <codeblock><b>WHERE
booking_date BETWEEN
@@ -118,7 +128,7 @@
   AND <b><i>Expression</i></b></b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">IN<indexterm>IN boolean operator</indexterm></entry>
+<entry colname="1">IN</entry>
 <entry colname="2">Operates on table subquery or list of values. Returns TRUE
 if the left expression's value is in the result of the table subquery or in
 the list of values. Table subquery can return multiple rows but must return
@@ -135,7 +145,7 @@
 }</b></codeblock></entry>
 </row>
 <row>
-<entry colname="1">EXISTS<indexterm>EXISTS boolean operator</indexterm></entry>
+<entry colname="1">EXISTS</entry>
 <entry colname="2">Operates on a table subquery. Returns TRUE if the table
 subquery returns any rows, and FALSE if it returns no rows. Table subquery
 can return multiple columns (only if you use * to denote multiple columns)
@@ -148,8 +158,7 @@
 ></entry>
 </row>
 <row>
-<entry colname="1">Quantified comparison<indexterm>Quantified comparison boolean
-operator</indexterm></entry>
+<entry colname="1">Quantified comparison</entry>
 <entry colname="2">A quantified comparison is a comparison operator (&lt;,
 =, &gt;, &lt;=, &gt;=, &lt;&gt;) with ALL or ANY or SOME applied.   <p>Operates
 on table subqueries, which can return multiple rows but must return a single
@@ -172,3 +181,4 @@
 </table></p></section>
 </refbody>
 </reference>
+<?Pub *0000008541?>



Mime
View raw message