[sqlite] Documentation improvement suggestion

2017-08-30 Thread Simon Slavin
I propose a change to this page: This sentence: "This document describes and defines the on-disk database file format used by SQLite." The sentence is correct but I’ve had at least one case where such a statement can cause a problem in future. Could

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Simon Slavin
On 31 Aug 2017, at 12:36am, Ali Dorri wrote: > Great, thanks for your help. I will have a look at that. See also this page to understand more about SQLite’s database file format: Simon.

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Ali Dorri
Great, thanks for your help. I will have a look at that. On Thu, Aug 31, 2017 at 9:28 AM, Simon Slavin wrote: > > > On 31 Aug 2017, at 12:10am, Ali Dorri wrote: > > > It works. I think I should a way to calculate this reduction in the size > of > >

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Simon Slavin
On 31 Aug 2017, at 12:10am, Ali Dorri wrote: > It works. I think I should a way to calculate this reduction in the size of > the database as sometimes it seems there is no difference in size (after > VACUUM) between removing one row or two or three. > This is a research

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Ali Dorri
Thanks all, It works. I think I should a way to calculate this reduction in the size of the database as sometimes it seems there is no difference in size (after VACUUM) between removing one row or two or three. This is a research work so I need it to show me exactly how much data is removed. Any

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Dominique Devienne
On Wed, Aug 30, 2017 at 5:48 PM, Jens Alfke wrote: > > On Aug 29, 2017, at 6:22 PM, Ali Dorri wrote: > > > > *char* *zSQL = *sqlite3_mprintf*("UPDATE BC set Signature = null and PK > = > > null where PK = '%q' ;", endoced_pub.c_str()); > > FYI, your

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Jens Alfke
> On Aug 29, 2017, at 6:22 PM, Ali Dorri wrote: > > *char* *zSQL = *sqlite3_mprintf*("UPDATE BC set Signature = null and PK = > null where PK = '%q' ;", endoced_pub.c_str()); FYI, your PK values are not being stored as blobs, rather as hex-encoded strings. Maybe not

Re: [sqlite] Problem with mailing list

2017-08-30 Thread Bart Smissaert
Seems to be all sorted now. RBS On Wed, Aug 30, 2017 at 2:47 PM, Stephen Chrzanowski wrote: > I can't help with the list, but I received this note. > > On Wed, Aug 30, 2017 at 4:20 AM, Bart Smissaert > wrote: > > > Got this message: > > > >

Re: [sqlite] Problem with mailing list

2017-08-30 Thread Stephen Chrzanowski
I can't help with the list, but I received this note. On Wed, Aug 30, 2017 at 4:20 AM, Bart Smissaert wrote: > Got this message: > > > -- > Your mail to 'sqlite-users' with the subject

Re: [sqlite] Determine SQLite data type after UDF conversion

2017-08-30 Thread Bart Smissaert
OK, that is very helpful. I must have misunderstood the documentation about this: The sqlite3_column_type() routine returns the datatype code for the initial data type of the result column. etc> I will just check my application code and there must be something wrong there then. I am sure my UDF

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Simon Slavin
On 30 Aug 2017, at 12:19pm, Ali Dorri wrote: > Thanks, now it works and removes all except for the PK. How can I remove > the PK then? i.e. what is the correct way of doing the following? > UPDATE BC set Signature = null ,PK = null where PK = '%q' ; That syntax

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread R Smith
Clarification: When I said: You can use this SQL: VACUUM; to get rid of empty space in the DB file and re-pack it correctly. by "correctly" I really meant "tightly". There is nothing incorrect about the data before the vacuum, of course.

Re: [sqlite] Determine SQLite data type after UDF conversion

2017-08-30 Thread Richard Hipp
On 8/30/17, Bart Smissaert wrote: > Say I have a query like this: > > Select tbl, BlobAsText(sample) from sqlite_stat4 > Where BlobAsText is a UDF that takes a blob and converts it to a string. > Now I need to know that the second column of the output needs to be dealt >

Re: [sqlite] Determine SQLite data type after UDF conversion

2017-08-30 Thread R Smith
Not 100% sure I follow what you mean to achieve, but would: Select tbl, CAST(BlobAsText(sample) AS TEXT) AS SampleText from sqlite_stat4 work for you? On 2017/08/30 1:20 PM, Bart Smissaert wrote: Say I have a query like this: Select tbl, BlobAsText(sample) from sqlite_stat4 Where BlobAsText

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread R Smith
Perhaps: DELETE FROM BC WHERE PK = '%q'; Also note, the DB size may or may not decrease when deleting, it clears data, not space. You can use this SQL: VACUUM; to get rid of empty space in the DB file and re-pack it correctly. On 2017/08/30 1:19 PM, Ali Dorri wrote: Hi, Thanks, now

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Andy Ling
You're not deleting any rows, you're just changing the value of the data in the row. What you probably want is something like DELETE FROM BC WHERE PK = '%q'; HTH Andy Ling -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Ali

[sqlite] Determine SQLite data type after UDF conversion

2017-08-30 Thread Bart Smissaert
Say I have a query like this: Select tbl, BlobAsText(sample) from sqlite_stat4 Where BlobAsText is a UDF that takes a blob and converts it to a string. Now I need to know that the second column of the output needs to be dealt with as text. Is there any SQLite API that can help me with this?

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Ali Dorri
Hi, Thanks, now it works and removes all except for the PK. How can I remove the PK then? i.e. what is the correct way of doing the following? UPDATE BC set Signature = null ,PK = null where PK = '%q' ; Another issue I have is that when I remove these entries, the size of the database

Re: [sqlite] Issue with updating database content (C++)

2017-08-30 Thread Clemens Ladisch
Ali Dorri wrote: > I encode the PKs to base64 > [...] > The PK is a BLOB type, i.e., >sql = "CREATE TABLE BC(" \ > "PKBLOB," \ Why do you store a text value in a blob field? > "UPDATE BC set Signature = null and PK = null where PK = '%q' ; That does not

[sqlite] Issue with updating database content (C++)

2017-08-30 Thread Ali Dorri
Dear All, I am using sqlite to store public key (PK), signature (Sig) and hashes generated by crypto++ library in a C++ program. I encode the PKs to base64 strings and then store them in the database. Later in my program, I want to update records of data by searching based on the PK, i.e. *char*

[sqlite] Problem with mailing list

2017-08-30 Thread Bart Smissaert
Got this message: -- Your mail to 'sqlite-users' with the subject Re: [sqlite] FIX FOR:: Duplicate output with pragma_list, function_list, module_list Is being held until the list moderator can review it