Re: [sqlite] [EXTERNAL] SQLITE_OPEN_FULLMUTEX

2018-11-27 Thread Hick Gunter
Using SQLITE_OPEN_FULLMUTEX puts SQLite into serialized mode. This means that 
mutltiple threads can share a single connection but will block until the mutex 
is freed because the thread currently holding the mutex has left the SQLite 
code. Blocked threads will only experience a time delay (concurrency is 
reduced).

This is distinct from the SQLITE_LOCKED, which means that there is a (logical) 
conflict iin the same DB connection, e.g. attempting to drop a table in one 
thread while reading from the same table in another thread.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Prajeesh Prakash
Gesendet: Mittwoch, 28. November 2018 08:33
An: SQLite mailing list 
Betreff: [EXTERNAL] [sqlite] SQLITE_OPEN_FULLMUTEX

Hi Members,

I enabled the SQLITE_OPEN_FULLMUTEX in that case if one thread is trying to 
write in to the DB and other thread is trying to read from the DB (Same 
connection). In that case will it cause any SQLITE_LOCKED error. In some of the 
forum i found that if we enable the SQLITE_OPEN_FULLMUTEX  the  sqlite handle ( 
sqlite3 * handle) contains the mutex filed so when the sqlite library is 
invoking that API will wait for the mutex to get open.



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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLITE_OPEN_FULLMUTEX

2018-11-27 Thread Prajeesh Prakash
Hi Members,

I enabled the SQLITE_OPEN_FULLMUTEX in that case if one thread is trying to 
write in to the DB and other thread is trying to read from the DB (Same 
connection). In that case will it cause any SQLITE_LOCKED error. In some of the 
forum i found that if we enable the SQLITE_OPEN_FULLMUTEX  the  sqlite handle ( 
sqlite3 * handle) contains the mutex filed so when the sqlite library is 
invoking that API will wait for the mutex to get open.



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


Re: [sqlite] sqlite3_exec()

2018-11-27 Thread Prajeesh Prakash
As per the asyncwriter code, that thread is not giving any BD update success or 
failure status so is there any way to get the status from the Asyncwriter 
thread because my application needs to know the status of the DB changes.

> On November 27, 2018 at 10:31 PM Keith Medcalf  wrote:
> 
> 
> 
> On Tuesday, 27 November, 2018 07:59, Simon Slavin  
> wrote:
> 
> >If you do not register an async writer, SQLite does not start its own
> >threads.  Each SQLite library call executes in the thread which calls
> >it.
> 
> Not entirely correct.  The sorter can be configured to automatically use 
> threads.
> 
> ---
> 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] SQLite iOS timestamp type mapping settings must be set to float to get correct data

2018-11-27 Thread Scott Perry
On Nov 26, 2018, at 14:16, Simon Slavin  wrote:
> 
> On 26 Nov 2018, at 9:09pm, Scott Perry  wrote:
> 
>> For Bill's purposes—investigating a copied, non-corrupt database—it would 
>> probably be easiest to just convert from the Cocoa epoch to the Unix epoch 
>> by updating all the columns that currently store Cocoa timestamps. Something 
>> like:
>> 
>>   UPDATE ZTIMEENTRY SET ZDATE = ZDATE + 978307200;
> 
> If you want to access your date in that form but leave the database usable by 
> Apple's libraries you can create a view which has a new column which modifies 
> the date in the above way.  As long as your VIEW's name does not clash with 
> one Apple wants to use, Apple's utilities should not stop working just 
> because you created a new view in a Core Data database.  I have previously 
> done this without problems but I may have just been lucky.
> 
> Come to think of that, Scott, you're in a better position to confirm that 
> than I am.


Local experimentation is one of the greatest learning tools, but I don't 
recommend making any customizations to Core Data stores that will ever be used 
on someone else's device as the framework is not especially sympathetic to 
meddling.

With that disclaimer out of the way, as a general rule Core Data namespaces all 
of its resources by prefixing them with Z. Migrations (which occur when 
updating the store to a new model version, or on first use after an operating 
system update) may destroy schema customizations.

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


Re: [sqlite] Possible bug in Alter Table

2018-11-27 Thread Balaji Ramanathan
Thank you, Richard.  I can understand how not naming the columns of a view
can lead to ambiguities and other problems down the line.  Hopefully the
documentation will be updated so that users are aware that the alter table
command can't really deal with cascading effects such as in the case of
views referring to other views, etc.

