~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

This patch completes the first step in the splitting of
the XA resource manager API from the storage engine API,
as outlined in the specification here:

http://drizzle.org/wiki/XaStorageEngine

* Splits plugin::StorageEngine into a base StorageEngine
  class and two derived classes, TransactionalStorageEngine
  and XaStorageEngine.  XaStorageEngine derives from
  TransactionalStorageEngine and creates the XA Resource
  Manager API for storage engines.

  - The methods moved from StorageEngine to TransactionalStorageEngine
    include releaseTemporaryLatches(), startConsistentSnapshot(), 
    commit(), rollback(), setSavepoint(), releaseSavepoint(),
    rollbackToSavepoint() and hasTwoPhaseCommit()
  - The methods moved from StorageEngine to XaStorageEngine
    include recover(), commitXid(), rollbackXid(), and prepare()

* Places all static "EngineVector"s into their proper
  namespaces (typedefs belong in header files, not implementation files)
  and places all static methods corresponding
  to either only transactional engines or only XA engines
  into their respective files in /drizzled/plugin/

* Modifies the InnoDB "handler" files to extend plugin::XaStorageEngine
  and not plugin::StorageEngine

The next step, as outlined in the wiki spec page above, is to isolate
the XA Resource Manager API into its own plugin class and modify
plugin::XaStorageEngine to implement plugin::XaResourceManager via
composition.  This is necessary to enable building plugins which can
participate in an XA transaction *without having to have that plugin
implement the entire storage engine API*

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