You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.9 KiB
53 lines
1.9 KiB
# Test of function LPAD(str, len, padstr)
|
|
|
|
--echo # The function should return NULL if any of its arguments are NULL.
|
|
SELECT LPAD(NULL, 5, 'x') AS result;
|
|
SELECT LPAD(NULL, NULL, 'x') AS result;
|
|
SELECT LPAD(NULL, NULL, NULL) AS result;
|
|
SELECT LPAD('a', NULL, 'x') AS result;
|
|
SELECT LPAD('a', NULL, NULL) AS result;
|
|
SELECT LPAD('a', 5, NULL) AS result;
|
|
SELECT LPAD(NULL, 5, NULL) AS result;
|
|
|
|
--echo # The function should return an empty string if len is 0.
|
|
SELECT LPAD('a', 0, 'x') AS result;
|
|
SELECT LPAD('a', 0, '') AS result;
|
|
SELECT LPAD('', 0, 'x') AS result;
|
|
SELECT LPAD('', 0, '') AS result;
|
|
|
|
--echo # The function should return NULL if len is negative.
|
|
SELECT LPAD('a', -1, 'x');
|
|
--echo # Min signed long long int:
|
|
SELECT LPAD('a', -9223372036854775808, 'x');
|
|
--echo # Min signed long long int - 1
|
|
SELECT LPAD('a', -9223372036854775809, 'x');
|
|
|
|
--echo # The function should return NULL with a warning if len is larger than
|
|
--echo # max_allowed_packet.
|
|
--echo # Max signed long long int:
|
|
SELECT LPAD('a', 9223372036854775807, 'x');
|
|
--echo # Max signed long long int + 1:
|
|
SELECT LPAD('a', 9223372036854775808, 'x');
|
|
--echo # Max unsigned long long int:
|
|
SELECT LPAD('a', 18446744073709551615, 'x');
|
|
--echo # Max unsigned long long int + 1:
|
|
SELECT LPAD('a', 18446744073709551616, 'x');
|
|
|
|
--echo # The function should return an empty string if padstr is empty.
|
|
SELECT LPAD('a', 5, '') AS result;
|
|
SELECT LPAD('a', 5, '') AS result;
|
|
|
|
--echo # The function should do nothing if str is of length len.
|
|
SELECT LPAD('12345', 5, 'x');
|
|
|
|
--echo # The function should chop the string if len is shorter than the length
|
|
--echo # of str.
|
|
SELECT LPAD('123456787890', 1, 'x');
|
|
SELECT LPAD('123456787890', 5, 'x');
|
|
|
|
--echo # The function should left pad with padstr so that the string is len
|
|
--echo # bytes long if str is shorter than len.
|
|
SELECT LPAD('123', 5, 'x');
|
|
|
|
--echo # The function should repeat padstr also if it has mulitplie characters.
|
|
SELECT LPAD('a', 5, 'xy');
|
|
|