Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the meaning of the sqlite Blob literal x'007800'?

Sqlite has the blob datatype which stores data as hex-strings. You can write blob literals using the x'<hexadecimal numbers>' notation.

The docs about this:

BLOB literals are string literals containing hexadecimal data and preceded by a single "x" or "X" character. Example: X’53514C697465′

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This way you can write for example in the sqlite CLI

sqlite> SELECT x'313233';
123
sqlite> 

As SQLite will automatically transform the hexadecimal numbers 31-32-33 into their ASCII counterparts for the decimal numbers 49, 50 and 51, which are "1", "2" and "3".

Now as part of a test-suite I am maintaining from somebody else there is a test that uses x'007800' and claims it to be a NULL value of some sort.

In fact, running that value in an sqlite console returns nothing:

sqlite> SELECT x'007800';

sqlite> 

I am somewhat confused as to what the meaning behind that hexadecimal is (?). Googling around, I could find no special meaning attached to that particular number. It appears to be a representation of "\0x\0", which I similarly can’t extract any meaning from.

What is the meaning of x'007800' and/or "\0x\0" ?

>Solution :

What is the meaning of x’007800′ and/or "\0x\0" ?

The blob literal x'007800' means three bytes 00, 78 and 00 in hexadecimal,
which are equal to ASCII characters null (\0) and x.

You can refer the table here.

CharacterName    Char     Code    Decimal     Binary      Hex
Null             NUL      Ctrl@   0           00000000    00
Lower-case X     x        X       120         01111000    78
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading