~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/functions/string/length.rst

  • Committer: Lee Bieber
  • Date: 2011-02-16 23:33:54 UTC
  • mfrom: (1994.4.76 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2174.
  • Revision ID: kalebral@gmail.com-20110216233354-qc8rcc4uoq4h0uqr
Merge Marisa - 716062 - fix ubuntu install doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Length and Size Functions
 
2
=========================
 
3
 
 
4
BIT_LENGTH
 
5
----------
 
6

The BIT_LENGTH(str) function return the String str length in bits. Here are the some example of the BIT_LENGTH(str) function:
     
 
7
For example: ::
 
8
 
 
9
        SELECT BIT_LENGTH('a');
 
10
 
 
11
Returns 8
 
12
 
 
13
CHAR_LENGTH
 
14
-----------
 
15

The CHAR_LENGTH(str) function returns string length measured in characters. 
 
16
 
 
17
A multi-byte character counts as single character such as a string contains 5 two-byte characters, then LENGTH() function returns 10, but the CHAR_LENGTH() returns 5. ::
       
 
18
        CHARACTER_LENGTH(str)

 
19
This function is same as CHAR_LENGTH(). 
 
20
 
 
21
 
 
22
LENGTH()
 
23
--------
 
24
 
 
25
The LENGTH function returns the length of the string argument in bytes. A multi-byte character counts as multiple bytes. This means that for a string containing a three-byte character, LENGTH() returns 3, whereas CHAR_LENGTH() returns 1. For example: ::
 
26
 
 
27
        select length(_utf8 '€');
 
28
 
 
29
Returns 3
 
30
 
 
31
The is because the Euro sign is encoded as 0xE282AC in UTF-8 and thereby occupies 3 bytes.
 
32
 
 
33
 
 
34
OCTET_LENGTH()            
 
35
---------------
 
36
 
 
37
A synonym for LENGTH()