Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-16 Thread Dominique Devienne
On Wed, Aug 16, 2017 at 4:15 PM, Keith Medcalf wrote: > Setting "multithreaded" mode disables these checks in the SQLite3 library > and it is up to the application level code to ensure the single-entrance > per connection is enforced at the application level. If the application > makes a "mistak

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-16 Thread Keith Medcalf
>According to your interpretation, "Single-thread" and "Multi-thread" >modes are equivalent: >> Multi-thread. In this mode, SQLite can be safely used by multiple >threads provided that no single database connection is used >simultaneously in two or more threads. >Assuming there *is* a difference

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-16 Thread Keith Medcalf
On Wednesday, 16 August, 2017 00:11, Gwendal Roué wrote: >> Le 15 août 2017 à 08:44, Clemens Ladisch a écrit : >> sanhua.zh wrote: >>> All 1. 2. 3. steps are run sequentially, which means that the step 2 >>> runs after step 1 finished and step 3 runs after step 2 finished >>> theoretically .

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-16 Thread Clemens Ladisch
Gwendal Roué wrote: >> Le 16 août 2017 à 08:38, Clemens Ladisch a écrit : >> Gwendal Roué wrote: >>> Serialized accesses from multiple threads is OK when the connection is >>> in the "Multi-thread" or "Serialized" threading modes, but not in the >>> "Single-thread" threading mode. >> >>

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-16 Thread Gwendal Roué
> Le 16 août 2017 à 08:38, Clemens Ladisch a écrit : > > Gwendal Roué wrote: >> Serialized accesses from multiple threads is OK when the connection is >> in the "Multi-thread" or "Serialized" threading modes, but not in the >> "Single-thread" threading mode. > >

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-15 Thread Clemens Ladisch
Gwendal Roué wrote: > Serialized accesses from multiple threads is OK when the connection is > in the "Multi-thread" or "Serialized" threading modes, but not in the > "Single-thread" threading mode. says: | 1. *Single-thread*. In this mode, all mutexes are d

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-15 Thread Gwendal Roué
> Le 15 août 2017 à 08:44, Clemens Ladisch a écrit : > > sanhua.zh wrote: >> All 1. 2. 3. steps are run sequentially, which means that the step 2 >> runs after step 1 finished and step 3 runs after step 2 finished >> theoretically . >> Also, I can make sure the memory order between threads. >>

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-14 Thread Clemens Ladisch
sanhua.zh wrote: > All 1. 2. 3. steps are run sequentially, which means that the step 2 > runs after step 1 finished and step 3 runs after step 2 finished > theoretically . > Also, I can make sure the memory order between threads. > > Then, is it a safe way to use sqlite connection ? Yes. Multi-t

[sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-14 Thread sanhua.zh
Here is a sample. As for a specific sqlite connection, 1. sql is executed in thread A 2. sql is prepared in thread B 3. Prepared statement in 2. is stepped and finalized in thread C All 1. 2. 3. steps are run sequentially, which means that the step 2 runs after step 1 finished and step 3 runs af

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Luc DAVID
What's the programming language used in the application? I use Freepascal / Lazarus as a programming language and my own sqlite wrapper written in Freepascal as well. I will add the sqlite3_extended_errcode + sqlite3_errstr to the wrapper lib in order to get extended error infos and will have

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread R Smith
On 2016/06/13 3:41 PM, Luc DAVID wrote: Thanks Ryan and Oliver for your answers You are too fast for me, I didn't have the time to answer the first posts... @Ryan > There is no safe way to do what you need. Networked file systems do not > play nice with file-locking. SQLite is suitable for

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Olivier Mascia
> Le 13 juin 2016 à 15:41, Luc DAVID a écrit : > > The worst case is when you get a "Database is locked" message which mean you > have to kill all the application processes in order to unlock the db (unless > another means exists ?) You shouldn't get any such with cautious design. And you sho

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Luc DAVID
Thanks Ryan and Oliver for your answers You are too fast for me, I didn't have the time to answer the first posts... @Ryan > There is no safe way to do what you need. Networked file systems do not > play nice with file-locking. SQLite is suitable for localized storage, > not Networked-multi-us

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread R Smith
On 2016/06/13 3:12 PM, Olivier Mascia wrote: Le 13 juin 2016 à 15:02, R Smith a écrit : The application will be used by ± 10 users via RDP TSE clients. Hi Luc, There is no safe way to do what you need. Networked file systems do not play nice with file-locking. SQLite is suitable for local

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Olivier Mascia
> Le 13 juin 2016 à 15:02, R Smith a écrit : > >> The application will be used by ± 10 users via RDP TSE clients. >> > Hi Luc, > There is no safe way to do what you need. Networked file systems do not play > nice with file-locking. SQLite is suitable for localized storage, not > Networked-mult

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Olivier Mascia
> Le 13 juin 2016 à 14:20, Luc DAVID a écrit : > > Hello, > > I'm planning to install an application using sqlite on a windows 2003 > server. > > The application exe + sqlite dll + database will be installed in the same > server directory. Best would be to compile sqlite itself within the app

Re: [sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread R Smith
On 2016/06/13 2:20 PM, Luc DAVID wrote: Hello, I'm planning to install an application using sqlite on a windows 2003 server. The application exe + sqlite dll + database will be installed in the same server directory. The application will be used by ± 10 users via RDP TSE clients. I need to

[sqlite] Is it safe to use sqlite WAL mode on windows server 2003+ with TSE access ?

2016-06-13 Thread Luc DAVID
Hello, I'm planning to install an application using sqlite on a windows 2003 server. The application exe + sqlite dll + database will be installed in the same server directory. The application will be used by ± 10 users via RDP TSE clients. I need to take care of possible database locks during

Re: [sqlite] Is it safe to use backup at shell level when an application is running

2014-11-07 Thread Simon Slavin
On 7 Nov 2014, at 10:33am, Yves Crespin wrote: > We use sqlite3_open_v2() with > SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX flags and all the > transactions are exclusive. > > > So, if we add a SQLITE_BUSY handle, can we use the sqlite3 .backup > when the application is running? > > Is it sa

Re: [sqlite] Is it safe to use backup at shell level when an application is running

2014-11-07 Thread Yves Crespin
Great ! Thanks a lot regards, yves yves crespin t. +33.(0)6.86.42.86.81 yvescrespin 2014-11-07 12:21 GMT+01:00 Clemens Ladisch : > Yves Crespin wrote: >> if we add a SQLITE_BUSY handle, can we use the sqlite3 .backup when >> [some] application is running? >> >> Is it safe or is there a risk t

Re: [sqlite] Is it safe to use backup at shell level when an application is running

2014-11-07 Thread Clemens Ladisch
Yves Crespin wrote: > if we add a SQLITE_BUSY handle, can we use the sqlite3 .backup when > [some] application is running? > > Is it safe or is there a risk to corrumpt the database or do we need > to change some settings ? Using the backup API is perfectly safe for your data. The only risk is th

[sqlite] Is it safe to use backup at shell level when an application is running

2014-11-07 Thread Yves Crespin
Hi, We use SQLite3 in a multi-threaded application. Now we must provide a 24/7 service and we don't want to change this legacy application. We use sqlite3_open_v2() with SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX flags and all the transactions are exclusive. So, if we add a SQLITE_BUSY hand

Re: [sqlite] Is it safe to backup an in-use sqlite3 database by copying the underlying database file?

2010-04-05 Thread Joshua Redstone
Thanks for the responses. I'll probably write a little c++ program to use the online backup API. Josh On Apr 5, 2010, at 3:07 PM, D. Richard Hipp wrote: > > On Apr 5, 2010, at 5:42 PM, Joshua Redstone wrote: > >> Hi sqlite-users, >> I'm looking for an easy way to backup a sqlite3 database whi

Re: [sqlite] Is it safe to backup an in-use sqlite3 database by copying the underlying database file?

2010-04-05 Thread Simon Slavin
On 5 Apr 2010, at 10:42pm, Joshua Redstone wrote: > I'm looking for an easy way to backup a sqlite3 database while it is in use. > If I could get away with linux 'cp', that'd be easier than > writing c++ code according to the online backup API > (http://www.sqlite.org/backup.html), and also i

Re: [sqlite] Is it safe to backup an in-use sqlite3 database by copying the underlying database file?

2010-04-05 Thread D. Richard Hipp
On Apr 5, 2010, at 5:42 PM, Joshua Redstone wrote: > Hi sqlite-users, > I'm looking for an easy way to backup a sqlite3 database while it is > in use. If I could get away with linux 'cp', that'd be easier than > writing c++ code according to the online backup API > (http://www.sqlite.org/back

Re: [sqlite] Is it safe to backup an in-use sqlite3 database by copying the underlying database file?

2010-04-05 Thread Pavel Ivanov
Just a little logic: if you want some backup mechanism that won't block writers then what state the backed up database should be in? In the state that was when backup process started or in the state that was when backup process ended? If the former then how would you distinguish file contents that

[sqlite] Is it safe to backup an in-use sqlite3 database by copying the underlying database file?

2010-04-05 Thread Joshua Redstone
Hi sqlite-users, I'm looking for an easy way to backup a sqlite3 database while it is in use. If I could get away with linux 'cp', that'd be easier than writing c++ code according to the online backup API (http://www.sqlite.org/backup.html), and also it has the advantage that it would not bloc

Re: [sqlite] Is it safe to ...

2008-04-25 Thread Alexander Batyrshin
On Mon, Mar 24, 2008 at 3:58 PM, <[EMAIL PROTECTED]> wrote: > "Alexander Batyrshin" <[EMAIL PROTECTED]> wrote: > > Hello, > > Is it safe to use this algorithm: > > > > open_db > > fork() > > sql_do() // both parent and child executes sql statements > > close_db > > > > I am not familiar w

Re: [sqlite] Is it safe to ...

2008-03-24 Thread drh
"Alexander Batyrshin" <[EMAIL PROTECTED]> wrote: > Hello, > Is it safe to use this algorithm: > > open_db > fork() > sql_do() // both parent and child executes sql statements > close_db > > I am not familiar with locking mechanism and I am afraid that if > parent and child will use the same DB ha

[sqlite] Is it safe to ...

2008-03-23 Thread Alexander Batyrshin
Hello, Is it safe to use this algorithm: open_db fork() sql_do() // both parent and child executes sql statements close_db I am not familiar with locking mechanism and I am afraid that if parent and child will use the same DB handlers it can cause of DB corruptions -- Alexander Batyrshin a

Re: [sqlite] Is it safe to read or write a table while being indexed?

2006-04-18 Thread Tito Ciuro
Hi Christian, On 18/04/2006, at 8:22, Christian Smith wrote: SQLite will make possible whatever is safe. Just be prepared to handle SQLITE_BUSY and SQLite will take care of the rest. Great. This is what I do now. No worries here then... If the indexing process uses a large SQLite cache (usin

Re: [sqlite] Is it safe to read or write a table while being indexed?

2006-04-18 Thread Christian Smith
On Sat, 15 Apr 2006, Tito Ciuro wrote: >Hello, > >I was wondering whether it is safe to read or write a table while >being indexed. Here's a scenario: for batch imports, it's sometimes >better to DROP the indexes, do the INSERTs and then recreate the >relevant indexes. Indexing may take a little b

Re: [sqlite] Is it safe to read or write a table while being indexed?

2006-04-16 Thread Tito Ciuro
On 16/04/2006, at 3:52, [EMAIL PROTECTED] wrote: Tito Ciuro <[EMAIL PROTECTED]> wrote: - Does SQLite acquire an EXCLUSIVE lock when indexing? Yes - If I'm not mistaken, an EXCLUSIVE lock does not stop other readers from accessing the database. You are mistaken. An EXCLUSIVE lock means t

Re: [sqlite] Is it safe to read or write a table while being indexed?

2006-04-16 Thread drh
Tito Ciuro <[EMAIL PROTECTED]> wrote: > Hello, > > I was wondering whether it is safe to read or write a table while > being indexed. Here's a scenario: for batch imports, it's sometimes > better to DROP the indexes, do the INSERTs and then recreate the > relevant indexes. Indexing may take

[sqlite] Is it safe to read or write a table while being indexed?

2006-04-15 Thread Tito Ciuro
Hello, I was wondering whether it is safe to read or write a table while being indexed. Here's a scenario: for batch imports, it's sometimes better to DROP the indexes, do the INSERTs and then recreate the relevant indexes. Indexing may take a little bit of time, so I was wondering if: