Actually there are hex literals, but they are of type blob and don't convert to 
numeric. So if you were wishing for an equivalent to the C declaration "int c = 
0xff;" you are out of luck.

See requirement R-16625-30785-18660-34070-49109-22249-51329-26220

CREATE TABLE t1( t TEXT, -- text affinity by rule 2 nu NUMERIC, -- numeric 
affinity by rule 5 i INTEGER, -- integer affinity by rule 1 r REAL, -- real 
affinity by rule 4 no BLOB -- no affinity by rule 3 ); -- Values stored as 
TEXT, INTEGER, INTEGER, REAL, TEXT. INSERT INTO t1 VALUES('500.0', '500.0', 
'500.0', '500.0', '500.0'); SELECT typeof(t), typeof(nu), typeof(i), typeof(r), 
typeof(no) FROM t1; text|integer|integer|real|text -- Values stored as TEXT, 
INTEGER, INTEGER, REAL, REAL. DELETE FROM t1; INSERT INTO t1 VALUES(500.0, 
500.0, 500.0, 500.0, 500.0); SELECT typeof(t), typeof(nu), typeof(i), 
typeof(r), typeof(no) FROM t1; text|integer|integer|real|real -- Values stored 
as TEXT, INTEGER, INTEGER, REAL, INTEGER. DELETE FROM t1; INSERT INTO t1 
VALUES(500, 500, 500, 500, 500); SELECT typeof(t), typeof(nu), typeof(i), 
typeof(r), typeof(no) FROM t1; text|integer|integer|real|integer -- BLOBs are 
always stored as BLOBs regardless of column affinity. DELETE FROM t1; INSERT 
INTO t1 VALUES(x'0500', x'0500', x'0500', x'0500', x'0500'); SELECT typeof(t), 
typeof(nu), typeof(i), typeof(r), typeof(no) FROM t1; blob|blob|blob|blob|blob 
-- NULLs are also unaffected by affinity DELETE FROM t1; INSERT INTO t1 
VALUES(NULL,NULL,NULL,NULL,NULL); SELECT typeof(t), typeof(nu), typeof(i), 
typeof(r), typeof(no) FROM t1; null|null|null|null|null (source datatype3.html)


create temp table x (a text, b real, c integer default x'ff');
insert into x (a,b) values ('test',1.0);
rows inserted
-------------
1
select a,b,hex(c) from x;
a      b  hex(c)
-----  -  ------
test   1  FF

-----Ursprüngliche Nachricht-----
Von: Igor Tandetnik [mailto:i...@tandetnik.org]
Gesendet: Dienstag, 29. Oktober 2013 13:18
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] Hex value with DEFAULT Constraint

On 10/29/2013 8:09 AM, techi eth wrote:
> Is it possible to attach hex value with DEFAULT constraint?

There are no hex literals in SQLite, whether for use with DEFAULT constraint or 
otherwise. You will have to specify your numeric constants in decimal.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


--------------------------------------------------------------------------
 Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any person as to do so could be a breach of confidence. Thank you 
for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to