开发者

Is there a direct equivalent in SQLite to MySQL's Binary?

I have a MySQL DB which stores data into a column of type 'binary' in this way:

INSERT INTO t VALUES(0x00000000000000000000000000000001)
开发者_Python百科

I want to do the same in SQLite, so I need to figure out two things:

  1. What is the 'binary' type equivalent in sqlite? There is a blob, but that might behave differently.

  2. How can bin data be represented while inputting using INSERT statements. In MySQL for example, the above format of 0xbin works. But what about SQLite?


Found the answers, here they are for posterity.

  1. There is a 'binary' type in sqlite3 but it doesn't seem to behave any differently from the 'blob' type, which is unusual.

  2. Binary is inserted as such

create table t (b blob);
insert into t values (X'00000000000000000000000000000002');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