Re: [sqlite] When to open/close connections

2014-04-30 Thread Yuriy Kaminskiy
Simon Slavin wrote: > On 29 Apr 2014, at 2:24pm, Drago, William @ MWG - NARDAEAST > wrote: > >> Does closing the connection force, or at least encourage, the OS to write to >> disk whatever it might have been caching? > > Closing a connection calls fclose() on the

Re: [sqlite] When to open/close connections

2014-04-29 Thread Simon Slavin
On 29 Apr 2014, at 2:24pm, Drago, William @ MWG - NARDAEAST wrote: > Does closing the connection force, or at least encourage, the OS to write to > disk whatever it might have been caching? Closing a connection calls fclose() on the database file (as long as fopen()

Re: [sqlite] When to open/close connections

2014-04-29 Thread Drago, William @ MWG - NARDAEAST
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Yuriy Kaminskiy > Sent: Monday, April 28, 2014 8:36 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] When to open/close connections >

Re: [sqlite] When to open/close connections

2014-04-28 Thread Yuriy Kaminskiy
Simon Slavin wrote: > On 28 Apr 2014, at 11:11pm, RSmith wrote: > >> Second approach is better when you rarely access the database, also it will >> make sure releases happen (or at least provide immediate errors if not), but >> keeping a connection open is much better when

Re: [sqlite] When to open/close connections

2014-04-28 Thread Simon Slavin
On 28 Apr 2014, at 11:11pm, RSmith wrote: > Second approach is better when you rarely access the database, also it will > make sure releases happen (or at least provide immediate errors if not), but > keeping a connection open is much better when hundreds of accesses

Re: [sqlite] When to open/close connections

2014-04-28 Thread RSmith
Second approach is better when you rarely access the database, also it will make sure releases happen (or at least provide immediate errors if not), but keeping a connection open is much better when hundreds of accesses happen in terms of speed - especially loads of small queries, large queries

[sqlite] When to open/close connections

2014-04-28 Thread Peter Haworth
There's a discussion on another forum I'm on about whether it's good practice to open an SQLite database as part of program initialization and close it when the program terminates, or whether the connection should be opened and closed around each transaction. I've always used the first approach