~hingo/drizzle/drizzle-fix-make-clean-for-docs

« back to all changes in this revision

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

  • Committer: Mark Atwood
  • Date: 2011-09-13 19:54:55 UTC
  • mfrom: (2397.1.3 plugin-docs)
  • Revision ID: me@mark.atwood.name-20110913195455-3bk3locm85m4jimp
merge lp:~daniel-nichter/drizzle/plugin-docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Conversion Functions
2
2
====================
3
3
 
 
4
.. _ascii-function:
 
5
 
4
6
ASCII
5
7
-----
6
 

The ASCII(str) function returns the numeric value of the leftmost character of the string ’str’. It returns NULL if str is NULL. It works for 8-bit characters.
 
8
 
 
9
The ASCII(str) function returns the numeric value of the leftmost character of the string ’str’. It returns NULL if str is NULL. It works for 8-bit characters.
7
10
 
8
11
For example:
9
12
 
19
22
 
20
23
Returns 100
21
24
 
 
25
.. _bin-function:
22
26
 
23
27
BIN
24
28
---
25
 

The BIN string function returns a string value that represents the binary value of N, where N is a longlong(BIGINT) number. This function is equivalent to CONV(N, 10 , 0). If the function return the null then N is null. 
 
29
 
 
30
The BIN string function returns a string value that represents the binary value of N, where N is a longlong(BIGINT) number. This function is equivalent to CONV(N, 10 , 0). If the function return the null then N is null. 
26
31
 
27
32
Syntax:
28
33
 
37
42
Returns: '1100'
38
43
 
39
44
 
 
45
.. _char-function:
 
46
 
40
47
CHAR
41
48
----
42
 

SQL CHAR function is the opposite of the ASCII function. It converts an integer in range 0-255 into a ASCII character. It returns a string (the character), given the integer value. This function skips NULL values.   

 
49
 
 
50
SQL CHAR function is the opposite of the ASCII function. It converts an integer in range 0-255 into a ASCII character. It returns a string (the character), given the integer value. This function skips NULL values.   

43
51
For example:
44
52
 
45
53
.. code-block:: mysql
48
56
 
49
57
Returns "A"

50
58
 
51
 
HEX()
52
 
-----
 
59
.. _hex-function:
 
60
 
 
61
HEX
 
62
---
53
63
 
54
64
This string function returns the hexadecimal (base-16) representation of a string or decicmal argument. Each character in the string argument is converted to two hexadecimal digits. If the argument is numeric, HEX() returns a hexadecimal string representation of the value as a BIGINT number.
55
65
 
71
81
 
72
82
(To better understand this output, you can use an :doc:`../../resources/ascii_chart` that includes both Hexadecimal and character values.)
73
83
 
 
84
.. _unhex-function:
74
85
 
75
 
UNHEX()
76
 
-------
 
86
UNHEX
 
87
-----
77
88
 
78
89
UNHEX converts each pair of hexadecimal digits to a character. For a string argument, UNHEX() is the inverse operation of HEX(str).
79
90
 
105
116
 
106
117
Returns NULL
107
118
 
108
 
 
109
 
LOWER()                   
110
 
Return the argument in lowercase
111
 
 
112
 
 
113
 
LCASE()                   
114
 
Synonym for LOWER()
115
 
 
116
 
 
117
 
UCASE()
 
119
.. _lower-function:
 
120
 
 
121
LOWER
 
122
-----
 
123
 
 
124
Return the argument in lowercase.
 
125
 
 
126
.. _lcase-function:
 
127
 
 
128
LCASE
 
129
-----
 
130
 
 
131
Synonym for LOWER().
 
132
 
 
133
.. _ucase-function:
 
134
 
 
135
UCASE
 
136
-----
 
137
 
118
138
Synonym for UPPER()
119
139
 
120
 
 
121
 
UPPER()                   
122
 
Convert to uppercase
 
140
.. _upper-function:
 
141
 
 
142
UPPER
 
143
-----
 
144
 
 
145
Convert to uppercase.