~drizzle-trunk/drizzle/development

1994.4.59 by Marisa Plumb
new string function docs
1
String Modification Functions
2
=============================
3
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
4
.. _concat-function:
5
1994.4.59 by Marisa Plumb
new string function docs
6
CONCAT
7
------
8
9
The SQL standard defines a concatenation operator ( || ), which joins two or more strings into one string value.
2194.5.2 by Andrew Hutchings
Fix SQL markup
10
The CONCAT(str1, str2...) function can have one or more arguments. It returns a string that is the result of concatenating the arguments.
1994.4.59 by Marisa Plumb
new string function docs
11
12
* If arguments are non-binary strings, the result is also a non-binary string.
13
* If any argument is a binary string, then the result will also be a binary string. 
14
* Numeric arguments are converted to their equivalent in binary string format. 
15
* If any argument is NULL then it also returns NULL. 
16
17
Syntax:
18
2194.5.2 by Andrew Hutchings
Fix SQL markup
19
CONCAT(str1, str2, [,...n])
20
For example:
21
22
.. code-block:: mysql
23
1994.4.59 by Marisa Plumb
new string function docs
24
	SELECT CONCAT('Dr', 'izzl', 'ed');
25
2194.5.2 by Andrew Hutchings
Fix SQL markup
26
Returns: 'Drizzled'
27
28
.. code-block:: mysql
1994.4.59 by Marisa Plumb
new string function docs
29
30
	SELECT CONCAT('micro', NULL, 'nel');
31
2194.5.2 by Andrew Hutchings
Fix SQL markup
32
Returns: NULL
33
34
.. code-block:: mysql
1994.4.59 by Marisa Plumb
new string function docs
35
36
	SELECT CONCAT(14.8);
37
38
Returns: '14.8'
39
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
40
.. _concat-ws-function:
41
1994.4.59 by Marisa Plumb
new string function docs
42
CONCAT_WS
2194.5.2 by Andrew Hutchings
Fix SQL markup
43
---------
44
CONCAT WS (With Separator) [1]_ allows you to specify that the first argument is treated as a separator for the rest of the arguments. This argument is added between the strings to be concatenated.
1994.4.59 by Marisa Plumb
new string function docs
45
46
Syntax:
47
2194.5.2 by Andrew Hutchings
Fix SQL markup
48
CONCAT_WS(separator str1, str2,....)
49
50
For example:
51
52
.. code-block:: mysql
53
1994.4.59 by Marisa Plumb
new string function docs
54
	SELECT CONCAT_WS(',', ' Occupation', 'First name', 'Last Name');
55
56
Returns: 'Occupation, First name, Last Name'
57
2194.5.2 by Andrew Hutchings
Fix SQL markup
58
.. code-block:: mysql
59
1994.4.59 by Marisa Plumb
new string function docs
60
	SELECT CONCAT_WS(',', 'First name', NULL, 'Last Name');
61
62
Returns: 'First name, Last Name'
63
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
64
.. _trim-function:
1994.4.59 by Marisa Plumb
new string function docs
65
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
66
TRIM
67
----
1994.4.59 by Marisa Plumb
new string function docs
68
1994.4.65 by Marisa Plumb
strings!
69
The TRIM function remove specified prefixes or suffixes from a string (typically leading and trailing spaces), and returns the resulting string. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed.
70
71
Syntax:
72
73
TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str), TRIM([remstr FROM] str)
74
75
[remstr] is optional (if it's not specified, spaces are removed).
1994.4.59 by Marisa Plumb
new string function docs
76
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
77
.. _ltrim-function:
78
79
LTRIM
80
-----
1994.4.64 by Marisa Plumb
more string
81
1994.4.65 by Marisa Plumb
strings!
82
This version of the TRIM function removes leading spaces from the beginning of a string.
1994.4.64 by Marisa Plumb
more string
83
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
84
.. _rtrim-function:
1994.4.64 by Marisa Plumb
more string
85
2397.1.1 by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins.
86
RTRIM
87
-----
1994.4.64 by Marisa Plumb
more string
88
1994.4.65 by Marisa Plumb
strings!
89
This version of the TRIM function removes trailing spaces from the end of a function. 
1994.4.59 by Marisa Plumb
new string function docs
90
2194.5.2 by Andrew Hutchings
Fix SQL markup
91
.. rubric:: Footnotes
92
93
.. [1] If the separator is NULL then the result is NULL.