[sqlite] 3rd Call For Papers - 25th Annual Tcl/Tk Conference (Tcl'2018)

2018-06-04 Thread conference

Hello SQLite Users, fyi ...

25th Annual Tcl/Tk Conference (Tcl'2018)
http://www.tcl.tk/community/tcl2018/

October 15 - 19, 2018
Crowne Plaza Houston River Oaks
2712 Southwest Freeway, 77098
Houston, Texas, USA

[ Reminder
 
 * [Registration is open](https://www.tcl.tk/community/tcl2018/register.html)

 * [Submission is open](https://www.tcl.tk/community/tcl2018/cfp.html)

 * Our Keynote speaker is
   [Andrea Casotto](https://www.tcl.tk/community/tcl2018/bios.html#acasotto)
]

Important Dates:

Abstracts and proposals due   August 20, 2018
Notification to authors   August 27, 2018
WIP and BOF reservations open July 23, 2018 ** may change **
Registration opensIS OPEN
Author materials due  September 24, 2018
Tutorials Start   October 15, 2018
Conference starts October 17, 2018

Email Contact:tclconfere...@googlegroups.com

Submission of Summaries

Tcl/Tk 2018 will be held in Houston, Texas, USA from October 15, 2018 to 
October 19, 2018.

The program committee is asking for papers and presentation proposals
from anyone using or developing with Tcl/Tk (and extensions). Past
conferences (Proceedings: http://www.tcl.tk/community/conferences.html)
have seen submissions covering a wide variety of topics including:

* Scientific and engineering applications
* Industrial controls
* Distributed applications and Network Managment
* Object oriented extensions to Tcl/Tk
* New widgets for Tk
* Simulation and application steering with Tcl/Tk
* Tcl/Tk-centric operating environments
* Tcl/Tk on small and embedded devices
* Medical applications and visualization
* Use of different programming paradigms in Tcl/Tk and proposals for new
  directions.
* New areas of exploration for the Tcl/Tk language

Submissions should consist of an abstract of about 100 words and a
summary of not more than two pages, and should be sent as plain text
to tclconfere...@googlegroups.com no later than August 20, 2018. Authors of 
accepted
abstracts will have until September 24, 2018 to submit their final
paper for the inclusion in the conference proceedings. The proceedings
will be made available on digital media, so extra materials such as
presentation slides, code examples, code for extensions etc. are
encouraged.

Printed proceedings will be produced as an on-demand book at lulu.com
Online proceedings will appear via
http://www.tcl.tk/community/conferences.html

The authors will have 30 minutes to present their paper at
the conference.

The program committee will review and evaluate papers according to the
following criteria:

* Quantity and quality of novel content
* Relevance and interest to the Tcl/Tk community
* Suitability of content for presentation at the conference

Proposals may report on commercial or non-commercial systems, but
those with only blatant marketing content will not be accepted.

Application and experience papers need to strike a balance between
background on the application domain and the relevance of Tcl/Tk to
the application. Application and experience papers should clearly
explain how the application or experience illustrates a novel use of
Tcl/Tk, and what lessons the Tcl/Tk community can derive from the
application or experience to apply to their own development efforts.

Papers accompanied by non-disclosure agreements will be returned to
the author(s) unread. All submissions are held in the highest
confidentiality prior to publication in the Proceedings, both as a
matter of policy and in accord with the U. S. Copyright Act of 1976.

The primary author for each accepted paper will receive registration
to the Technical Sessions portion of the conference at a reduced rate.

Other Forms of Participation

The program committee also welcomes proposals for panel discussions of
up to 90 minutes. Proposals should include a list of confirmed
panelists, a title and format, and a panel description with position
statements from each panelist. Panels should have no more than four
speakers, including the panel moderator, and should allow time for
substantial interaction with attendees. Panels are not presentations
of related research papers.

Slots for Works-in-Progress (WIP) presentations and Birds-of-a-Feather
sessions (BOFs) are available on a first-come, first-served basis
starting in July 23, 2018. Specific instructions for reserving WIP
and BOF time slots will be provided in the registration information
available in July 23, 2018. Some WIP and BOF time slots will be held open
for on-site reservation. All attendees with an interesting work in
progress should consider reserving a WIP slot.

Registration Information

More information on the conference is available the conference Web
site (http://www.tcl.tk/community/tcl2018/) and will be published on
various Tcl/Tk-related information channels.

To keep in touch with news regarding the conference, subscribe to the
tclconfere...@googlegroups.com list. See:
https://groups.google.com/forum/#!forum/tclc

[sqlite] How to avoid the fts rebuilding when add a column on fts table?

2018-06-04 Thread zheng xiaojin
we are using FTS5 to support my business. But find it so intolerable that Every 
time when I wanr to add one business column which will also be added on fts 
table, I need to drop all the fts.table and rebulid again.
Can.you help me or if you have any develop  plan about this problem?
Thank you!


获取 Outlook for Android

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


[sqlite] PRAGMA writable_schema and schema_version: changes are ignored on the same connection

2018-06-04 Thread Barry
This started off as a bug report about the writable schema method
recommended in  https://www.sqlite.org/lang_altertable.html, but I realised
the problem is a bit broader.

It seems SQLite is ignoring manual changes to sqlite_master when combined
with increments to schema_version. The alter table page referenced above
does not mention this, and indeed has advice (to run an integrity_check)
that relies on different behaviour. Restarting SQLite ensures it has
re-read the schema. I did not check the behaviour of simultaneous
connections.

C:\Users\Me>sqlite3
SQLite version 3.24.0 2018-06-04 19:24:41
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE Hi(ID INTEGER PRIMARY KEY);
sqlite> PRAGMA schema_version;
1
sqlite> PRAGMA writable_schema=ON;
sqlite> UPDATE sqlite_master SET SQL='CREATE TABLE Hi(ID INTEGER PRIMARY
KEY, value INTEGER)' WHERE name='Hi' AND type='Table';
sqlite> PRAGMA writable_schema=OFF;
sqlite> PRAGMA schema_version=2;
sqlite> INSERT INTO Hi VALUES (1, 4);
Error: table Hi has 1 columns but 2 values were supplied
sqlite> PRAGMA schema_version;
2
sqlite> PRAGMA schema_version=3;
sqlite> INSERT INTO Hi VALUES (1, 4);
Error: table Hi has 1 columns but 2 values were supplied
sqlite>

The context of this is:

I just tried to follow the second method (writable schema) advised on
https://www.sqlite.org/lang_altertable.html to alter a column and drop a
NOT NULL constraint.

Due to a typo I updated the SQL in sqlite_master to CREAT TABLE... instead
of CREATE TABLE.

This database still passed the PRAGMA integrity_check that I ran before
committing the transaction. However, when I closed the database then
reopened and executed a DDL statement it got all upset and told me that my
database schema is malformed.

I understand that writable_schema is a "You break it you buy it" type
situation, but why does the documentation recommend I run the PRAGMA
integrity_check if it won't pick up something so simple and obviously
erroneous as misspelling CREAT?

Reproduction example (this is 3.22, but as illustrated above 3.24 will give
the same results):

C:\Users\Me>sqlite3 test.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> CREATE Table foo(ID INTEGER PRIMARY KEY);
sqlite> PRAGMA schema_version;
1
sqlite> BEGIN;
sqlite> PRAGMA writable_schema=ON;
sqlite> UPDATE sqlite_master SET SQL = 'CREAT TABLE foo(bar INTEGER PRIMARY
KEY)' WHERE type='table' and name='foo';
sqlite> PRAGMA writable_schema=OFF;
sqlite> PRAGMA schema_version=2;
sqlite> PRAGMA schema_version;
2
sqlite> PRAGMA integrity_check;
ok
sqlite> COMMIT;
sqlite> .exit

C:\Users\Me>sqlite3 test.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> CREAT TABLE bar (ID INTEGER PRIMARY KEY);
Error: near "CREAT": syntax error
sqlite> CREATE TABLE bar (ID INTEGER PRIMARY KEY);
Error: malformed database schema (foo)
sqlite>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 11:21pm, Rael Bauer  wrote:

> On tree page 51 cell 1: invalid page number 302055426

Erm ... I don't know your pagesize and page count, but that looks like an 
incorrectly high page number to me.

If you have checked that your recovery method does recover all the data you'd 
expect to see, then perhaps you can continue with a modified version of your 
pipe.

In the middle of the pipe, you could insert a program (or a utility) which 
replaces the ROLLBACK with a COMMIT.

As an alternative you could try VACUUM.  This needs testing so, on a testing 
copy ...

1) Do the integrity check which shows the sort of errors you posted.
2) Execute VACUUM
3) Do another integrity check

It might or might not get rid of the corruption.  if it works you can modify 
your recovery procedure accordingly.

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


Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Rael Bauer
@david: I am not corrupting the database myself. Users of my application 
have sent in corrupted databases (on very rare occassion).


I do not have permission to send you corrupted database at this time.

I can tell you the following:

This problem starts with v3.18.
It works ok with v3.17

Database 1 integrity check result:

*** in database main ***
On tree page 51 cell 1: invalid page number 302055426
Page 373: btreeInitPage() returns error code 11
Page 501: btreeInitPage() returns error code 11
Page 437: btreeInitPage() returns error code 11
Page 54 is never used
Page 55 is never used
Page 56 is never used
Page 57 is never used
Page 58 is never used
Page 59 is never used

Database 2 integrity check result: (no result)
Error: database disk image is malformed.

Database 3 integrity check:
*** in database main ***
On tree page 65213 cell 2: 9595 of 15116 pages missing from overflow 
list starting at 65188

Page 70081 is never used
Page 70082 is never used
Page 70083 is never used
... repeat up to
Page 70179 is never used

Despite these errors, using the .dump command mentioned in first post 
fixes the problem wonderfully in all 3 databases, and fails in all 3 in 
v3.18


If you have a pressing need for the database I can go to the trouble of 
contacting the user about it, but I obtained some a long time ago.



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


Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread David Raymond
Do you have a repeatable way to corrupt the database using the command line 
tool? We'd like to fix the main problem rather than fix a workaround.

What are the signs of database corruption? Error messages, weird results, 
output of pragma integrity_check, etc?

Do you have a sample corrupted database you're willing to share?

.dump exports the table contents out as SQL commands. So if that worked then 
the problems might just be in indexes, and running reindex might be a better 
workaround in the meantime.


-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Rael Bauer
Sent: Monday, June 04, 2018 1:33 PM
To: sqlite-users@mailinglists.sqlite.org
Subject: Re: [sqlite] Repair corrupt database results in 0KB file

@Simon: I did not mention any sqlite3.dll. I am only talking about 
sqlite3.exe command line tool. The problem occurs using the command line.

Yes, I tried your idea.

The last line in the dump using the old version is:

COMMIT;

The last line in the dump using the latest version (3.23.1) is:

ROLLBACK; -- due to errors

If I edit this to "COMMIT;", then it works ok if I read the dump file 
into a new database.

Seems like a regression to me...

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 8:09pm, Igor Korot  wrote:

> The second cycle' sqlite3_step() returns 1, but immediately calling
> sqlite3_errcode() returns 0.

I don't like that.

You should almost never see a result code of 1.  It's SQLite telling you 
"Something went wrong but I don't know what.".  It a bad sign.

And, as you point out, if you do see 1 then if you immediately do 
sqlite3_errcode() you should get something other than 1 from it.

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 7:15pm, Igor Korot  wrote:

> Is my assumption correct that sqlite3_errcode() returning 0, indicate
> there was no error?

Correct.  It might return

  0 (SQLITE_OK == "no error")
1 to 99 (primary error code)
100 (SQLITE_ROW == "here's a row of data you asked for")
101 (SQLITE_DONE == "no more rows")
200 upward (extended error code)

There are a few codes which are hard to categorise (e.g. SQLITE_ABORT) but 
that's pretty-much it.

There aren't any ranges apart from the above.  So there's no way to look at the 
range of the code and tell whether the error was temporary (e.g. a lock) or 
permanent; or by parameter or content; or hardware or corruption, unless you 
look at the exact number.

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Keith,

On Mon, Jun 4, 2018 at 1:39 PM, Keith Medcalf  wrote:
>
> Perhaps.  In order for the sqlite3_errcode(db) to have any meaning then the 
> immediately preceding API call must have failed with an error (that is, 
> returned a result other than SQLITE_OK, SQLITE_ROW, or SQLITE_DONE).  The 
> sqlite3_errcode is *ONLY* updated when there is an error (ie, the return code 
> from an API call is not OK / ROW / DONE).  Otherwise calling the 
> sqlite3_errcode function will either return the errorcode from the most 
> recently called failing API call or whatever garbage happens to be contained 
> in that memory location.
>
> According to the documentation:
>
> "If the most recent sqlite3_* API call associated with database connection D 
> failed, then the sqlite3_errcode(D) interface returns the numeric result code 
> or extended result code for that API call. If the most recent API call was 
> successful, then the return value from sqlite3_errcode() is undefined."
>
> where undefined means that the value returned has no meaning ...
>
> "If an interface fails with SQLITE_MISUSE, that means the interface was 
> invoked incorrectly by the application. In that case, the error code and 
> message may or may not be set."
>
> So, if and only if "rc = sqlite3_(...)" returns a code (rc) which is 
> *NOT* SQLITE_OK (0), SQLITE_ROW (100), SQLITE_DONE (101) is the 
> sqlite3_errcode meaningful with the caveat that if rc is SQLITE_MISUSE (23) 
> then mayhaps yes and mayhaps no be meaningful.  It also only returns data for 
> the last API call on a connection.
>
>
> so the idea is that you get the return code of the API call ...
> if and only if this is a failure (not in [SQLITE_OK, SQLITE_ROW, 
> SQLITE_DONE]) should you even look at the sqlite3_errcode
> if the original API return code was SQLITE_MISUSE then the result of 
> sqlite3_errcode may mean something and may not

But then this is even more confusing.
As I said in the beginning:

The second cycle' sqlite3_step() returns 1, but immediately calling
sqlite3_errcode() returns 0.

I just don't understand how to interpret those results.

Can you?

Thank you.

>
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
> lot about anticipated traffic volume.
>
>
>>-Original Message-
>>From: sqlite-users [mailto:sqlite-users-
>>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>>Sent: Monday, 4 June, 2018 12:15
>>To: SQLite mailing list
>>Subject: Re: [sqlite] Reset the cursor
>>
>>Keith,
>>
>>On Mon, Jun 4, 2018 at 12:59 PM, Keith Medcalf 
>>wrote:
>>>
>>> Yes, if it is 3.6.23.1 or earlier or the sqlite3 library was
>>compiled with SQLITE_OMIT_AUTORESET you will get an SQLITE_MISUSE
>>error on the 3rd loop because the statement was not reset.
>>
>>One more thing:
>>
>>Is my assumption correct that sqlite3_errcode() returning 0, indicate
>>there was no error?
>>
>>Thank you.
>>
>>>
>>> ---
>>> The fact that there's a Highway to Hell but only a Stairway to
>>Heaven says a lot about anticipated traffic volume.
>>>
>>>
-Original Message-
From: sqlite-users [mailto:sqlite-users-
boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
Sent: Monday, 4 June, 2018 11:50
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

Keith,

On Mon, Jun 4, 2018 at 12:35 PM, Keith Medcalf
>>
wrote:
>
> #include "sqlite3.h"
> #include 
>
> void main(int argc, char** argv)
> {
> sqlite3* db = 0;
> sqlite3_stmt* stmt = 0;
> char* rest = 0;
> int rc = 0;
> int value = 0;
> sqlite3_open(":memory:", &db);
> rc = sqlite3_prepare_v2(db, "select value from
>>generate_series
where start=1 and stop=10;", -1, &stmt, (void*)&rest);
> if (rc != SQLITE_OK)
> {
> printf("Error %d during prepare\n", rc);
> return;
> }
> printf("\nLoop 1, no reset, reset at 5\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE | value == 5)
> {
> printf("!\n");
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> printf("\nLoop 2, After Reset\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE)
> {
> printf("!\n");
> //rc = sqlite3_reset(stmt);
> //printf("sqlite3_reset returns %d\n", rc);
> br

Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf

Perhaps.  In order for the sqlite3_errcode(db) to have any meaning then the 
immediately preceding API call must have failed with an error (that is, 
returned a result other than SQLITE_OK, SQLITE_ROW, or SQLITE_DONE).  The 
sqlite3_errcode is *ONLY* updated when there is an error (ie, the return code 
from an API call is not OK / ROW / DONE).  Otherwise calling the 
sqlite3_errcode function will either return the errorcode from the most 
recently called failing API call or whatever garbage happens to be contained in 
that memory location.  

According to the documentation:

"If the most recent sqlite3_* API call associated with database connection D 
failed, then the sqlite3_errcode(D) interface returns the numeric result code 
or extended result code for that API call. If the most recent API call was 
successful, then the return value from sqlite3_errcode() is undefined."

where undefined means that the value returned has no meaning ...

"If an interface fails with SQLITE_MISUSE, that means the interface was invoked 
incorrectly by the application. In that case, the error code and message may or 
may not be set."

So, if and only if "rc = sqlite3_(...)" returns a code (rc) which is *NOT* 
SQLITE_OK (0), SQLITE_ROW (100), SQLITE_DONE (101) is the sqlite3_errcode 
meaningful with the caveat that if rc is SQLITE_MISUSE (23) then mayhaps yes 
and mayhaps no be meaningful.  It also only returns data for the last API call 
on a connection.


so the idea is that you get the return code of the API call ...
if and only if this is a failure (not in [SQLITE_OK, SQLITE_ROW, SQLITE_DONE]) 
should you even look at the sqlite3_errcode
if the original API return code was SQLITE_MISUSE then the result of 
sqlite3_errcode may mean something and may not


---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>Sent: Monday, 4 June, 2018 12:15
>To: SQLite mailing list
>Subject: Re: [sqlite] Reset the cursor
>
>Keith,
>
>On Mon, Jun 4, 2018 at 12:59 PM, Keith Medcalf 
>wrote:
>>
>> Yes, if it is 3.6.23.1 or earlier or the sqlite3 library was
>compiled with SQLITE_OMIT_AUTORESET you will get an SQLITE_MISUSE
>error on the 3rd loop because the statement was not reset.
>
>One more thing:
>
>Is my assumption correct that sqlite3_errcode() returning 0, indicate
>there was no error?
>
>Thank you.
>
>>
>> ---
>> The fact that there's a Highway to Hell but only a Stairway to
>Heaven says a lot about anticipated traffic volume.
>>
>>
>>>-Original Message-
>>>From: sqlite-users [mailto:sqlite-users-
>>>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>>>Sent: Monday, 4 June, 2018 11:50
>>>To: SQLite mailing list
>>>Subject: Re: [sqlite] Reset the cursor
>>>
>>>Keith,
>>>
>>>On Mon, Jun 4, 2018 at 12:35 PM, Keith Medcalf
>
>>>wrote:

 #include "sqlite3.h"
 #include 

 void main(int argc, char** argv)
 {
 sqlite3* db = 0;
 sqlite3_stmt* stmt = 0;
 char* rest = 0;
 int rc = 0;
 int value = 0;
 sqlite3_open(":memory:", &db);
 rc = sqlite3_prepare_v2(db, "select value from
>generate_series
>>>where start=1 and stop=10;", -1, &stmt, (void*)&rest);
 if (rc != SQLITE_OK)
 {
 printf("Error %d during prepare\n", rc);
 return;
 }
 printf("\nLoop 1, no reset, reset at 5\n");
 for (;;)
 {
 rc = sqlite3_step(stmt);
 if (rc == SQLITE_DONE | value == 5)
 {
 printf("!\n");
 rc = sqlite3_reset(stmt);
 printf("sqlite3_reset returns %d\n", rc);
 break;
 }
 if (rc == SQLITE_ROW)
 {
 value = sqlite3_column_int(stmt, 0);
 printf("%d ", value);
 continue;
 }
 printf("Error during stepping %d\n", rc);
 rc = sqlite3_reset(stmt);
 printf("sqlite3_reset returns %d\n", rc);
 break;
 }
 printf("\nLoop 2, After Reset\n");
 for (;;)
 {
 rc = sqlite3_step(stmt);
 if (rc == SQLITE_DONE)
 {
 printf("!\n");
 //rc = sqlite3_reset(stmt);
 //printf("sqlite3_reset returns %d\n", rc);
 break;
 }
 if (rc == SQLITE_ROW)
 {
 value = sqlite3_column_int(stmt, 0);
 printf("%d ", value);
 continue;
 }
 printf("Error during stepping %d\n", rc);
 rc = sqlite3_reset(stmt);
 printf("sqlite3_reset returns %d\n", rc);
 break;
 }
 printf("\nLoop 3, No Reset, Got SQLITE_DONE\n");
 for (;;)
 

Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Keith,

On Mon, Jun 4, 2018 at 12:59 PM, Keith Medcalf  wrote:
>
> Yes, if it is 3.6.23.1 or earlier or the sqlite3 library was compiled with 
> SQLITE_OMIT_AUTORESET you will get an SQLITE_MISUSE error on the 3rd loop 
> because the statement was not reset.

One more thing:

Is my assumption correct that sqlite3_errcode() returning 0, indicate
there was no error?

Thank you.

>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
> lot about anticipated traffic volume.
>
>
>>-Original Message-
>>From: sqlite-users [mailto:sqlite-users-
>>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>>Sent: Monday, 4 June, 2018 11:50
>>To: SQLite mailing list
>>Subject: Re: [sqlite] Reset the cursor
>>
>>Keith,
>>
>>On Mon, Jun 4, 2018 at 12:35 PM, Keith Medcalf 
>>wrote:
>>>
>>> #include "sqlite3.h"
>>> #include 
>>>
>>> void main(int argc, char** argv)
>>> {
>>> sqlite3* db = 0;
>>> sqlite3_stmt* stmt = 0;
>>> char* rest = 0;
>>> int rc = 0;
>>> int value = 0;
>>> sqlite3_open(":memory:", &db);
>>> rc = sqlite3_prepare_v2(db, "select value from generate_series
>>where start=1 and stop=10;", -1, &stmt, (void*)&rest);
>>> if (rc != SQLITE_OK)
>>> {
>>> printf("Error %d during prepare\n", rc);
>>> return;
>>> }
>>> printf("\nLoop 1, no reset, reset at 5\n");
>>> for (;;)
>>> {
>>> rc = sqlite3_step(stmt);
>>> if (rc == SQLITE_DONE | value == 5)
>>> {
>>> printf("!\n");
>>> rc = sqlite3_reset(stmt);
>>> printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> if (rc == SQLITE_ROW)
>>> {
>>> value = sqlite3_column_int(stmt, 0);
>>> printf("%d ", value);
>>> continue;
>>> }
>>> printf("Error during stepping %d\n", rc);
>>> rc = sqlite3_reset(stmt);
>>> printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> printf("\nLoop 2, After Reset\n");
>>> for (;;)
>>> {
>>> rc = sqlite3_step(stmt);
>>> if (rc == SQLITE_DONE)
>>> {
>>> printf("!\n");
>>> //rc = sqlite3_reset(stmt);
>>> //printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> if (rc == SQLITE_ROW)
>>> {
>>> value = sqlite3_column_int(stmt, 0);
>>> printf("%d ", value);
>>> continue;
>>> }
>>> printf("Error during stepping %d\n", rc);
>>> rc = sqlite3_reset(stmt);
>>> printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> printf("\nLoop 3, No Reset, Got SQLITE_DONE\n");
>>> for (;;)
>>> {
>>> rc = sqlite3_step(stmt);
>>> if (rc == SQLITE_DONE)
>>> {
>>> printf("!\n");
>>> rc = sqlite3_reset(stmt);
>>> printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> if (rc == SQLITE_ROW)
>>> {
>>> value = sqlite3_column_int(stmt, 0);
>>> printf("%d ", value);
>>> continue;
>>> }
>>> printf("Error during stepping %d\n", rc);
>>> rc = sqlite3_reset(stmt);
>>> printf("sqlite3_reset returns %d\n", rc);
>>> break;
>>> }
>>> }
>>>
>>> 2018-06-04 11:32:12 MinGW [D:\work]
test
>>>
>>> Loop 1, no reset, reset at 5
>>> 1 2 3 4 5 !
>>> sqlite3_reset returns 0
>>>
>>> Loop 2, After Reset
>>> 1 2 3 4 5 6 7 8 9 10 !
>>>
>>> Loop 3, No Reset, Got SQLITE_DONE
>>> 1 2 3 4 5 6 7 8 9 10 !
>>> sqlite3_reset returns 0
>>
>>I will try without this call tonight when I'm back from work and let
>>you know.
>>
>>But if the system have an older version of SQLite this code will
>>break right?
>>
>>Thank you.
>>
>>>
>>>
>>> ---
>>> The fact that there's a Highway to Hell but only a Stairway to
>>Heaven says a lot about anticipated traffic volume.
>>>
>>>
-Original Message-
From: sqlite-users [mailto:sqlite-users-
boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
Sent: Monday, 4 June, 2018 11:25
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor


Note also that you do not need to do an sqlite3_reset after
sqlite3_step returns SQLITE_DONE as reset is called automatically
>>the
next time you call sqlite3_step.  You only need to call
>>sqlite3_reset
if you want to reset the statement before all the rows have been
retrieved (this is documented somewhere, and I believe there is a
compile time #define to turn off the auto-reset).  Yes, it is
documented in the sqlite3_step documentation

"For all versions of SQLite up to and including 3.6.23.1, a call to
sqlite3_reset() was required after sqlite3_step() returned anything
other than SQLITE_ROW before any subsequent invocation of
sqlite3_step(). Failure to reset 

Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf

Yes, if it is 3.6.23.1 or earlier or the sqlite3 library was compiled with 
SQLITE_OMIT_AUTORESET you will get an SQLITE_MISUSE error on the 3rd loop 
because the statement was not reset.  

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>Sent: Monday, 4 June, 2018 11:50
>To: SQLite mailing list
>Subject: Re: [sqlite] Reset the cursor
>
>Keith,
>
>On Mon, Jun 4, 2018 at 12:35 PM, Keith Medcalf 
>wrote:
>>
>> #include "sqlite3.h"
>> #include 
>>
>> void main(int argc, char** argv)
>> {
>> sqlite3* db = 0;
>> sqlite3_stmt* stmt = 0;
>> char* rest = 0;
>> int rc = 0;
>> int value = 0;
>> sqlite3_open(":memory:", &db);
>> rc = sqlite3_prepare_v2(db, "select value from generate_series
>where start=1 and stop=10;", -1, &stmt, (void*)&rest);
>> if (rc != SQLITE_OK)
>> {
>> printf("Error %d during prepare\n", rc);
>> return;
>> }
>> printf("\nLoop 1, no reset, reset at 5\n");
>> for (;;)
>> {
>> rc = sqlite3_step(stmt);
>> if (rc == SQLITE_DONE | value == 5)
>> {
>> printf("!\n");
>> rc = sqlite3_reset(stmt);
>> printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> if (rc == SQLITE_ROW)
>> {
>> value = sqlite3_column_int(stmt, 0);
>> printf("%d ", value);
>> continue;
>> }
>> printf("Error during stepping %d\n", rc);
>> rc = sqlite3_reset(stmt);
>> printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> printf("\nLoop 2, After Reset\n");
>> for (;;)
>> {
>> rc = sqlite3_step(stmt);
>> if (rc == SQLITE_DONE)
>> {
>> printf("!\n");
>> //rc = sqlite3_reset(stmt);
>> //printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> if (rc == SQLITE_ROW)
>> {
>> value = sqlite3_column_int(stmt, 0);
>> printf("%d ", value);
>> continue;
>> }
>> printf("Error during stepping %d\n", rc);
>> rc = sqlite3_reset(stmt);
>> printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> printf("\nLoop 3, No Reset, Got SQLITE_DONE\n");
>> for (;;)
>> {
>> rc = sqlite3_step(stmt);
>> if (rc == SQLITE_DONE)
>> {
>> printf("!\n");
>> rc = sqlite3_reset(stmt);
>> printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> if (rc == SQLITE_ROW)
>> {
>> value = sqlite3_column_int(stmt, 0);
>> printf("%d ", value);
>> continue;
>> }
>> printf("Error during stepping %d\n", rc);
>> rc = sqlite3_reset(stmt);
>> printf("sqlite3_reset returns %d\n", rc);
>> break;
>> }
>> }
>>
>> 2018-06-04 11:32:12 MinGW [D:\work]
>>>test
>>
>> Loop 1, no reset, reset at 5
>> 1 2 3 4 5 !
>> sqlite3_reset returns 0
>>
>> Loop 2, After Reset
>> 1 2 3 4 5 6 7 8 9 10 !
>>
>> Loop 3, No Reset, Got SQLITE_DONE
>> 1 2 3 4 5 6 7 8 9 10 !
>> sqlite3_reset returns 0
>
>I will try without this call tonight when I'm back from work and let
>you know.
>
>But if the system have an older version of SQLite this code will
>break right?
>
>Thank you.
>
>>
>>
>> ---
>> The fact that there's a Highway to Hell but only a Stairway to
>Heaven says a lot about anticipated traffic volume.
>>
>>
>>>-Original Message-
>>>From: sqlite-users [mailto:sqlite-users-
>>>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>>>Sent: Monday, 4 June, 2018 11:25
>>>To: SQLite mailing list
>>>Subject: Re: [sqlite] Reset the cursor
>>>
>>>
>>>Note also that you do not need to do an sqlite3_reset after
>>>sqlite3_step returns SQLITE_DONE as reset is called automatically
>the
>>>next time you call sqlite3_step.  You only need to call
>sqlite3_reset
>>>if you want to reset the statement before all the rows have been
>>>retrieved (this is documented somewhere, and I believe there is a
>>>compile time #define to turn off the auto-reset).  Yes, it is
>>>documented in the sqlite3_step documentation
>>>
>>>"For all versions of SQLite up to and including 3.6.23.1, a call to
>>>sqlite3_reset() was required after sqlite3_step() returned anything
>>>other than SQLITE_ROW before any subsequent invocation of
>>>sqlite3_step(). Failure to reset the prepared statement using
>>>sqlite3_reset() would result in an SQLITE_MISUSE return from
>>>sqlite3_step(). But after version 3.6.23.1 (2010-03-26,
>>>sqlite3_step() began calling sqlite3_reset() automatically in this
>>>circumstance rather than returning SQLITE_MISUSE. This is not
>>>considered a compatibility break because any application 

Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Keith,

On Mon, Jun 4, 2018 at 12:35 PM, Keith Medcalf  wrote:
>
> #include "sqlite3.h"
> #include 
>
> void main(int argc, char** argv)
> {
> sqlite3* db = 0;
> sqlite3_stmt* stmt = 0;
> char* rest = 0;
> int rc = 0;
> int value = 0;
> sqlite3_open(":memory:", &db);
> rc = sqlite3_prepare_v2(db, "select value from generate_series where 
> start=1 and stop=10;", -1, &stmt, (void*)&rest);
> if (rc != SQLITE_OK)
> {
> printf("Error %d during prepare\n", rc);
> return;
> }
> printf("\nLoop 1, no reset, reset at 5\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE | value == 5)
> {
> printf("!\n");
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> printf("\nLoop 2, After Reset\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE)
> {
> printf("!\n");
> //rc = sqlite3_reset(stmt);
> //printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> printf("\nLoop 3, No Reset, Got SQLITE_DONE\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE)
> {
> printf("!\n");
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> }
>
> 2018-06-04 11:32:12 MinGW [D:\work]
>>test
>
> Loop 1, no reset, reset at 5
> 1 2 3 4 5 !
> sqlite3_reset returns 0
>
> Loop 2, After Reset
> 1 2 3 4 5 6 7 8 9 10 !
>
> Loop 3, No Reset, Got SQLITE_DONE
> 1 2 3 4 5 6 7 8 9 10 !
> sqlite3_reset returns 0

I will try without this call tonight when I'm back from work and let you know.

But if the system have an older version of SQLite this code will break right?

Thank you.

>
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
> lot about anticipated traffic volume.
>
>
>>-Original Message-
>>From: sqlite-users [mailto:sqlite-users-
>>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>>Sent: Monday, 4 June, 2018 11:25
>>To: SQLite mailing list
>>Subject: Re: [sqlite] Reset the cursor
>>
>>
>>Note also that you do not need to do an sqlite3_reset after
>>sqlite3_step returns SQLITE_DONE as reset is called automatically the
>>next time you call sqlite3_step.  You only need to call sqlite3_reset
>>if you want to reset the statement before all the rows have been
>>retrieved (this is documented somewhere, and I believe there is a
>>compile time #define to turn off the auto-reset).  Yes, it is
>>documented in the sqlite3_step documentation
>>
>>"For all versions of SQLite up to and including 3.6.23.1, a call to
>>sqlite3_reset() was required after sqlite3_step() returned anything
>>other than SQLITE_ROW before any subsequent invocation of
>>sqlite3_step(). Failure to reset the prepared statement using
>>sqlite3_reset() would result in an SQLITE_MISUSE return from
>>sqlite3_step(). But after version 3.6.23.1 (2010-03-26,
>>sqlite3_step() began calling sqlite3_reset() automatically in this
>>circumstance rather than returning SQLITE_MISUSE. This is not
>>considered a compatibility break because any application that ever
>>receives an SQLITE_MISUSE error is broken by definition. The
>>SQLITE_OMIT_AUTORESET compile-time option can be used to restore the
>>legacy behavior."
>>
>>Neither the automatic nor the manual sqlite3_reset reset any bindings
>>-- if you want to do this I believe you must call the
>>sqlite3_clear_bindings()
>>
>>---
>>The fact that there's a Highway to Hell but only a Stairway to Heaven
>>says a lot about anticipated traffic volume.
>>
>>
>>>-Original Message-
>>>From: sqlite-users [mailto:sqlite-users-
>>>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>>>Sent: Monday, 4 June, 2018 11:06
>>>To: SQLite mailing list
>>>Subject: Re: [sqlite] Res

Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 6:32pm, Rael Bauer  wrote:

> The last line in the dump using the latest version (3.23.1) is:
> 
> ROLLBACK; -- due to errors

Then there are errors, and the data in your database may be corrupt, and the 
information you're getting from it can be wrong.  Use the command-line tool to 
issue the command

PRAGMA integrity_check;

And give us some idea about what it reports.

> Seems like a regression to me...

The job of .dump is to reproduce the contents of the database.  If the database 
is corrupt, .dump cannot do its job and it should certainly make sure that the 
user knows that.

Why do you have so many corrupt databases that you've developed a system to 
reconstruct them ?  Can you not correct the problem rather than losing data ?

Depending on the way in which the database is corrupt, simply using VACUUM on 
it might be a better way to get rid of corruption.  But depending on the type 
of corruption, VACUUM might lose even more data.  You should investigate rather 
than just using it.

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf

#include "sqlite3.h"
#include 

void main(int argc, char** argv)
{
sqlite3* db = 0;
sqlite3_stmt* stmt = 0;
char* rest = 0;
int rc = 0;
int value = 0;
sqlite3_open(":memory:", &db);
rc = sqlite3_prepare_v2(db, "select value from generate_series where 
start=1 and stop=10;", -1, &stmt, (void*)&rest);
if (rc != SQLITE_OK)
{
printf("Error %d during prepare\n", rc);
return;
}
printf("\nLoop 1, no reset, reset at 5\n");
for (;;)
{
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE | value == 5)
{
printf("!\n");
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
if (rc == SQLITE_ROW)
{
value = sqlite3_column_int(stmt, 0);
printf("%d ", value);
continue;
}
printf("Error during stepping %d\n", rc);
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
printf("\nLoop 2, After Reset\n");
for (;;)
{
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE)
{
printf("!\n");
//rc = sqlite3_reset(stmt);
//printf("sqlite3_reset returns %d\n", rc);
break;
}
if (rc == SQLITE_ROW)
{
value = sqlite3_column_int(stmt, 0);
printf("%d ", value);
continue;
}
printf("Error during stepping %d\n", rc);
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
printf("\nLoop 3, No Reset, Got SQLITE_DONE\n");
for (;;)
{
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE)
{
printf("!\n");
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
if (rc == SQLITE_ROW)
{
value = sqlite3_column_int(stmt, 0);
printf("%d ", value);
continue;
}
printf("Error during stepping %d\n", rc);
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
}

2018-06-04 11:32:12 MinGW [D:\work]
>test

Loop 1, no reset, reset at 5
1 2 3 4 5 !
sqlite3_reset returns 0

Loop 2, After Reset
1 2 3 4 5 6 7 8 9 10 !

Loop 3, No Reset, Got SQLITE_DONE
1 2 3 4 5 6 7 8 9 10 !
sqlite3_reset returns 0


---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>Sent: Monday, 4 June, 2018 11:25
>To: SQLite mailing list
>Subject: Re: [sqlite] Reset the cursor
>
>
>Note also that you do not need to do an sqlite3_reset after
>sqlite3_step returns SQLITE_DONE as reset is called automatically the
>next time you call sqlite3_step.  You only need to call sqlite3_reset
>if you want to reset the statement before all the rows have been
>retrieved (this is documented somewhere, and I believe there is a
>compile time #define to turn off the auto-reset).  Yes, it is
>documented in the sqlite3_step documentation
>
>"For all versions of SQLite up to and including 3.6.23.1, a call to
>sqlite3_reset() was required after sqlite3_step() returned anything
>other than SQLITE_ROW before any subsequent invocation of
>sqlite3_step(). Failure to reset the prepared statement using
>sqlite3_reset() would result in an SQLITE_MISUSE return from
>sqlite3_step(). But after version 3.6.23.1 (2010-03-26,
>sqlite3_step() began calling sqlite3_reset() automatically in this
>circumstance rather than returning SQLITE_MISUSE. This is not
>considered a compatibility break because any application that ever
>receives an SQLITE_MISUSE error is broken by definition. The
>SQLITE_OMIT_AUTORESET compile-time option can be used to restore the
>legacy behavior."
>
>Neither the automatic nor the manual sqlite3_reset reset any bindings
>-- if you want to do this I believe you must call the
>sqlite3_clear_bindings()
>
>---
>The fact that there's a Highway to Hell but only a Stairway to Heaven
>says a lot about anticipated traffic volume.
>
>
>>-Original Message-
>>From: sqlite-users [mailto:sqlite-users-
>>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>>Sent: Monday, 4 June, 2018 11:06
>>To: SQLite mailing list
>>Subject: Re: [sqlite] Reset the cursor
>>
>>
>>>Currently running w/MSVC 2010 under Win 8.1.
>>
>>>I also presume you are testing under the latest SQLite source?
>>
>>Yes, I believe so ...
>>SQLite 3.24.0 2018-06-02 19:14:58
>>1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4alt2
>>
>>Using GCC (MinGW-w64 8.1.0) on Windows 10 Pro for Workstations
>>version 1803 build 17134.81 (current)
>>
>>MSVC (the one I have, I think VS 2008) also works fine ... though
>the
>>.dll is still compiled with G

Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Rael Bauer
@Simon: I did not mention any sqlite3.dll. I am only talking about 
sqlite3.exe command line tool. The problem occurs using the command line.


Yes, I tried your idea.

The last line in the dump using the old version is:

COMMIT;

The last line in the dump using the latest version (3.23.1) is:

ROLLBACK; -- due to errors

If I edit this to "COMMIT;", then it works ok if I read the dump file 
into a new database.


Seems like a regression to me...

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf

Note also that you do not need to do an sqlite3_reset after sqlite3_step 
returns SQLITE_DONE as reset is called automatically the next time you call 
sqlite3_step.  You only need to call sqlite3_reset if you want to reset the 
statement before all the rows have been retrieved (this is documented 
somewhere, and I believe there is a compile time #define to turn off the 
auto-reset).  Yes, it is documented in the sqlite3_step documentation

"For all versions of SQLite up to and including 3.6.23.1, a call to 
sqlite3_reset() was required after sqlite3_step() returned anything other than 
SQLITE_ROW before any subsequent invocation of sqlite3_step(). Failure to reset 
the prepared statement using sqlite3_reset() would result in an SQLITE_MISUSE 
return from sqlite3_step(). But after version 3.6.23.1 (2010-03-26, 
sqlite3_step() began calling sqlite3_reset() automatically in this circumstance 
rather than returning SQLITE_MISUSE. This is not considered a compatibility 
break because any application that ever receives an SQLITE_MISUSE error is 
broken by definition. The SQLITE_OMIT_AUTORESET compile-time option can be used 
to restore the legacy behavior."

Neither the automatic nor the manual sqlite3_reset reset any bindings -- if you 
want to do this I believe you must call the sqlite3_clear_bindings()

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>Sent: Monday, 4 June, 2018 11:06
>To: SQLite mailing list
>Subject: Re: [sqlite] Reset the cursor
>
>
>>Currently running w/MSVC 2010 under Win 8.1.
>
>>I also presume you are testing under the latest SQLite source?
>
>Yes, I believe so ...
>SQLite 3.24.0 2018-06-02 19:14:58
>1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4alt2
>
>Using GCC (MinGW-w64 8.1.0) on Windows 10 Pro for Workstations
>version 1803 build 17134.81 (current)
>
>MSVC (the one I have, I think VS 2008) also works fine ... though the
>.dll is still compiled with GCC MinGW-w64 8.1.0 (with -O3 and then
>some).
>
>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08
>for 80x86
>Copyright (C) Microsoft Corporation.  All rights reserved.
>
>test.c
>Microsoft (R) Incremental Linker Version 9.00.21022.08
>Copyright (C) Microsoft Corporation.  All rights reserved.
>
>/out:test.exe
>test.obj
>sqlite3.lib
>
>
>2018-06-04 10:59:24 MinGW [D:\work]
>>test.exe
>
>Loop 1, no reset
>1 2 3 4 5 6 7 8 9 10 !
>sqlite3_reset returns 0
>
>Loop 2, after reset
>1 2 3 4 5 6 7 8 9 10 !
>sqlite3_reset returns 0
>
>---
>The fact that there's a Highway to Hell but only a Stairway to Heaven
>says a lot about anticipated traffic volume.
>
>
>
>
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 6:00pm, Rael Bauer  wrote:

> Now I updated to the latest version (3.23.1),

Which did you update ?  The command-line tool you call as sqlite3, or the 
library used in the program which uses the database file ?  Or both ?

> and using the above method results in a 0 KB file.

Break the command into two, so you get the .dump output into a file.  Look at 
that file.

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf

>Currently running w/MSVC 2010 under Win 8.1.

>I also presume you are testing under the latest SQLite source?

Yes, I believe so ...
SQLite 3.24.0 2018-06-02 19:14:58 
1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4alt2

Using GCC (MinGW-w64 8.1.0) on Windows 10 Pro for Workstations version 1803 
build 17134.81 (current)

MSVC (the one I have, I think VS 2008) also works fine ... though the .dll is 
still compiled with GCC MinGW-w64 8.1.0 (with -O3 and then some).

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj
sqlite3.lib


2018-06-04 10:59:24 MinGW [D:\work]
>test.exe

Loop 1, no reset
1 2 3 4 5 6 7 8 9 10 !
sqlite3_reset returns 0

Loop 2, after reset
1 2 3 4 5 6 7 8 9 10 !
sqlite3_reset returns 0

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




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


[sqlite] Repair corrupt database results in 0KB file

2018-06-04 Thread Rael Bauer

Hello,

I having been using the following method to repair corrupt databases 
using sqlite3.exe:

Simply call: sqlite3 mydata.db ".dump" | sqlite3 new.db

(source: 
https://stackoverflow.com/questions/18259692/how-to-recover-a-corrupt-sqlite3-database)


I have been using an old version of sqlite3.exe 
(sqlite-shell-win32-x86-3080403), and it has worked without problem.


Now I updated to the latest version (3.23.1), and using the above method 
results in a 0 KB file.


Is this a bug? Has the syntax changed?

I'm on Windows 7 x64

Thanks
Rael Bauer
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Hi, Keith,

On Mon, Jun 4, 2018 at 11:45 AM, Keith Medcalf  wrote:
> Works just fine for me ...
>
>
> #include "sqlite3.h"
> #include 
>
> void main(int argc, char** argv)
> {
> sqlite3* db = 0;
> sqlite3_stmt* stmt = 0;
> char* rest = 0;
> int rc = 0;
> int value = 0;
> sqlite3_open(":memory:", &db);
> rc = sqlite3_prepare_v2(db, "select value from generate_series where 
> start=1 and stop=10;", -1, &stmt, (void*)&rest);
> if (rc != SQLITE_OK)
> {
> printf("Error %d during prepare\n", rc);
> return;
> }
> printf("\nLoop 1, no reset\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE)
> {
> printf("!\n");
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> break;
> }
> printf("\nLoop 2, after reset\n");
> for (;;)
> {
> rc = sqlite3_step(stmt);
> if (rc == SQLITE_DONE)
> {
> printf("!\n");
> rc = sqlite3_reset(stmt);
> printf("sqlite3_reset returns %d\n", rc);
> break;
> }
> if (rc == SQLITE_ROW)
> {
> value = sqlite3_column_int(stmt, 0);
> printf("%d ", value);
> continue;
> }
> printf("Error during stepping %d\n", rc);
> break;
> }
> }
>
> gcc test.c -L. -lsqlite3 -o test.exe

Currently running w/MSVC 2010 under Win 8.1.

I also presume you are testing under the latest SQLite source?

Thank you.

>
> 2018-06-04 10:41:10 MinGW [D:\work]
>>test
>
> Loop 1, no reset
> 1 2 3 4 5 6 7 8 9 10 !
> sqlite3_reset returns 0
>
> Loop 2, after reset
> 1 2 3 4 5 6 7 8 9 10 !
> sqlite3_reset returns 0
>
>
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
> lot about anticipated traffic volume.
>
>
>>-Original Message-
>>From: sqlite-users [mailto:sqlite-users-
>>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>>Sent: Sunday, 3 June, 2018 22:32
>>To: Discussion of SQLite Database; General Discussion of SQLite
>>Database
>>Subject: [sqlite] Reset the cursor
>>
>>Hi, All,
>>After executing the following:
>>
>>int res = sqlite3_prepare_v2( ... stmt );
>>while( ; ; )
>>{
>>res = sqlite3_step( stmt );
>>if( res == SQLITE_ROW )
>>{
>>// process the record
>>}
>>else if( res == SQLITE_DONE )
>>break;
>>else
>>{
>>// error procressing
>>}
>>}
>>
>>Now I'd like the cursor in the recordset of the "stmt" to go to the
>>record 1
>>so I can process those records again.
>>
>>I thought that this will be a job of sqlite_reset(), but when I
>>called
>>it and started re-processing the recordset I got SQLITE_DONE on the
>>very first iteration.
>>
>>So, how do I reset the cursor to the first record?
>>
>>Thank you.
>>___
>>sqlite-users mailing list
>>sqlite-users@mailinglists.sqlite.org
>>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Keith Medcalf
Works just fine for me ...


#include "sqlite3.h"
#include 

void main(int argc, char** argv)
{
sqlite3* db = 0;
sqlite3_stmt* stmt = 0;
char* rest = 0;
int rc = 0;
int value = 0;
sqlite3_open(":memory:", &db);
rc = sqlite3_prepare_v2(db, "select value from generate_series where 
start=1 and stop=10;", -1, &stmt, (void*)&rest);
if (rc != SQLITE_OK)
{
printf("Error %d during prepare\n", rc);
return;
}
printf("\nLoop 1, no reset\n");
for (;;)
{
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE)
{
printf("!\n");
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
if (rc == SQLITE_ROW)
{
value = sqlite3_column_int(stmt, 0);
printf("%d ", value);
continue;
}
printf("Error during stepping %d\n", rc);
break;
}
printf("\nLoop 2, after reset\n");
for (;;)
{
rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE)
{
printf("!\n");
rc = sqlite3_reset(stmt);
printf("sqlite3_reset returns %d\n", rc);
break;
}
if (rc == SQLITE_ROW)
{
value = sqlite3_column_int(stmt, 0);
printf("%d ", value);
continue;
}
printf("Error during stepping %d\n", rc);
break;
}
}

gcc test.c -L. -lsqlite3 -o test.exe

2018-06-04 10:41:10 MinGW [D:\work]
>test

Loop 1, no reset
1 2 3 4 5 6 7 8 9 10 !
sqlite3_reset returns 0

Loop 2, after reset
1 2 3 4 5 6 7 8 9 10 !
sqlite3_reset returns 0



---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Igor Korot
>Sent: Sunday, 3 June, 2018 22:32
>To: Discussion of SQLite Database; General Discussion of SQLite
>Database
>Subject: [sqlite] Reset the cursor
>
>Hi, All,
>After executing the following:
>
>int res = sqlite3_prepare_v2( ... stmt );
>while( ; ; )
>{
>res = sqlite3_step( stmt );
>if( res == SQLITE_ROW )
>{
>// process the record
>}
>else if( res == SQLITE_DONE )
>break;
>else
>{
>// error procressing
>}
>}
>
>Now I'd like the cursor in the recordset of the "stmt" to go to the
>record 1
>so I can process those records again.
>
>I thought that this will be a job of sqlite_reset(), but when I
>called
>it and started re-processing the recordset I got SQLITE_DONE on the
>very first iteration.
>
>So, how do I reset the cursor to the first record?
>
>Thank you.
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
x,

On Mon, Jun 4, 2018 at 10:54 AM, x  wrote:
> If the first loop exits with res3 == SQLITE_DONE then !result will be true 
> and the second loop should process exactly the same (assuming underlying data 
> is unchanged). I can’t see why the code below wouldn’t work although I’m 
> confused by the fact you say that sqlite3_step(stmt3)  returns SQLITE_DONE 
> immediately after the sqlite3_reset(stmt3) but later say it’s returning 1 
> (SQLITE_ERROR).

Yes, first loop exits with the SQLITE_DONE.
The call to sqlite3_reset() return 0 (success).

But the very first call to sqlite3_step() returns 1 (error). Then the
code goes to execute error handling branch where it calls
sqlite3_errcode().
This function returns 0 - which I think means no error is encountered
during the previous SQLite call.

I can try to get an external error code or the error message though
using the appropriate function.

Thank you.

>
>
> int result = 0,  res3 = SQLITE_OK;
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
> // initial processing
> }
> else if( res3 == SQLITE_DONE )
> break;
> else
> {
> // error handling
> result = 1;
> }
> }
> if( !result )
> {
> res3 = sqlite3_reset( stmt3 );
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
>// actual processing
> }
> else if( res3 == SQLITE_DONE )
>break;
> else
> {
>// error handling
> }
> }
> }
>
> Not sure where this code belongs
>
> if( res3 != SQLITE_DONE )
> break;
> }
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] "cursored" queries and total rows

2018-06-04 Thread heribert
I'm using also paged queries. I'm adding an OFFSET to the select-limit 
query.

Works for me.

Am 03.06.2018 um 14:16 schrieb R Smith:


On 2018/06/03 1:13 PM, Wout Mertens wrote:

Hi all,

To do paged queries on a query like

 SELECT colVal FROM t WHERE b=? LIMIT 10

I keep track of column values and construct a query that will get the 
next

item in a query by augmenting the query like

 SELECT colVal FROM t WHERE b=? AND colVal > ? LIMIT 10


To know how many rows there are in the query, I do

 SELECT COUNT(*) FROM t WHERE b=?


Are there any efficiency tricks here? Is it better to run the count 
before

the query or vice versa?


I assume b is not the Primary Key, (since the use case suggests that 
it repeats), but hopefully it is at least an Index.


- If it is not an Index, the entire system is inefficient.

- If it is an Index, then it doesn't matter which comes first[*], the 
queries are dissimilar enough to not have differing caching advantages 
based on order of execution, except...


- If it is an Index, /and/ the Key repeats magnificently much (Imagine 
adding an "Age" column to a phone-book and then filtering on Age, 
there will be thousands of people who are all 34, for instance) then 
you are better off extracting the set of records to a TEMP table and 
then paginating through the temp table's complete dataset and COUNT(*) 
its rows. This will be extremely fast, especially if the DB is 
otherwise quite hefty, and will allow using the new table's rowids 
(invisible in the query) as pagination pegs. Be sure to use a 
memory-oriented journal mode and cache settings for this, or if not 
possible, perhaps even a second attached in-memory or memory-oriented DB.


[*] - The above assumes there are no FTS tables (or other special 
virtual tables) involved, nor any computed Keys - all of which may 
need more specific considerations.



Cheers,
Ryan

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


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


Re: [sqlite] Reset the cursor

2018-06-04 Thread heribert

ooops... last answer mail was on the wrong topic.

Am 04.06.2018 um 17:57 schrieb heribert:
I'm using also paged queries. I'm adding an OFFSET to the select-limit 
query.

Works for me.

Am 04.06.2018 um 17:54 schrieb x:
If the first loop exits with res3 == SQLITE_DONE then !result will be 
true and the second loop should process exactly the same (assuming 
underlying data is unchanged). I can’t see why the code below 
wouldn’t work although I’m confused by the fact you say that 
sqlite3_step(stmt3)  returns SQLITE_DONE immediately after the 
sqlite3_reset(stmt3) but later say it’s returning 1 (SQLITE_ERROR).



int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
 res3 = sqlite3_step( stmt3 );
 if( res3 == SQLITE_ROW )
 {
 // initial processing
 }
 else if( res3 == SQLITE_DONE )
 break;
 else
 {
 // error handling
 result = 1;
 }
}
if( !result )
{
 res3 = sqlite3_reset( stmt3 );
 for( ; ; )
 {
 res3 = sqlite3_step( stmt3 );
 if( res3 == SQLITE_ROW )
 {
    // actual processing
 }
 else if( res3 == SQLITE_DONE )
    break;
 else
 {
    // error handling
 }
 }
}

Not sure where this code belongs

if( res3 != SQLITE_DONE )
break;
}

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


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


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


Re: [sqlite] Reset the cursor

2018-06-04 Thread heribert
I'm using also paged queries. I'm adding an OFFSET to the select-limit 
query.

Works for me.

Am 04.06.2018 um 17:54 schrieb x:

If the first loop exits with res3 == SQLITE_DONE then !result will be true and 
the second loop should process exactly the same (assuming underlying data is 
unchanged). I can’t see why the code below wouldn’t work although I’m confused 
by the fact you say that sqlite3_step(stmt3)  returns SQLITE_DONE immediately 
after the sqlite3_reset(stmt3) but later say it’s returning 1 (SQLITE_ERROR).


int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
 res3 = sqlite3_step( stmt3 );
 if( res3 == SQLITE_ROW )
 {
 // initial processing
 }
 else if( res3 == SQLITE_DONE )
 break;
 else
 {
 // error handling
 result = 1;
 }
}
if( !result )
{
 res3 = sqlite3_reset( stmt3 );
 for( ; ; )
 {
 res3 = sqlite3_step( stmt3 );
 if( res3 == SQLITE_ROW )
 {
// actual processing
 }
 else if( res3 == SQLITE_DONE )
break;
 else
 {
// error handling
 }
 }
}

Not sure where this code belongs

if( res3 != SQLITE_DONE )
break;
}

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


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


Re: [sqlite] Reset the cursor

2018-06-04 Thread x
If the first loop exits with res3 == SQLITE_DONE then !result will be true and 
the second loop should process exactly the same (assuming underlying data is 
unchanged). I can’t see why the code below wouldn’t work although I’m confused 
by the fact you say that sqlite3_step(stmt3)  returns SQLITE_DONE immediately 
after the sqlite3_reset(stmt3) but later say it’s returning 1 (SQLITE_ERROR).


int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
// initial processing
}
else if( res3 == SQLITE_DONE )
break;
else
{
// error handling
result = 1;
}
}
if( !result )
{
res3 = sqlite3_reset( stmt3 );
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
   // actual processing
}
else if( res3 == SQLITE_DONE )
   break;
else
{
   // error handling
}
}
}

Not sure where this code belongs

if( res3 != SQLITE_DONE )
break;
}

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


Re: [sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread Simon Slavin
On 4 Jun 2018, at 6:59am, ayagmur  wrote:

> When I try to delete 100 MB data by cascade (1 parent record - 100 child 
> records) it takes too long time (almost 10 minute) to complete, and the 
> duration increase/decrease by size of data (100 Mb: 10 minute, 300 MB: 30 
> minute,etc)

What medium is your database stored on ?  Is it a spinning-rust hard disk ?  If 
so, do you have a way of finding out the rotation speed ?

Is your database stored on the same computer running SQLite or is it being 
accessed across a network ?

My other two questions are the ones Olivier Mascia asked, and you can use the 
SQLite command-line utility to answer them:

What is the response to "PRAGMA secure_delete" ?
What is the response to "PRAGMA auto_vacuum" ?

For speed testing, try changing the settings on these and tell us whether that 
makes any difference.

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


Re: [sqlite] Reset the cursor

2018-06-04 Thread x
Sorry, I didn’t notice res3 was reassigned just before the comparison. I was 
confused by you setting res3 = SQLITE_OK on the first line as I can see no 
purpose to that.




From: sqlite-users  on behalf of 
Igor Korot 
Sent: Monday, June 4, 2018 3:44:57 PM
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

x,

On Mon, Jun 4, 2018 at 9:42 AM, x  wrote:
> int result = 0,  res3 = SQLITE_OK;
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
>
>
> As I said in previous post a successful sqlite3_step doesn’t return SQLITE_OK 
> so
>
> res3 == SQLITE_ROW is never true.

But SQLITE_OK != SQLITE_ROW.

Thank you.

>
>
>
>
>
> 
> From: sqlite-users  on behalf 
> of Igor Korot 
> Sent: Monday, June 4, 2018 3:33:54 PM
> To: SQLite mailing list
> Subject: Re: [sqlite] Reset the cursor
>
> Hi, Igor,
>
> On Mon, Jun 4, 2018 at 7:55 AM, Igor Tandetnik  wrote:
>> On 6/4/2018 12:31 AM, Igor Korot wrote:
>>>
>>> Now I'd like the cursor in the recordset of the "stmt" to go to the record
>>> 1
>>> so I can process those records again.
>>>
>>> I thought that this will be a job of sqlite_reset(), but when I called
>>> it and started re-processing the recordset I got SQLITE_DONE on the
>>> very first iteration.
>>
>>
>> sqlite_reset definitely works. The problem must be somewhere in the code you
>> haven't shown. Can you reproduce in a small complete example?
>
> Following the exact code taken from y source.
> Can you spot an error?
>
> [code]
> int result = 0,  res3 = SQLITE_OK;
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
> // initial processing
> }
> else if( res3 == SQLITE_DONE )
> break;
> else
> {
> // error handling
> result = 1;
> }
> }
> if( !result )
> {
> res3 = sqlite3_reset( stmt3 );
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
> // actual processing
> }
> else if( res3 == SQLITE_DONE )
> break;
> else
> {
> // error handling
> }
> }
> }
> if( res3 != SQLITE_DONE )
> break;
> }[/code]
>
> Thank you.
>
>> --
>> Igor Tandetnik
>>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
x,

On Mon, Jun 4, 2018 at 9:42 AM, x  wrote:
> int result = 0,  res3 = SQLITE_OK;
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
>
>
> As I said in previous post a successful sqlite3_step doesn’t return SQLITE_OK 
> so
>
> res3 == SQLITE_ROW is never true.

But SQLITE_OK != SQLITE_ROW.

Thank you.

>
>
>
>
>
> 
> From: sqlite-users  on behalf 
> of Igor Korot 
> Sent: Monday, June 4, 2018 3:33:54 PM
> To: SQLite mailing list
> Subject: Re: [sqlite] Reset the cursor
>
> Hi, Igor,
>
> On Mon, Jun 4, 2018 at 7:55 AM, Igor Tandetnik  wrote:
>> On 6/4/2018 12:31 AM, Igor Korot wrote:
>>>
>>> Now I'd like the cursor in the recordset of the "stmt" to go to the record
>>> 1
>>> so I can process those records again.
>>>
>>> I thought that this will be a job of sqlite_reset(), but when I called
>>> it and started re-processing the recordset I got SQLITE_DONE on the
>>> very first iteration.
>>
>>
>> sqlite_reset definitely works. The problem must be somewhere in the code you
>> haven't shown. Can you reproduce in a small complete example?
>
> Following the exact code taken from y source.
> Can you spot an error?
>
> [code]
> int result = 0,  res3 = SQLITE_OK;
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
> // initial processing
> }
> else if( res3 == SQLITE_DONE )
> break;
> else
> {
> // error handling
> result = 1;
> }
> }
> if( !result )
> {
> res3 = sqlite3_reset( stmt3 );
> for( ; ; )
> {
> res3 = sqlite3_step( stmt3 );
> if( res3 == SQLITE_ROW )
> {
> // actual processing
> }
> else if( res3 == SQLITE_DONE )
> break;
> else
> {
> // error handling
> }
> }
> }
> if( res3 != SQLITE_DONE )
> break;
> }[/code]
>
> Thank you.
>
>> --
>> Igor Tandetnik
>>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread x
int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )


As I said in previous post a successful sqlite3_step doesn’t return SQLITE_OK so

res3 == SQLITE_ROW is never true.






From: sqlite-users  on behalf of 
Igor Korot 
Sent: Monday, June 4, 2018 3:33:54 PM
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

Hi, Igor,

On Mon, Jun 4, 2018 at 7:55 AM, Igor Tandetnik  wrote:
> On 6/4/2018 12:31 AM, Igor Korot wrote:
>>
>> Now I'd like the cursor in the recordset of the "stmt" to go to the record
>> 1
>> so I can process those records again.
>>
>> I thought that this will be a job of sqlite_reset(), but when I called
>> it and started re-processing the recordset I got SQLITE_DONE on the
>> very first iteration.
>
>
> sqlite_reset definitely works. The problem must be somewhere in the code you
> haven't shown. Can you reproduce in a small complete example?

Following the exact code taken from y source.
Can you spot an error?

[code]
int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
// initial processing
}
else if( res3 == SQLITE_DONE )
break;
else
{
// error handling
result = 1;
}
}
if( !result )
{
res3 = sqlite3_reset( stmt3 );
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
// actual processing
}
else if( res3 == SQLITE_DONE )
break;
else
{
// error handling
}
}
}
if( res3 != SQLITE_DONE )
break;
}[/code]

Thank you.

> --
> Igor Tandetnik
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
x,

On Mon, Jun 4, 2018 at 9:12 AM, x  wrote:
> Sorry, just looked that up. 1 is SQLITE_ERROR. 100 is SQLITE_ROW
>
>
>
> But note that a successful sqlite3_step does not return SQLITE_OK (0). Are 
> you maybe converting the result to Boolean?

Please see the code I posted in reply to Igor's post.

Thank you.

>
>
>
> 
> From: sqlite-users  on behalf 
> of Igor Korot 
> Sent: Monday, June 4, 2018 1:52:05 PM
> To: SQLite mailing list
> Subject: Re: [sqlite] Reset the cursor
>
> Hi,
>
> On Mon, Jun 4, 2018 at 7:54 AM, Igor Korot  wrote:
>> Hi, Clemens et al,
>>
>> On Mon, Jun 4, 2018 at 1:23 AM, Clemens Ladisch  wrote:
>>> Igor Korot wrote:
 res = sqlite3_step( stmt );

 Now I'd like the cursor in the recordset of the "stmt" to go to the record 
 1
 so I can process those records again.
>>>
>>> Strictly speaking, it is not possible to go back in the _same_ cursor.
>>> You'd have to execute the query again (by calling sqlite3_reset() and
>>> sqlite3_step()), and if you're not in a transaction, the data might
>>> have been modified between these two calls.
>>>
 I thought that this will be a job of sqlite_reset(), but when I called
 it and started re-processing the recordset I got SQLITE_DONE on the
 very first iteration.
>>>
>>> In theory, executing the same query on the same data should work again.
>>> Did you accidentally call sqlite3_clear_bindings()?
>>
>> No, I didn't clear anything.
>> I just call sqlite3_reset() and sqlite3_step() and receive an error.
>
> In addition:
> As I said calling sqlite3_step() after sqlite3_reset() returns 1 (error).
> However calling sqlite3_errcode() right after returns 0 (which is
> success, right)
>
> Thank you.
>
>>
>> Thank you.
>>
>>>
>>>
>>> Regards,
>>> Clemens
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@mailinglists.sqlite.org
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Hi, Igor,

On Mon, Jun 4, 2018 at 7:55 AM, Igor Tandetnik  wrote:
> On 6/4/2018 12:31 AM, Igor Korot wrote:
>>
>> Now I'd like the cursor in the recordset of the "stmt" to go to the record
>> 1
>> so I can process those records again.
>>
>> I thought that this will be a job of sqlite_reset(), but when I called
>> it and started re-processing the recordset I got SQLITE_DONE on the
>> very first iteration.
>
>
> sqlite_reset definitely works. The problem must be somewhere in the code you
> haven't shown. Can you reproduce in a small complete example?

Following the exact code taken from y source.
Can you spot an error?

[code]
int result = 0,  res3 = SQLITE_OK;
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
// initial processing
}
else if( res3 == SQLITE_DONE )
break;
else
{
// error handling
result = 1;
}
}
if( !result )
{
res3 = sqlite3_reset( stmt3 );
for( ; ; )
{
res3 = sqlite3_step( stmt3 );
if( res3 == SQLITE_ROW )
{
// actual processing
}
else if( res3 == SQLITE_DONE )
break;
else
{
// error handling
}
}
}
if( res3 != SQLITE_DONE )
break;
}[/code]

Thank you.

> --
> Igor Tandetnik
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread x
Sorry, just looked that up. 1 is SQLITE_ERROR. 100 is SQLITE_ROW



But note that a successful sqlite3_step does not return SQLITE_OK (0). Are you 
maybe converting the result to Boolean?




From: sqlite-users  on behalf of 
Igor Korot 
Sent: Monday, June 4, 2018 1:52:05 PM
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

Hi,

On Mon, Jun 4, 2018 at 7:54 AM, Igor Korot  wrote:
> Hi, Clemens et al,
>
> On Mon, Jun 4, 2018 at 1:23 AM, Clemens Ladisch  wrote:
>> Igor Korot wrote:
>>> res = sqlite3_step( stmt );
>>>
>>> Now I'd like the cursor in the recordset of the "stmt" to go to the record 1
>>> so I can process those records again.
>>
>> Strictly speaking, it is not possible to go back in the _same_ cursor.
>> You'd have to execute the query again (by calling sqlite3_reset() and
>> sqlite3_step()), and if you're not in a transaction, the data might
>> have been modified between these two calls.
>>
>>> I thought that this will be a job of sqlite_reset(), but when I called
>>> it and started re-processing the recordset I got SQLITE_DONE on the
>>> very first iteration.
>>
>> In theory, executing the same query on the same data should work again.
>> Did you accidentally call sqlite3_clear_bindings()?
>
> No, I didn't clear anything.
> I just call sqlite3_reset() and sqlite3_step() and receive an error.

In addition:
As I said calling sqlite3_step() after sqlite3_reset() returns 1 (error).
However calling sqlite3_errcode() right after returns 0 (which is
success, right)

Thank you.

>
> Thank you.
>
>>
>>
>> Regards,
>> Clemens
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread x
Igor, if sqlite3_step is successful it returns SQLITE_ROW which is 1.




From: sqlite-users  on behalf of 
Igor Korot 
Sent: Monday, June 4, 2018 1:52:05 PM
To: SQLite mailing list
Subject: Re: [sqlite] Reset the cursor

Hi,

On Mon, Jun 4, 2018 at 7:54 AM, Igor Korot  wrote:
> Hi, Clemens et al,
>
> On Mon, Jun 4, 2018 at 1:23 AM, Clemens Ladisch  wrote:
>> Igor Korot wrote:
>>> res = sqlite3_step( stmt );
>>>
>>> Now I'd like the cursor in the recordset of the "stmt" to go to the record 1
>>> so I can process those records again.
>>
>> Strictly speaking, it is not possible to go back in the _same_ cursor.
>> You'd have to execute the query again (by calling sqlite3_reset() and
>> sqlite3_step()), and if you're not in a transaction, the data might
>> have been modified between these two calls.
>>
>>> I thought that this will be a job of sqlite_reset(), but when I called
>>> it and started re-processing the recordset I got SQLITE_DONE on the
>>> very first iteration.
>>
>> In theory, executing the same query on the same data should work again.
>> Did you accidentally call sqlite3_clear_bindings()?
>
> No, I didn't clear anything.
> I just call sqlite3_reset() and sqlite3_step() and receive an error.

In addition:
As I said calling sqlite3_step() after sqlite3_reset() returns 1 (error).
However calling sqlite3_errcode() right after returns 0 (which is
success, right)

Thank you.

>
> Thank you.
>
>>
>>
>> Regards,
>> Clemens
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Tandetnik

On 6/4/2018 12:31 AM, Igor Korot wrote:

Now I'd like the cursor in the recordset of the "stmt" to go to the record 1
so I can process those records again.

I thought that this will be a job of sqlite_reset(), but when I called
it and started re-processing the recordset I got SQLITE_DONE on the
very first iteration.


sqlite_reset definitely works. The problem must be somewhere in the code you 
haven't shown. Can you reproduce in a small complete example?
--
Igor Tandetnik


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


Re: [sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread Donald Griggs
If you don't already do this, you'll want to be sure the large blob(s)  are
the *last* fields in the table definition.


On Mon, Jun 4, 2018 at 8:49 AM Paul Sanderson 
wrote:

> Have you made sure aut_ovacuum is disabled?
>
> pragma *auto_vacuum  * = 0
>
> have you got a nice large pagesize if your records are that big?
>
>
>
> Paul
> www.sandersonforensics.com
> SQLite Forensics Book 
>
> On 4 June 2018 at 13:01, Olivier Mascia  wrote:
>
> > Hello,
> >
> > > Sqlite delete too slow in 4 GB database
> >
> > What does:
> >
> > 'pragma secure_delete;'
> >
> > and
> >
> > 'pragma auto_vacuum;'
> >
> > say, on that db?
> >
> > --
> > Best Regards, Meilleures salutations, Met vriendelijke groeten,
> > Olivier Mascia
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Hi,

On Mon, Jun 4, 2018 at 7:54 AM, Igor Korot  wrote:
> Hi, Clemens et al,
>
> On Mon, Jun 4, 2018 at 1:23 AM, Clemens Ladisch  wrote:
>> Igor Korot wrote:
>>> res = sqlite3_step( stmt );
>>>
>>> Now I'd like the cursor in the recordset of the "stmt" to go to the record 1
>>> so I can process those records again.
>>
>> Strictly speaking, it is not possible to go back in the _same_ cursor.
>> You'd have to execute the query again (by calling sqlite3_reset() and
>> sqlite3_step()), and if you're not in a transaction, the data might
>> have been modified between these two calls.
>>
>>> I thought that this will be a job of sqlite_reset(), but when I called
>>> it and started re-processing the recordset I got SQLITE_DONE on the
>>> very first iteration.
>>
>> In theory, executing the same query on the same data should work again.
>> Did you accidentally call sqlite3_clear_bindings()?
>
> No, I didn't clear anything.
> I just call sqlite3_reset() and sqlite3_step() and receive an error.

In addition:
As I said calling sqlite3_step() after sqlite3_reset() returns 1 (error).
However calling sqlite3_errcode() right after returns 0 (which is
success, right)

Thank you.

>
> Thank you.
>
>>
>>
>> Regards,
>> Clemens
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread Paul Sanderson
Have you made sure aut_ovacuum is disabled?

pragma *auto_vacuum  * = 0

have you got a nice large pagesize if your records are that big?



Paul
www.sandersonforensics.com
SQLite Forensics Book 

On 4 June 2018 at 13:01, Olivier Mascia  wrote:

> Hello,
>
> > Sqlite delete too slow in 4 GB database
>
> What does:
>
> 'pragma secure_delete;'
>
> and
>
> 'pragma auto_vacuum;'
>
> say, on that db?
>
> --
> Best Regards, Meilleures salutations, Met vriendelijke groeten,
> Olivier Mascia
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread Olivier Mascia
Hello,

> Sqlite delete too slow in 4 GB database

What does:

'pragma secure_delete;'

and

'pragma auto_vacuum;'

say, on that db?

-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia


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


Re: [sqlite] Reset the cursor

2018-06-04 Thread Igor Korot
Hi, Clemens et al,

On Mon, Jun 4, 2018 at 1:23 AM, Clemens Ladisch  wrote:
> Igor Korot wrote:
>> res = sqlite3_step( stmt );
>>
>> Now I'd like the cursor in the recordset of the "stmt" to go to the record 1
>> so I can process those records again.
>
> Strictly speaking, it is not possible to go back in the _same_ cursor.
> You'd have to execute the query again (by calling sqlite3_reset() and
> sqlite3_step()), and if you're not in a transaction, the data might
> have been modified between these two calls.
>
>> I thought that this will be a job of sqlite_reset(), but when I called
>> it and started re-processing the recordset I got SQLITE_DONE on the
>> very first iteration.
>
> In theory, executing the same query on the same data should work again.
> Did you accidentally call sqlite3_clear_bindings()?

No, I didn't clear anything.
I just call sqlite3_reset() and sqlite3_step() and receive an error.

Thank you.

>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread Eduardo
On Sun, 3 Jun 2018 22:59:05 -0700 (MST)
ayagmur  escribió:

> I have been using ext2 file system. I have a database which has 4 GB size.
> Database consist of 1 parent table and 1 child table. Parent table has 10
> rows and child table has 4000 rows. 1 row of child table has 1 MB size. when
> I delete a row in parent table, deletion cascades 1MB-sized child records.
> (pragma foreign_keys is on) When I try to delete 100 MB data by cascade (1
> parent record - 100 child records) it takes too long time (almost 10 minute)
> to complete, and the duration increase/decrease by size of data (100 Mb: 10
> minute, 300 MB: 30 minute,etc).I tried some pragma commands (synchronous,
> temp_store, journal_mode) suggested by others posts and i also tried to add
> index on foreign key, but those does not help solve my problem.(Actually,
> after adding index on foreign key, 1 MB data deletion became faster/st, but
> 100 MB data deletion duration did not change) Can you give me please any
> suggestion to increase deletion performance?

Don't hard-delete. You have 2 options to soft-delete (I use both on my big fs
over sqlite):

a) Add a new column to child, put it before the data blob column and set it to
0 if it is active or 1 when delete. From time to time select those actives and
move them to a new fresh table.

b) Parent has the foreign key to the childs, just set those foreign keys to 0
or to the new content. From time to time select all foreign keys to child on
parent table and move them to a new fresh table. Disable foreign_key pragma. 

Now I use b) with parent (fs metadata) on one db file and child (file content)
on another, it's faster and don't require an additional column on child.

Clean child table/db when you want, I never did it on mines for now.

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


[sqlite] Sqlite delete too slow in 4 GB database

2018-06-04 Thread ayagmur
I have been using ext2 file system. I have a database which has 4 GB size.
Database consist of 1 parent table and 1 child table. Parent table has 10
rows and child table has 4000 rows. 1 row of child table has 1 MB size. when
I delete a row in parent table, deletion cascades 1MB-sized child records.
(pragma foreign_keys is on) When I try to delete 100 MB data by cascade (1
parent record - 100 child records) it takes too long time (almost 10 minute)
to complete, and the duration increase/decrease by size of data (100 Mb: 10
minute, 300 MB: 30 minute,etc).I tried some pragma commands (synchronous,
temp_store, journal_mode) suggested by others posts and i also tried to add
index on foreign key, but those does not help solve my problem.(Actually,
after adding index on foreign key, 1 MB data deletion became faster/st, but
100 MB data deletion duration did not change) Can you give me please any
suggestion to increase deletion performance?



--
Sent from: http://sqlite.1065341.n5.nabble.com/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users