mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
487a64963b
character_set_results is now the same with character_set_client by default
59 lines
1.9 KiB
Text
59 lines
1.9 KiB
Text
select CAST(1-2 AS UNSIGNED);
|
|
CAST(1-2 AS UNSIGNED)
|
|
18446744073709551615
|
|
select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER);
|
|
CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER)
|
|
-1
|
|
select CONVERT('-1',UNSIGNED);
|
|
CONVERT('-1',UNSIGNED)
|
|
18446744073709551615
|
|
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
|
|
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
|
|
18446744073709551611 18446744073709551611
|
|
select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
|
|
cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1
|
|
18446744073709551610 18446744073709551612
|
|
select ~5, cast(~5 as signed);
|
|
~5 cast(~5 as signed)
|
|
18446744073709551610 -6
|
|
select cast(5 as unsigned) -6.0;
|
|
cast(5 as unsigned) -6.0
|
|
-1.0
|
|
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
|
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
|
|
0 1
|
|
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
|
|
cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME)
|
|
2001-01-01 2001-01-01 00:00:00
|
|
select cast("1:2:3" as TIME);
|
|
cast("1:2:3" as TIME)
|
|
01:02:03
|
|
set names binary;
|
|
select cast(_latin1'test' as char character set latin2);
|
|
cast(_latin1'test' as char character set latin2)
|
|
test
|
|
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
|
|
cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
|
|
òåñò
|
|
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`t` char(4) character set cp1251 NOT NULL default ''
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
drop table t1;
|
|
select cast("2001-1-1" as date) = "2001-01-01";
|
|
cast("2001-1-1" as date) = "2001-01-01"
|
|
0
|
|
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
|
|
cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
|
|
0
|
|
select cast("1:2:3" as TIME) = "1:02:03";
|
|
cast("1:2:3" as TIME) = "1:02:03"
|
|
0
|
|
select cast(NULL as DATE);
|
|
cast(NULL as DATE)
|
|
NULL
|
|
select cast(NULL as BINARY);
|
|
cast(NULL as BINARY)
|
|
NULL
|