Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Pavel Ivanov
>  > SELECT quote(cast(X'5445' || X'5354' as blob));
>
>        Indeed, it seems to work.  Thanks!

But beware that it's not guaranteed to work if blobs have embedded
'\0' character (as it's actually not guaranteed to work if blobs don't
have a valid UTF-8/UTF-16 text). Although I believe it works now and
wasn't changed for a long time. But keep that in mind just in case.


Pavel


On Fri, Jan 20, 2012 at 12:20 PM, Ivan Shmakov  wrote:
>> Pavel Ivanov writes:
>
> [...]
>
>  >> Unfortunately, the string concatenation operator, when applied to
>  >> two BLOB's, results in a text string instead of a BLOB, like:
>
>  >> SELECT quote (X'5445' || X'5354'); => 'TEST'
>
>  > Maybe the following?
>
>  > SELECT quote(cast(X'5445' || X'5354' as blob));
>
>        Indeed, it seems to work.  Thanks!
>
> --
> FSF associate member #7257
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Ivan Shmakov
> Pavel Ivanov writes:

[...]

 >> Unfortunately, the string concatenation operator, when applied to
 >> two BLOB's, results in a text string instead of a BLOB, like:

 >> SELECT quote (X'5445' || X'5354'); => 'TEST'

 > Maybe the following?

 > SELECT quote(cast(X'5445' || X'5354' as blob));

Indeed, it seems to work.  Thanks!

-- 
FSF associate member #7257

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


Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Pavel Ivanov
>        Unfortunately, the string concatenation operator, when applied
>        to two BLOB's, results in a text string instead of a BLOB, like:
>
> SELECT quote (X'5445' || X'5354');
>  => 'TEST'

Maybe the following?

SELECT quote(cast(X'5445' || X'5354' as blob));


Pavel


On Fri, Jan 20, 2012 at 4:23 AM, Ivan Shmakov  wrote:
>        With substr (), it's possible to split a BLOB, like:
>
> SELECT quote (substr (X'1337cafe', 3, 2));
>  => X'CAFE'
>
>        However, how do I concatenate two blobs?
>
>        Unfortunately, the string concatenation operator, when applied
>        to two BLOB's, results in a text string instead of a BLOB, like:
>
> SELECT quote (X'5445' || X'5354');
>  => 'TEST'
>
> --
> FSF associate member #7257
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] BLOB concatenation?

2012-01-20 Thread Ivan Shmakov
With substr (), it's possible to split a BLOB, like:

SELECT quote (substr (X'1337cafe', 3, 2));
  => X'CAFE'

However, how do I concatenate two blobs?

Unfortunately, the string concatenation operator, when applied
to two BLOB's, results in a text string instead of a BLOB, like:

SELECT quote (X'5445' || X'5354');
  => 'TEST'

-- 
FSF associate member #7257

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