如何使用 x'abc' 二进制字符串文字语法显示 blob 值? [英] How to display blob value using x'abc' binary string literal syntax?

查看:13
本文介绍了如何使用 x'abc' 二进制字符串文字语法显示 blob 值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以使用 x'abc' 语法轻松输入 blob 值,但有没有办法以这种方式显示它?如下图,直接选择,或者使用concatenation隐式转换为字符串都不起作用,显示乱码(这里是Windows DOS提示).

You can easily enter a blob value using the x'abc' syntax, but is there a way to display it that way too? As shown below, selecting directly, or implicitly converting to a string using concatenation doesn't work, and shows garbage (Windows DOS prompt here).

sqlite> create table blobs (uid blob);
sqlite> insert into blobs values (x'0123456789abcdef0123456789abcdef');
sqlite> select * from blobs;
☺#Egë½═∩☺#Egë½═∩
sqlite> select ''||uid from blobs;
☺#Egë½═∩☺#Egë½═∩

我希望选择显示:

x'0123456789abcdef0123456789abcdef'

谢谢,--DD

推荐答案

select quote(uid) from blobs

返回:

X'0123456789ABCDEF0123456789ABCDEF'

如果你真的需要小写,你可以使用:

and if you really need it in lowercase, you can use:

select lower(quote(uid)) from blobs

这篇关于如何使用 x'abc' 二进制字符串文字语法显示 blob 值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