Re: [sqlite] [EXTERNAL] Re: sqlite3_stmt limitations

2017-09-20 Thread Dominique Devienne
On Wed, Sep 20, 2017 at 1:41 PM, heribert wrote: > Do i have to open a database connection for each threat? Like > > rc = sqlite3_open("file::memory:?cache=shared", ); I believe so, yes. --DD PS: See also this thread:

[sqlite] sqlite3_stmt limitations

2017-09-20 Thread heribert
Hello, in my mfc application are 100-10,000 object properties (depending on app setup) used by two threads. The properties are not threadsafe (most of them are doubles or int). Upto now (15 years running code) there was no problem. Only one thread writes to the properties. Main thread

Re: [sqlite] [EXTERNAL] Re: sqlite3_stmt limitations

2017-09-20 Thread Hick Gunter
Make sure each thread has ist own private connection to the SQLite database (see https://sqlite.org/inmemorydb.html) Prepare the statement once in each reader thread and use the bind functions to set the constraint values The writer thread will need to prepare statements to populate the db

Re: [sqlite] sqlite3_stmt limitations

2017-09-20 Thread Clemens Ladisch
heribert wrote: > "Not very much. But preparing a statement is very fast; don't try to be too > clever." > > What do you mean with "don't try to be too clever"? Is preparing for reuse > not really necessary? In many cases, the difference will not be noticeable. I was warning against adding

Re: [sqlite] sqlite3_stmt limitations

2017-09-20 Thread Clemens Ladisch
heribert wrote: > The threads prepares their own sqlite3_stmt's with select statements > to the properties currently needed A single statement "SELECT Value FROM T WHERE Name = ?" might suffice. > Is their any limitation of sqlite3_stmt bound to a database? Only memory. > How much memory is

Re: [sqlite] sqlite3_stmt limitations

2017-09-20 Thread heribert
@Clemens: You wrote "Not very much.  But preparing a statement is very fast; don't try to be too clever." What do you mean with "don't try to be too clever"? Is preparing for reuse not really necessary? The select will be like "SELECT Value FROM RgbValues WHERE Object=? AND Property=?".

Re: [sqlite] [EXTERNAL] Re: sqlite3_stmt limitations

2017-09-20 Thread Hick Gunter
SQLite will block access to the whole database during a write operation. Readers will have to wait until the write completes, even if the object they are interested in is not affected by updates. Protecting each object's data with a posix read-write lock will allow readers to access any object

Re: [sqlite] [EXTERNAL] sqlite3_stmt limitations

2017-09-20 Thread Hick Gunter
If your "properties" are independant of each other and the reader thread accessing intermediate values is not a problem, you can just continue (good luck is bound to run out in 15 years of non threadsafe operation). Consider using atomic instructions to read/update single properties. If

[sqlite] Questions- New App

2017-09-20 Thread Russell Duncan
Hello, I'm completely new to everything SQLite, and app-coding in general. I'm trying to make a service based app similar to Venmo (not for payments, but similar in layout and size, with the idea of having the social feed incorporated). I've just started researching programs for

Re: [sqlite] Figuring out the Cause of SQLite Error 11: Corrupt Database

2017-09-20 Thread Esplin, Justin
(1) It is possible that this has occurred on other versions of Windows, but I can only confirm that it has occurred on machines running Windows 10. The most recent cited occurrence was on Windows 10 Enterprise, version 1607, OS Build 14393.1593 (2) We are using version 1.0.98.1. (3) We aren't

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Fahad
Hi Dan The plugin I'm referring to is a 'Share' plugin that one can embed inside of a mac app, which then shows up in the "Sharing" menu in Safari. When you click on it, it launches in its own process, allowing you to share the currently viewed website with your main app. Thus, the main app and

[sqlite] Why does eval.c lack a row separator parameter?

2017-09-20 Thread petern
Is there a practical reason why eval.c was designed with only two parameters? https://www.sqlite.org/src/artifact/f971962e92ebb8b0 Why eval(X,Y) instead of eval(X,Y,Z)? The second form with both an optional column separator Y and an optional row separator Z is far more useful. I develop an

[sqlite] bug while compiling for djgpp

2017-09-20 Thread janezz55 .
Good news, sqlite still works under DOS. Bad news, some compile-time tweaks are needed. The most pressing is the definition of the osFstat macro, which needs to be changed to #ifdef __DJGPP__ { "fstat",0, 0 }, #define osFstat(a,b)0 #else previously, it accepted 3

[sqlite] Error: cannot create trigger on system table

2017-09-20 Thread petern
What are the drawbacks to allowing triggers on system tables? Is this an arbitrary restriction? In the "big picture" overview, what would it take to get system table triggers working after bypassing the error check in trigger.c below? /* Do not create a trigger on a system table */ if(

Re: [sqlite] SQLite Error while trying to BackupDatabase

2017-09-20 Thread Karthi M
This Occurs if .db file is accessed from network path. any way to avoid this warning?? On Tue, Sep 19, 2017 at 6:45 PM, Clemens Ladisch wrote: > Karthi M wrote: > > SQLite notice (27): delayed 1375ms for lock/sharing conflict at line > 42155 > > SQLite error (14):

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread Richard Hipp
On 9/20/17, petern wrote: > What are the drawbacks to allowing triggers on system tables? Is this an > arbitrary restriction? System tables are sometimes modified directly, without going through the usual DELETE/INSERT/UPDATE logic. In order to support triggers on

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Jens Alfke
> On Sep 19, 2017, at 8:20 PM, Fahad wrote: > > I recently switched on the Thread Sanitizer in Xcode only to find that it > was complaining of race conditions inside of the sqlite3.c code, that the > various readers and writers were trying to read / write to the same >

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread Simon Slavin
On 20 Sep 2017, at 6:55pm, petern wrote: > OK. If system table triggers are generally not maintained, what is > simplest recommended way, by C API or other means, for the application to > be notified of non-specific schema changes that include creation/deletion >

[sqlite] Wanting to return REAL as formatted TEXT

2017-09-20 Thread Phoenix
I am trying to retrieve some numeric data from a table using COBOL (not a 'C' programmer). sqlite3_column_type says its type '2' so I am using sqlite3_column_double to return the data. The problem is that the language I am using does not seem to like REAL numbers as I'm getting a zero value.

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Brian Macy
Fahad, Are you calling sqlite3_wal_checkpoint_v2? Brian Macy On Sep 20, 2017, 1:59 PM -0400, wrote: > > I've run the Thread Sanitizer with my own SQLite-based on macOS, and haven't > seen any warnings in sqlite3.c. So what you got could be a real warning sign.

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread petern
OK. If system table triggers are generally not maintained, what is simplest recommended way, by C API or other means, for the application to be notified of non-specific schema changes that include creation/deletion events? In the vein of the columns meta-data eval.c tester I posted, it would be

Re: [sqlite] Questions- New App

2017-09-20 Thread Jens Alfke
> On Sep 19, 2017, at 6:16 AM, Russell Duncan wrote: > > I've just started researching programs for coding/app-making and SQLite > came up, is this a program that would be useful for something like that? Yes, although SQLite is rather low-level, and learning to use it

Re: [sqlite] Wanting to return REAL as formatted TEXT

2017-09-20 Thread Keith Medcalf
I presume you have the Working Storage declared as COMPUTATIONAL-2? Which COBOL compiler are you using? --- 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-

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Fahad
I've tried that as well. Since I'm using PRAGMA journal_mode=WAL on all the connections, I've had issues with MMAP (as acknowledged by the threads above) so have had to disable that. I also need FTS 3 to work. The rest of the flags to do with synchronisation and threading, I've enabled / disabled

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Fahad
I apologise for the many posts, but I'm writing in hope that one of you may point out something that I'm either doing wrong, or a concept I haven't fully grasped. I'm aware that prepared statements are tied to the database connection they were created for. In order to get more speed out of my

Re: [sqlite] Wanting to return REAL as formatted TEXT

2017-09-20 Thread Richard Hipp
On 9/20/17, Phoenix wrote: > > From what I have been able to workout it should be possible to return a > REAL number as a formatted text string, which would make things easier > for me, but am not sure of the details to do it. Just call sqlite3_column_text() instead

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Fahad
I can't be certain now but I think this thread is related: http://sqlite.1065341.n5.nabble.com/Re-Database-corruption-and-PRAGMA-fullfsync-on-macOS-td95366.html It was this thread that I landed on earlier this year to presumably fix the issues I was experiencing personally. This did help, in

Re: [sqlite] Wanting to return REAL as formatted TEXT

2017-09-20 Thread John McKown
On Wed, Sep 20, 2017 at 11:01 AM, Phoenix wrote: > I am trying to retrieve some numeric data from a table using COBOL (not > a 'C' programmer). > > sqlite3_column_type says its type '2' so I am using > sqlite3_column_double to return the data. The problem is that the

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread Simon Slavin
On 20 Sep 2017, at 10:36pm, Simon Slavin wrote: > This will tell you in some detail what kind of schema chance it taking place. G. That should be "This will tell you in some detail what kind of schema change is taking place." Simon.

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread Simon Slavin
On 20 Sep 2017, at 10:10pm, petern wrote: > Instead of polling from a custom program, what would be nice is a feature > within shell.c that permits the user to specify pre-execute SQL which > optionally executes silently before every statement sent through the

Re: [sqlite] Error: cannot create trigger on system table

2017-09-20 Thread petern
Instead of polling from a custom program, what would be nice is a feature within shell.c that permits the user to specify pre-execute SQL which optionally executes silently before every statement sent through the input line. Testing SCHEMA_VERSION for changes as you suggest (and many other useful

[sqlite] Authorizer documentation weirdness

2017-09-20 Thread Simon Slavin
The page in the documentation listing the codes used by the authorizer is I do not understand why that URL is used. It is uncomfortably close to yet it is clearly not the same, given the "c_" prefix. If

[sqlite] SqLite Metadata information

2017-09-20 Thread K, Rajasekar
Hi All, I am currently working on a project where I am using "SqLite" database to store some data. And I need to get some information about the database I have created. Information like 1. Charset - character set used in the database 2. Collation - Collation method used in the

Re: [sqlite] SqLite Metadata information

2017-09-20 Thread Simon Slavin
On 21 Sep 2017, at 3:21am, K, Rajasekar wrote: > Information like > > 1. Charset - character set used in the database > 2. Collation - Collation method used in the database > 3. Encryption - Encryption method used in the database > 4.

Re: [sqlite] 'database disk image is malformed' only on the mac

2017-09-20 Thread Simon Slavin
On 20 Sep 2017, at 4:20am, Fahad wrote: > These are the flags I've finally settled on: Revert all those settings. Allow SQLite to use its default settings. See if that makes your problem go away. This is purely for testing. Once you know whether it works or not you can

Re: [sqlite] SQLite Error while trying to BackupDatabase

2017-09-20 Thread Simon Slavin
On 20 Sep 2017, at 10:40am, Karthi M wrote: > This Occurs if .db file is accessed from network path. any way to avoid > this warning?? The networking system you’re using is not correctly supporting locking. Without a working locking system there’s a chance your database

Re: [sqlite] [EXTERNAL] Re: sqlite3_stmt limitations

2017-09-20 Thread heribert
Do i have to open a database connection for each threat? Like rc = sqlite3_open("file::memory:?cache=shared", ); Am 20.09.2017 um 09:16 schrieb Hick Gunter: Make sure each thread has ist own private connection to the SQLite database (see https://sqlite.org/inmemorydb.html) Prepare the