~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Olaf van der Spek
  • Date: 2011-10-17 23:13:25 UTC
  • mto: This revision was merged to the branch mainline in revision 2443.
  • Revision ID: olafvdspek@gmail.com-20111017231325-zv1nubl0jzwwn1sp
Use str_ref

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Length and Size Functions
2
2
=========================
3
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
 
.. code-block:: mysql
10
 
 
11
 
        SELECT BIT_LENGTH('a');
12
 
 
13
 
Returns 8
 
4
.. _char-length-function:
14
5
 
15
6
CHAR_LENGTH
16
7
-----------
22
13
 
23
14
This function is same as CHAR_LENGTH().
24
15
 
25
 
 
26
 
LENGTH()
27
 
--------
 
16
.. _character-length-function:
 
17
 
 
18
CHARACTER_LENGTH
 
19
----------------
 
20
 
 
21
Synonym for CHAR_LENGTH.
 
22
 
 
23
.. _length-function:
 
24
 
 
25
LENGTH
 
26
------
28
27
 
29
28
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:
30
29
 
31
30
.. code-block:: mysql
32
31
 
33
 
        select length(_utf8 '€');
 
32
        select length('€');
34
33
 
35
34
Returns 3
36
35
 
37
36
The is because the Euro sign is encoded as 0xE282AC in UTF-8 and thereby occupies 3 bytes.
38
37
 
39
 
OCTET_LENGTH()
40
 
---------------
41
 
 
42
 
A synonym for LENGTH()
 
38
.. _octet-length-function:
 
39
 
 
40
OCTET_LENGTH
 
41
-------------
 
42
 
 
43
A synonym for LENGTH().