~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2011-01-05 19:01:18 UTC
  • mfrom: (2053.2.3 trunk-bug-696188)
  • Revision ID: kalebral@gmail.com-20110105190118-kiq5sez67rvi4kl7
Merge Andrew - fix bug 696188: error handling for drizzle client stdin replacement problems

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()