Is there a way to unravel a complex schema so that you can identify which
views are based directly on tables and which views refer to other views,
and what those other views are?  At this point, the simple solution seems
to be to just use .dump to dump out the contents of the database into a
text file, use search and replace to do the column rename, and then use
.read to read it back into a SQLite database.  Anything I have to watch out
for if I do the above?

Thank you.

Balaji Ramanathan

From: Richard Hipp 
To: SQLite mailing list 
Cc:
Bcc:
Date: Mon, 26 Nov 2018 14:11:54 -0500
Subject: Re: [sqlite] Possible bug in Alter Table
On 11/25/18, Balaji Ramanathan  wrote:
> I expected the Alter Table command to find and replace all occurrences of
> that column name in my schema with the new name.

Here is simplified SQL that illustrates the problem:

CREATE TABLE t1(x);
CREATE VIEW v1 AS SELECT x FROM t1;
CREATE VIEW v2 AS SELECT x FROM v1;
ALTER TABLE t1 RENAME x TO y;

The ALTER TABLE fails because after changing the name of t1.x to t1.y,
the definition of the view v2 is no longer valid.

This is not something we intend to "fix" in SQLite.  The root of the
problem is that the column names for the v1 view are not specified.
And since they are not specified, that means SQLite is free to pick
whatever arbitrary names it wants for those columns.  The definition
of view v2 depends on one particular algorithm for picking the column
names of view v1, but there are no guarantees that every version of
SQLite will use that particular algorithm.  Hence, the definition of
view v2 is under-specified and prone to failure, such as in this case.

If you are careful to defined the names of all columns within your
views, then the problem goes away.  For example:

CREATE TABLE t1(x);
CREATE VIEW v1(y) AS SELECT x FROM t1;
CREATE VIEW v2(z) AS SELECT y FROM v1;
ALTER TABLE t1 RENAME x TO y;

Or:

CREATE TABLE t1(x);
CREATE VIEW v1 AS SELECT x AS y FROM t1;
CREATE VIEW v2 AS SELECT y AS z FROM v1;
ALTER TABLE t1 RENAME x TO y;

If you do not specify the names of columns in views, then SQLite is
free to choose whatever names it wants for those columns, and the
choices might shift after an ALTER TABLE, which could then break
queries and/or downstream views.  So it is best not to do that.

Admittedly, this is not well-documented.  I will strive to improve the
documentation for the next release.  Perhaps I will also add a
"warning" mechanism to alert programmers to gotchas like this in some
subsequent release, though there probably is not time to get warnings
in to the forthcoming 3.26.0 release.

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


Re: [sqlite] sqlite3_exec()

2018-11-27 Thread Keith Medcalf

On Tuesday, 27 November, 2018 07:59, Simon Slavin  wrote:

>If you do not register an async writer, SQLite does not start its own
>threads.  Each SQLite library call executes in the thread which calls
>it.

Not entirely correct.  The sorter can be configured to automatically use 
threads.

---
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


Re: [sqlite] sqlite3_exec()

2018-11-27 Thread Prajeesh Prakash
In that case if i am not registering the async writer then also my db will get 
updated (If i am writing to DB) am i correct?

> 
> On November 27, 2018 at 8:29 PM Simon Slavin  wrote:
> 
> On 27 Nov 2018, at 2:43pm, Prajeesh Prakash 
>  wrote:
> 
> > > 
> > I have one doubt, Is that sqlite3_exec function is working under 
> > the main application thread (Thread which calls the sqlite3_exec) or in a 
> > separate thread (If i am trying to INSERT the data in to DB without 
> > registering the Async writer).
> > 
> > > 
> If you do not register an async writer, SQLite does not start its own 
> threads. Each SQLite library call executes in the thread which calls it.
> 
> Simon.
> 
> ___
> 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] sqlite3_exec()

2018-11-27 Thread Simon Slavin
On 27 Nov 2018, at 2:43pm, Prajeesh Prakash  
wrote:

> I have one doubt, Is that sqlite3_exec function is working under the main 
> application thread (Thread which calls the sqlite3_exec) or in a separate 
> thread (If i am trying to INSERT the data in to DB without registering the 
> Async writer).

If you do not register an async writer, SQLite does not start its own threads.  
Each SQLite library call executes in the thread which calls it.

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


[sqlite] sqlite3_exec()

2018-11-27 Thread Prajeesh Prakash
Dear Members,

I have one doubt, Is that sqlite3_exec function is working under the main 
application thread (Thread which calls the sqlite3_exec) or in a separate 
thread (If i am trying to INSERT the data in to DB without registering the 
Async writer).



