Browse Prior Art Database

User Defined Collation Sequences

IP.com Disclosure Number: IPCOM000121699D
Original Publication Date: 1991-Sep-01
Included in the Prior Art Database: 2005-Apr-03
Document File: 5 page(s) / 142K

Publishing Venue

IBM

Related People

Boykin, JR: AUTHOR [+2]

Abstract

FUNCTIONAL SUMMARY When creating a database, system administrators will be able to optionally specify collating sequences other than the default provided by the operating system.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 35% of the total text.

User Defined Collation Sequences

      FUNCTIONAL SUMMARY When creating a database, system
administrators will be able to optionally specify collating sequences
other than the default provided by the operating system.

      A collating sequence is a set of weights associated with each
character in the code page of the database.  When characters are
compared, the values of these weights determine the result of the
comparison.  For example, if the character 'A' has a weight of 65,
and the character 'a' has a weight of 97, 'a' > 'A'.  On the other
hand, if the character 'A' has a weight of 193, and the character 'a'
has a weight of 129, 'a' < 'A'.

      Weights need not be unique.  If two characters have the same
weight, they are considered equal.

      The OS/2* operating system typically provides a set of
non-unique weights.  For example, lowercase and uppercase versions of
the same character usually have the same weight. To force strings
that differ only by case to always sort in the same order, Database
Manager performs a two-pass string comparison.  First, the strings
are compared according to the operating system weights.  Then, if the
strings are equal, they are compared again using the underlying
numeric value of each character (that is, the number which is used
internally to represent the character in the current code page).
Using such a procedure, 'A' < 'a', but 'AC' > 'ab'.

      With the new facility, users will be able to specify unique or
non-unique collating sequences during CREATE DATABASE.  The specified
sequence will be used for all character comparisons for that
database, and will determine the order of strings in indexes and
sorts.  Users who desire a DB2-like sort order can specify a
collating sequence weighted according to the appropriate EBCDIC code
page. Several sample collating sequences will be provided for
usability.

      Only single-byte code pages are affected by this option.
Double- byte characters will continue to be compared solely on the
basis of underlying numeric value.

      SPECIFIC IMPLEMENTATION: A database description block is passed
to the database engine at CREATE DATABASE time.  The main entry in
this block is a pointer to a sequence of 256 bytes.  The nth byte
contains the sort weight of the code point whose underlying decimal
representation is n in the code page of the database.  Under certain
circumstances this field is ignored, and a default collating sequence
provided by the operating system is used.
EXAMPLES
C

      Create a database called DB2TEST which sorts and compares
character strings according to an EBCDIC collating sequence.
      #include <sqlca.h>
      #include <sqlenv.h>
      #include <sqlecsuu.h>
      struct sqledbdesc dbdesc;
      dbdesc.control    =  1;
      dbdesc.num_bytes  = 16;
      dbdesc.cs_source  = -1;
      dbdesc.cs_ptr     = sqle_437_037;
      rc = sqlecred ("D...