Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Don Walsh
Stop On Fri, Apr 5, 2019, 11:31 AM James K. Lowden wrote: > On Fri, 5 Apr 2019 15:45:10 +0300 > Arthur Blondel wrote: > > > The data is always the same. That's why removing one row should be > > enough to insert a new one. > > My problem is that some times I need to remove many rows to add one

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Richard Damon
On Apr 5, 2019, at 12:31 PM, James K. Lowden wrote: > > On Fri, 5 Apr 2019 15:45:10 +0300 > Arthur Blondel wrote: > >> The data is always the same. That's why removing one row should be >> enough to insert a new one. >> My problem is that some times I need to remove many rows to add one >> new

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread James K. Lowden
On Fri, 5 Apr 2019 15:45:10 +0300 Arthur Blondel wrote: > The data is always the same. That's why removing one row should be > enough to insert a new one. > My problem is that some times I need to remove many rows to add one > new one. SQLite *could* avoid that problem by pre-allocating space

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Ling, Andy
> On 4/5/19 11:14 AM, Arthur Blondel wrote: > > I have enough disk space. I just limit the database file size artificially > > for testing purpose as you can see. > > There is no problem of privilege and there is nothing else than the code I > > sent. No other access to the DB. > > I'm using

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Richard Damon
On 4/5/19 11:14 AM, Arthur Blondel wrote: > I have enough disk space. I just limit the database file size artificially > for testing purpose as you can see. > There is no problem of privilege and there is nothing else than the code I > sent. No other access to the DB. > I'm using sqlite 3.16.2 As

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Arthur Blondel
I have enough disk space. I just limit the database file size artificially for testing purpose as you can see. There is no problem of privilege and there is nothing else than the code I sent. No other access to the DB. I'm using sqlite 3.16.2 On Fri, Apr 5, 2019 at 3:59 PM Chris Locke wrote: >

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Simon Slavin
On 5 Apr 2019, at 1:45pm, Arthur Blondel wrote: > I'm limited in space so when the DB is full (when sqlite3_exec() returns > SQLITE_FULL when I try to insert a new row), I remove the oldest row If SQLite returns SQLITE_FULL you cannot reliably do anything else to the database. Because even

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread David Raymond
uot;B" names. -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Arthur Blondel Sent: Friday, April 05, 2019 8:45 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] Remove row to insert new one on a full database OK,

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Chris Locke
Arthur - are you running SQLite in parallel runs? If you access the database file using the sqlite3 command-line tool, and try to execute the same SQL commands, do you get the same error ? SQLite makes a temporary 'journal' file while it's working. I think that, on your platform, by default it

Re: [sqlite] Remove row to insert new one on a full database

2019-04-05 Thread Arthur Blondel
OK, I wasn't clear. I'm limited in space so when the DB is full (when sqlite3_exec() returns SQLITE_FULL when I try to insert a new row), I remove the oldest row and retry to insert the new one. The data is always the same. That's why removing one row should be enough to insert a new one. My

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Richard Damon
On 4/4/19 11:35 PM, Simon Slavin wrote: > On 5 Apr 2019, at 4:14am, Richard Damon wrote: > >> I think is logic is to attempt to insert a row, and if rather than >> inserting it, the call returns the error condition, 'Database Full' > Okay. So now we understand what OP meant by the database being

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Simon Slavin
On 5 Apr 2019, at 4:14am, Richard Damon wrote: > I think is logic is to attempt to insert a row, and if rather than > inserting it, the call returns the error condition, 'Database Full' Okay. So now we understand what OP meant by the database being full. SQLITE_FULL does not mean 'Database

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Richard Damon
I think is logic is to attempt to insert a row, and if rather than inserting it, the call returns the error condition, 'Database Full', you remove a record and then try again (a form of error recovery), if it succeeds, then you go on and get more data. If full was X records, then they would

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Stephen Chrzanowski
This almost sounds like "Full" is a software limitation, in that your application is specifying that "Full" means you can only have "X" number of rows. If you're looking to remove data, I'd suggest that you find some way to isolate the oldest record, either by a row identifier (Like an ID field

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Richard Damon
On 4/4/19 2:07 AM, Arthur Blondel wrote: > Hello > > When I try to insert new data to a full SQLite database, I need to remove > much more than really needed. I'm doing the following: > > while(1) { > do { > status = insert_1_row_to_db(); > if (status == full) { >

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Roger Schlueter
This looks to be an example of the classic XY Problem.  You are asking how to solve Problem X when what you're trying to do is solve Problem Y.  In this case, "X" is a full database, which is almost certainly an oxymoron since SQLIte can store millions of rows of data.  It is not clear what

Re: [sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Chris Locke
> When the database is full What do you mean by a full database? Do you mean when the operating system has run out of disk space? A SQLite database can hold millions of rows, so technically, a database cannot be 'full'. It would be easier explaining the full issue and what you consider the

[sqlite] Remove row to insert new one on a full database

2019-04-04 Thread Arthur Blondel
Hello When I try to insert new data to a full SQLite database, I need to remove much more than really needed. I'm doing the following: while(1) { do { status = insert_1_row_to_db(); if (status == full) { remove_one_row_from_db(); } } while (status ==