Thank you

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


[sqlite] Problem with error recovery in Lemon

2018-11-27 Thread Albertas Vyšniauskas
Hello everybody,

all Lemon versions after commit 7eb0198d fail to recover from errors and
instead trigger assertion failures. Attached repro.y file provides minimal
reproduction. If I execute the parser generated using this file with Lemon
compiled from 6e133054 version, then
"yyrulenoyytos->stateno,
-YYERRORSYMBOL)) >= YY_MIN_REDUCE
+YYERRORSYMBOL)) >= YY_MIN_SHIFTREDUCE
 ){
   yy_pop_parser_stack(yypParser);
 }

Regards
Albertas Vyšniauskas
%token_prefix TK_
%token_type {int}
%default_type {int}
%left A B.
test ::= A B.
test ::= error B.
%include {
#include 
#include 
#include "repro.h"
#define YYMALLOCARGTYPE size_t
#define ParseTOKENTYPE int
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE));
void Parse(void *yyp, int yymajor, ParseTOKENTYPE yyminor);
void ParseFree(void *p, void (*freeProc)(void*));
int main() {
void *parser = ParseAlloc(malloc);
Parse(parser, TK_B, 0);
Parse(parser, TK_B, 0);
ParseFree(parser, free);
return 0;
}
}
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Possible bug in Alter Table

2018-11-27 Thread Petite Abeille


> On Nov 27, 2018, at 06:16, Wout Mertens  wrote:
> 
> If it's on a mac, this terrible misfeature can be turned off in system
> preferences - keyboard - text - smart quotes.

Oh my... right you are :|

Grrr indeed.

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


Re: [sqlite] sqlite3 Asynchronous I/O

2018-11-27 Thread Prajeesh Prakash
Yes it is, On sqlite3async.c file i found asyncWriterThread but i didn't find 
any callback to let the application know the status of the DB update. How this 
thread writing the data to DB, I am little bit confused.

> 
> On November 27, 2018 at 3:12 PM Shawn Wagner  
> wrote:
> 
> By asynchronous i/o, do you mean the vfs module described here:
> https://www.sqlite.org/asyncvfs.html ?
> 
> On Tue, Nov 27, 2018, 1:24 AM Prajeesh Prakash
>  
> > > 
> > Hi Members,
> > 
> > I am using sqlite3 Asynchronous I/O on my application. So is there 
> > any way
> > to get the status of the DB update (After the write operation) from 
> > the
> > asyncWriterThread so that my application can do the proper error 
> > handling.
> > 
> > I am expecting a reply.
> > 
> > Thank you
> > 
> > Prajeesh P
> > 
> > ___
> > 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] sqlite3 Asynchronous I/O

2018-11-27 Thread Prajeesh Prakash
Yes it is.

> 
> On November 27, 2018 at 3:12 PM Shawn Wagner  
> wrote:es
> 
> By asynchronous i/o, do you mean the vfs module described here:
> https://www.sqlite.org/asyncvfs.html ?
> 
> On Tue, Nov 27, 2018, 1:24 AM Prajeesh Prakash
>  
> > > 
> > Hi Members,
> > 
> > I am using sqlite3 Asynchronous I/O on my application. So is there 
> > any way
> > to get the status of the DB update (After the write operation) from 
> > the
> > asyncWriterThread so that my application can do the proper error 
> > handling.
> > 
> > I am expecting a reply.
> > 
> > Thank you
> > 
> > Prajeesh P
> > 
> > ___
> > 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] sqlite3 Asynchronous I/O

2018-11-27 Thread Shawn Wagner
By asynchronous i/o, do you mean the vfs module described here:
https://www.sqlite.org/asyncvfs.html ?

On Tue, Nov 27, 2018, 1:24 AM Prajeesh Prakash
 Hi Members,
>
> I am using sqlite3 Asynchronous I/O on my application. So is there any way
> to get the status of the DB update (After the write operation) from the
> asyncWriterThread  so that my application can do the proper error handling.
>
> I am expecting a reply.
>
> Thank you
>
> Prajeesh P
> ___
> 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] sqlite3 Asynchronous I/O

2018-11-27 Thread Prajeesh Prakash
Hi Members,

I am using sqlite3 Asynchronous I/O on my application. So is there any way to 
get the status of the DB update (After the write operation) from the 
asyncWriterThread  so that my application can do the proper error handling.

I am expecting a reply.

Thank you

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