[sqlite] Data view mismatch on first OpenWRT startup

2018-09-09 Thread Ward WIllats
Hi. I've got kind of a weird situation and I'd value your thoughts. Our OpenWRT-based Linux embedded system, on very first boot, will startup with a root filesystem on a RAM (ramFS) mount while the JFFS partition receives an initial format. Once the JFFS is formatted and most of the init

Re: [sqlite] SQLite version 3.21.0 in approximately two weeks

2017-10-11 Thread Ward WIllats
> On Oct 11, 2017, at 4:26 AM, Richard Hipp wrote: > > A summary of changes for the 3.21.0 release can be seen at > >https://sqlite.org/draft/releaselog/3_21_0.html Item #5: "A forger can subverted" ==> "A forger can subvert"

Re: [sqlite] Corrupt index == disk full?

2017-05-10 Thread Ward Willats
> On May 10, 2017, at 10:49 AM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 10 May 2017, at 6:31pm, Ward WIllats <sqlite-us...@wardco.com> wrote: > >> I guess with corruption, all bets are off > > I see your results from "pragma integrity_ch

Re: [sqlite] Corrupt index == disk full?

2017-05-10 Thread Ward WIllats
> On May 10, 2017, at 2:20 PM, Simon Slavin wrote: > I’m concerned that this sort of corruption is happening repeatedly. Whether > or not there’s anything in howtocorrupt.html that rings any bells, you can > rely on us to help figure out what’s wrong. > Thanks. That's

Re: [sqlite] Corrupt index == disk full?

2017-05-10 Thread Ward WIllats
> On May 10, 2017, at 10:49 AM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 10 May 2017, at 6:31pm, Ward WIllats <sqlite-us...@wardco.com> wrote: > >> I guess with corruption, all bets are off > > I see your results from "pragma integrity_ch

[sqlite] Corrupt index == disk full?

