Re: [sqlite] blob + rowID Insert question

2014-08-28 Thread Carlos Ferreira
Thanks!!


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: sexta-feira, 29 de Agosto de 2014 00:20
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] blob + rowID Insert question

On 8/28/2014 2:18 PM, Carlos Ferreira wrote:
> In the next line:
>
> UPDATE myTable SET theBlob =  WHERE id = 
>
> The "whatever" is a long string containing the data?

The "whatever" should be ? (question mark) - a parameter placeholder
( could be another one). Prepare the statement, bind the data to the
parameter using sqlite3_bind_blob (which you have already discovered), then
execute the statement.
--
Igor Tandetnik

___
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 + rowID Insert question

2014-08-28 Thread Igor Tandetnik

On 8/28/2014 2:18 PM, Carlos Ferreira wrote:

In the next line:

UPDATE myTable SET theBlob =  WHERE id = 

The "whatever" is a long string containing the data?


The "whatever" should be ? (question mark) - a parameter placeholder 
( could be another one). Prepare the statement, bind the data to 
the parameter using sqlite3_bind_blob (which you have already 
discovered), then execute the statement.

--
Igor Tandetnik

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


Re: [sqlite] blob + rowID Insert question

2014-08-28 Thread Simon Slavin

On 28 Aug 2014, at 7:18pm, Carlos Ferreira  wrote:

> Using your suggestion of the UPDATE Statement, and assuming I have a block
> of memory with pointer p and size s ( different from the previous size ),
> that I want to use as the data of my new blob, do you suggest I create a
> very long string as the statement?

That's the simplest way.  You can bind your pointer & length to the blob using 
binding, or include it in a string in the format

x'0500'


.  See section 2.3 of



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


Re: [sqlite] blob + rowID Insert question

2014-08-28 Thread Carlos Ferreira
One other question:

I use the

SQLite3_BindBlob  to add a new blob to a given record. From this point on I
know how to change the BLOB ( but not its size ) using the incremental BLBO
direct Access functions.

Using your suggestion of the UPDATE Statement, and assuming I have a block
of memory with pointer p and size s ( different from the previous size ),
that I want to use as the data of my new blob, do you suggest I create a
very long string as the statement?

In the next line:

UPDATE myTable SET theBlob =  WHERE id = 

The "whatever" is a long string containing the data? How should I serialize
it? What kind of encoding?

Thanks

Carlos


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin
Sent: quinta-feira, 28 de Agosto de 2014 19:08
To: General Discussion of SQLite Database
Subject: Re: [sqlite] blob + rowID Insert question


On 28 Aug 2014, at 7:06pm, Carlos Ferreira <car...@csiberkeley.com> wrote:

> Is there any way to replace a BLOB for a give ROW ID?

Use the UPDATE command:

UPDATE myTable SET theBlob =  WHERE id = 

Simon.
___
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 + rowID Insert question

2014-08-28 Thread Carlos Ferreira
Thanks :) :)


-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin
Sent: quinta-feira, 28 de Agosto de 2014 19:08
To: General Discussion of SQLite Database
Subject: Re: [sqlite] blob + rowID Insert question


On 28 Aug 2014, at 7:06pm, Carlos Ferreira <car...@csiberkeley.com> wrote:

> Is there any way to replace a BLOB for a give ROW ID?

Use the UPDATE command:

UPDATE myTable SET theBlob =  WHERE id = 

Simon.
___
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 + rowID Insert question

2014-08-28 Thread Simon Slavin

On 28 Aug 2014, at 7:06pm, Carlos Ferreira  wrote:

> Is there any way to replace a BLOB for a give ROW ID?

Use the UPDATE command:

UPDATE myTable SET theBlob =  WHERE id = 

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