2017-05-10 Thread Ward WIllats
Hello. We have a DB with a corrupted index (see below). The database has a max_pages limit that works out to a 10 MB database size (we're embedded). We can insert into the table the index is on OK. When we do a SELECT out of the table that uses the index, we get a "disk or database full"

[sqlite] Magic self-healing database!

2017-02-21 Thread Ward WIllats
Hello List. Well, here's something I haven't seen before. I've got a DB in WAL mode on an embedded Linux system. My app (which has several threads, each with a connection, with Sqlite running fully serialized) was reporting database corruption in its logs. Sun Feb 19 07:52:45 2017 user.warn

[sqlite] Deprecated OSX functioon

2017-02-16 Thread Ward WIllats
This has been coming across my console when building Sqlite since upgrading to Mac OSX Sierra a few months ago. FWIW. Building sqlite3 shell... sqlite3.c:20839:17: warning: 'OSAtomicCompareAndSwapPtrBarrier' is deprecated: first deprecated in macOS 10.12 - Use atomic_compare_exchange_strong()

Re: [sqlite] sqlite3_errmsg() after sqlitr3_exec() on ATTACHed DB

2017-02-01 Thread Ward WIllats
> On Feb 1, 2017, at 1:18 PM, Igor Tandetnik <i...@tandetnik.org> wrote: > > On 2/1/2017 10:32 AM, Ward WIllats wrote: >> When I perform an sqlite3_exec() to DELETE too many rows in the secondary >> ATTACHed database and a disk or database full error occurs, I

[sqlite] sqlite3_errmsg() after sqlitr3_exec() on ATTACHed DB

2017-02-01 Thread Ward WIllats
Hello. In our embedded system we have two databases ATTACHed to each other and size constrained with max_page pragmas directed at each. (Different filesystems: one is on a tmpfs in RAM, the other on JFFS). When I perform an sqlite3_exec() to DELETE too many rows in the secondary ATTACHed

Re: [sqlite] DELETE when DB is full

2017-02-01 Thread Ward WIllats
> On Jan 31, 2017, at 3:54 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 31 Jan 2017, at 10:40pm, Warren Young <war...@etr-usa.com> wrote: > >> On Jan 31, 2017, at 2:03 PM, Ward WIllats <sqlite-us...@wardco.com> wrote: >> >>> the d

[sqlite] DELETE when DB is full

2017-01-31 Thread Ward WIllats
Hello. We have an embedded system out in the wild with a DB in WALL mode that we set a max_pages value on to keep its size constrained. The system is more or less a data logger. We run a "purger" thread at intervals to DELETE records when it discovers free space is running below a threshold.

Re: [sqlite] page_size on ATTACH-ed databases

2016-08-16 Thread Ward WIllats
le.com> wrote: > > Is there any possibility that the attached db already existed before > you ran this? Because once a db exists (contains pages) the page size > is fixed until you run vacuum. > > On Tue, Aug 16, 2016 at 10:53 AM, Ward WIllats <sqlite-us...@wardco.com>

Re: [sqlite] page_size on ATTACH-ed databases

2016-08-16 Thread Ward WIllats
>> On Aug 12, 2016, at 11:44 PM, Dan Kennedy <danielk1...@gmail.com> wrote: >> >> On 08/13/2016 01:14 AM, Ward WIllats wrote: >> >> Can't reproduce this problem here. Are you able to reproduce it with the >> shell tool? >> > > > Yes,

Re: [sqlite] page_size on ATTACH-ed databases

2016-08-13 Thread Ward WIllats
> On Aug 12, 2016, at 11:44 PM, Dan Kennedy <danielk1...@gmail.com> wrote: > > On 08/13/2016 01:14 AM, Ward WIllats wrote: > > Can't reproduce this problem here. Are you able to reproduce it with the > shell tool? > Yes, if I use the shell on our embedded syste

[sqlite] page_size on ATTACH-ed databases

2016-08-12 Thread Ward WIllats
Consider: 1. Create a new database, set the pragma page_size=512 2. Create a new database on the connection with ATTACH DATABASE '/tmp/number_two.db' AS second; 3. Issue pragma second.page_size=4096 to try and set the page size on the attached DB to 4096. 4. Read back with pragma

Re: [sqlite] max_page_count wont round-trip between shell and program

2016-07-05 Thread Ward WIllats
> On Jul 5, 2016, at 3:18 PM, David Empson <demp...@emptech.co.nz> wrote: > > >> On 6/07/2016, at 8:55 AM, Ward WIllats <sqlite-us...@wardco.com> wrote: >> >>> I have noticed that when I set max_page_count programatically to 16384 and >>> rea

Re: [sqlite] max_page_count wont round-trip between shell and program

2016-07-05 Thread Ward WIllats
> On 2016/07/05 10:50 PM, R Smith wrote: > The page size of the DB doesn't actually change until you repack it (unless > it is new) - I think. > > Try the test running "VACUUM;" after setting the page size to repack the DB > in that page size and so make it stick outside of the current

[sqlite] max_page_count wont round-trip between shell and program

2016-07-05 Thread Ward WIllats
> I have noticed that when I set max_page_count programatically to 16384 and > read it back with the shell I get 1073741823. > If I set max_page_count with the shell to 16384 and read it back > programmatically, the program gets back 1073741823. > Both the program and the shell can round-trip

[sqlite] max_page_count wont round-trip between shell and program

2016-07-05 Thread Ward WIllats
I have noticed that when I set max_page_count programatically to 16384 and read it back with the shell I get 1073741823. If I set max_page_count with the shell to 16384 and read it back programmatically, the program gets back 1073741823. Both the program and the shell can round-trip their own

[sqlite] pragma foreign_keys attribute of connection?

2016-03-02 Thread Ward WIllats
> On Mar 2, 2016, at 6:53 PM, Ward WIllats wrote: > > Now, this diagnosis may or may not be correct, Indeed, it is not. Never mind! Thanks! -- Ward

[sqlite] pragma foreign_keys attribute of connection?

2016-03-02 Thread Ward WIllats
Hello. We have multiple processes trying to access an sqlite DB while one of them is inside a transaction trying to migrate the schema. Before the migrate transaction is started, pragma foreign_keys=0 is executed. Yet, in the middle of the migration, we get a constraint violation as though

[sqlite] Caveats using Sqlite on JFFS2 ?

2016-01-04 Thread Ward WIllats
Happy New Year folks. Subject says it all. Any things to look out for when using Sqlite on a JFFS2 filesystem? I see some old stuff from 2011 about WAL mode and MMAP_SHARED, but suspect that is no longer germane? Anything else to watch out for? (This would be for an Open-WRT style embedded

[sqlite] Slow real world performance - Any suggestions please (warning long)

2015-07-02 Thread Ward Willats
> On Jul 2, 2015, at 3:16 PM, Rob Willett > wrote: > > We?re trying to understand whether or not we have a performance problem with > our Sqlite database. It may or may not apply to your situation, but after doing lots of inserts, running ANALYZE can sometimes work wonders. -- Ward

[sqlite] Dumb statement question...

2015-06-08 Thread Ward Willats
Can a prepared statement have more than 1 statement in it (and bind parameters across the whole thing)? Something like: prepare_v2( h, "one statement ? ; two statement ?", -1, , NULL ) bind_int( s, 1, ) bind_int( s, 2, ) (I ask because I am getting a SQLITE_RANGE (25) error just

[sqlite] Corrupting pointers to the lookaside smallacator

2014-11-25 Thread Ward Willats
We are compiling the 3.8.7.1 using clang arm64 for iOS. Following set: #define SQLITE_ENABLE_COLUMN_METADATA 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_USLEEP 1 #define SQLITE_DEBUG 1 #define SQLITE_MEMDEBUG 1 WAL mode. In MallowRaw(), very rarely, seeing the lookaside

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Ward Willats
> On Nov 10, 2014, at 9:31 AM, Richard Hipp <d...@sqlite.org> wrote: > > On Mon, Nov 10, 2014 at 12:28 PM, Ward Willats <sqlite-us...@wardco.com> > wrote: > >> >>> On Nov 10, 2014, at 3:11 AM, Richard Hipp <d...@sqlite.org> wrote: >>

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Ward Willats
> On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote: > > If you recompile the SQLite command-line shell (sqlite3.exe) using the > -DSQLITE_ENABLE_SELECTTRACE option, then you can enter: > If I do that, gcc -D SQLITE_ENABLE_SELECTTRACE -D HAVE_READLINE -l readline -o

Re: [sqlite] sqlite3.c in a library - api rename

2014-10-28 Thread Ward Willats
> On Oct 28, 2014, at 8:23 PM, Richard Hipp <d...@sqlite.org> wrote: > > On Tue, Oct 28, 2014 at 11:18 PM, Ward Willats <sqlite-us...@wardco.com> > wrote: > >> Hello. >> >> I am using the amalgamation in a C++ library statically linked into other &g

[sqlite] sqlite3.c in a library - api rename

2014-10-28 Thread Ward Willats
Hello. I am using the amalgamation in a C++ library statically linked into other people's applications. Is there a way to namespace and/or macro and/or let C++ do its name-mangling thing to all the identifiers (by running the CPP compiler and turning __cplusplus off) so only my library

[sqlite] CONFIG_SERIALIED superset of CONFIG_MULITHREAD?

2014-10-07 Thread Ward Willats
Hello. I'm wondering if CONFIG_SERIALIZED is a superset of CONFIG_MULITHREAD, recursive mutex wise. I imagine MULTITHREAD is turning on mutexes to protect the pager and other "low-level" execution stuff, and SERIALIZED is turning on more mutexes to protect stuff hanging off the connection,

Re: [sqlite] use sqlite3 in ios

2014-08-13 Thread Ward Willats
On Aug 13, 2014, at 2:31 AM, YAN HONG YE wrote: > When I add sqlite3.c and sqlite3.h to xcode ios cocoa project, and compiled, > the error msg is: > Sqlite3 class is not a objective class, who have any cocoa sqlite source, I > don't know how to do. If you compile in a

Re: [sqlite] Support for concurrent transactions

2014-06-21 Thread Ward Willats
On Jun 21, 2014, at 1:36 PM, Simon Slavin wrote: > But the programming style I've been using recently does the equivalent of > allowing any number of concurrent "BEGIN"s and handing back a handle for each > one. You can execute any number of commands (SELECT or write)

[sqlite] Benign SQLITE_SCHEMA error?

2014-06-09 Thread Ward Willats
Hello. Running Sqlite 3.8.4.3 in an iOS application in WAL mode. One writer. Many readers. Each thread on own connection. After a particular big bulk insert of data, during which, BTW, indices are dropped and recreated and an ANALYZE done, sqlite is reporting on the SQLITE_CONFIG_LOG

Re: [sqlite] Simple data conversion in SQLite - please help

2014-01-22 Thread Ward Willats
On Jan 22, 2014, at 8:21 AM, Richard Hipp wrote: > I seem to recall seeing some SMS databases off of an iPhone that used unix > timestamps for the date/time. That would be seconds since 1970. You can > use the 'unixepoch' modifier on the date functions within SQLite to do >

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 1:50 PM, Richard Hipp wrote: > FYI: > > If you use "PRAGMA journal_mode=WAL;" with "PRAGMA synchronous=NORMAL;", > then fsync()s will only occur during a checkpoint operation. And, you can > turn off automatic checkpointing and run checkpoints from a

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 1:50 PM, Richard Hipp wrote: > FYI: > > If you use "PRAGMA journal_mode=WAL;" with "PRAGMA synchronous=NORMAL;", > then fsync()s will only occur during a checkpoint operation. And, you can > turn off automatic checkpointing and run checkpoints from a

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 12:02 PM, Richard Hipp <d...@sqlite.org> wrote: > Do not compile with SQLITE_NO_SYNC. Okay. Thanks. > On Jan 16, 2014, at 1:29 PM, Roger Binns <rog...@rogerbinns.com> wrote: > >> On 16/01/14 11:43, Ward Willats wrote: >> So it looks like

[sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
Hello Experts: We are compiling our own amalgamation into our multi-threaded iOS app. Just saw a busy error where one thread is in sqlite doing an fsync() (unix_sync(), full_fsync()) and the the thread that gets the error is trying to start a transaction. So it looks like fsync() is taking

Re: [sqlite] Saw something interesting in the debugger...

2014-01-09 Thread Ward Willats
On Jan 9, 2014, at 10:10 AM, Roger Binns wrote: > The default busy handler (see sqliteDefaultBusyCallback in source) sleeps > for these amount of milliseconds: > > { 1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 100 }; > > However on non-Windows if you do not have

[sqlite] Saw something interesting in the debugger...

2014-01-09 Thread Ward Willats
I've got a multi-threaded iOS app. Each thread has its own long-lived DB connection. I was debugging a "stuttering" in the UI thread and broke into the debugger during one of the pauses. I found the UI thread and a worker thread, both in the DB, both in the default busy handler, both taking a

Re: [sqlite] Connection philosophy

2013-01-23 Thread Ward Willats
On Jan 22, 2013, at 8:18 PM, Keith Medcalf wrote: > I presume that you are using some kind of input-driven or event driven > application which may get a request to process a query "in the middle" of > your update transaction. That is correct. > One of the advantages

Re: [sqlite] Connection philosophy

2013-01-22 Thread Ward Willats
On Jan 22, 2013, at 5:54 PM, Keith Medcalf wrote: > I prefer the long-lived approach. Continuously re-initialization of the > connection on open, the need to re-read pages into the page cache > repetitively, and the subsequent discard of a nicely loaded page-cache on >

Re: [sqlite] Connection philosophy

2013-01-22 Thread Ward Willats
On Jan 22, 2013, at 10:07 AM, Simon Slavin wrote: > Change the code used in your one big thread so that it counts the number if > INSERT/UPDATEs it does and changes transactions and does a little pause after > every thousand ops. Or hundred. Whatever. > Cool idea,

[sqlite] Connection philosophy

2013-01-22 Thread Ward Willats
Hello. Just wondering what the group opinion is on something. I have a bunch of home-grown C++ wrappers for Sqlite and when my app needs to use the DB, most routines just instance one of these DB wrapper objects on the stack and go for it. The constructor creates a new DB connection, which is

Re: [sqlite] Is there a way to create a foreign key in existing table?

2012-12-31 Thread Ward Willats
On Dec 31, 2012, at 12:57 AM, Simon Slavin wrote: > > On 31 Dec 2012, at 8:54am, Igor Korot wrote: > >> I simply forgot to do it on the table creation. And now the table has >> many rows... > > You can easily modify a TABLE definition or even an