Re: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-10 Thread Michael Hooker

1. tell my email client to add a copy of the sent message to the

folder it
belongs


That is the most brilliant idea I've ever seen in my entire life.<<

Forgive me for saying "how sad". Surely there must have been something more 
inspiring than an e-mail trick? Or maybe you are very young :)


If you don't mind being patient all the list messages appear neatly sorted 
at the URL below in due course, and you'll see what has arrived as well as 
what has been sent:


http://www.mail-archive.com/sqlite-users%40sqlite.org/

Michael Hooker

On 10/11/2007 18:25:38, Don Lavelle ([EMAIL PROTECTED]) wrote:

Hey, all.

Thanks Gerry and Thomas for your replies.  Now I know that my e-mails
are being sent and are being received.  This seems like a very
knowledgeable and supportive mailing list.
I'm really looking
forward to participating.

On Nov 10, 2007, at 11:18 AM, Thomas Fjellstrom wrote:

> 1. tell my email client to add a copy of the sent message to the
> folder it
> belongs

That is the most brilliant idea I've
ever seen in my entire life.  I
will look into figuring it out with my mail client.

Regards,

Don

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-10 Thread Don Lavelle

Hey, all.

Thanks Gerry and Thomas for your replies.  Now I know that my e-mails  
are being sent and are being received.  This seems like a very  
knowledgeable and supportive mailing list.  I'm really looking  
forward to participating.


On Nov 10, 2007, at 11:18 AM, Thomas Fjellstrom wrote:

1. tell my email client to add a copy of the sent message to the  
folder it

belongs


That is the most brilliant idea I've ever seen in my entire life.  I  
will look into figuring it out with my mail client.


Regards,

Don

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-10 Thread Gerry Snyder

Don Lavelle wrote:

Hello, all,

First, I apologize if the list has received multiple copies of e-mails 
from me.  I'm using gmail, and gmail does strange things to e-mails 
when receiving through a POP client an e-mail that is from your own 
account.  


Your email made it to the list.

I also have seen that gmail does not send to me a message I sent to the 
list. Looking into that is on my (long) list of things to do some day.


Sorry I can't answer your SQLite question.

Gerry

PS  You can look at one of the email archives (links at 
http://sqlite.org/support.html ) to see if a posted message was received.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-10 Thread Don Lavelle

Hello, all,

First, I apologize if the list has received multiple copies of e- 
mails from me.  I'm using gmail, and gmail does strange things to e- 
mails when receiving through a POP client an e-mail that is from your  
own account.  If anyone at all gets this, please reply to me  
personally, even if to say, "yes, I got your e-mail, even though your  
copy from the mailing list isn't getting to you."  I don't mind my  
inbox being flooded ;-)  I had tried to post a multi-threading  
question before, but 1) I never got the e-mail back (gmail is  
strange), and 2) I never saw a reply (perhaps the e-mail never got to  
you.)


Second, my question is about SQLite and multi-threading.  Basically,  
the snippet below means that if I have multiple threads executing SQL  
statements, and I want at least one thread to execute multiple SQL  
statements as a single unit, I need to make sure only one thread at a  
time is executing SQL, or the SQL statements that are outside of the  
thread may get lumped in with the transaction.  As in,


10. thread 1: shut off auto commit
20. thread 1: SQL statement 1 succeeds
30. thread 2: independent SQL statement succeeds
40. thread 1: SQL statement 2 fails
50. thread 1: rollback, taking with it thread 2's effect

If that's the case, it also answers my previous, unposted question  
about sqlite3_changes, which was, "what would sqlite3_changes return  
if it were called at line 35 in the above sequence?"


Regards,

   Don Lavelle



On Nov 8, 2007, at 9:23 AM, Salles, Joaquim Campos wrote:


I found two e-mails (bellow) that I think give the answer: yes is safe
to use the same database connection, but is not work in the way that I
imagined. "Transaction control is per connection, not per  
thread." (Igor

Tandetnik) or "That connection can then be used across threads, but it
is for all intents and purposes a single line of communication with a
database (using it twice at the same time doesn't somehow multiply  
that

relationship)". (Stephan Beal)



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-08 Thread Salles, Joaquim Campos
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: quinta-feira, 8 de novembro de 2007 12:04
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] is safe to use the same database connection at the
same time in more than one thread?

>Yes.  The wiki page was correct when written but that was
>prior to the release of version 3.5.0.

OK. Maybe some upgrade the wiki release 3.5.*...


>Note that SQLite uses mutexes internally so what will really
>happen is one thread will block while the other is using the
>database connection.  Access to database connections is serialized.
>But the application code does not need to concern itself with
>the serialization any more.  That is now handled automatically
>by SQLite.

Here is an important point: "Access to database connections is
serialized".

Thanks for the help.

Joaquim

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-08 Thread Salles, Joaquim Campos
-Original Message-
>From: Salles, Joaquim Campos [mailto:[EMAIL PROTECTED] 
>Sent: quinta-feira, 8 de novembro de 2007 11:45
>To: sqlite-users@sqlite.org
>Subject: [sqlite] is safe to use the same database connection at the
same >time in more than one thread?

>Is safe to use the same database connection  at the same time in more
>than one thread? 

Hello,

I found two e-mails (bellow) that I think give the answer: yes is safe
to use the same database connection, but is not work in the way that I
imagined. "Transaction control is per connection, not per thread." (Igor
Tandetnik) or "That connection can then be used across threads, but it
is for all intents and purposes a single line of communication with a
database (using it twice at the same time doesn't somehow multiply that
relationship)". (Stephan Beal)


My interpretation is correct? Probably is a good idea to review Multi
Threading page (http://www.sqlite.org/cvstrac/wiki?p=MultiThreading) and
alert about the characteristic :treath safe and Transaction control is
per connection

Best regards,

Joaquim 

Reference:

http://www.mail-archive.com/sqlite-users%40sqlite.org/msg28858.html

You're confusing threads with the context of the connection. When you
call sqlite3_open() you get a single connection to a db. That
connection can then be used across threads, but it is for all intents
and purposes a single line of communication with a database (using it
twice at the same time doesn't somehow multiply that relationship).

stephan beal

http://www.mail-archive.com/sqlite-users%40sqlite.org/msg28868.html

That would happen if thread B had its own, separate connection, but not
when the two threads are working with the same connection. As far as
SQLite is concerned, there's no difference between a single thread
making two changes to the database within a single transaction, or two
threads each making one change. Transaction control is per connection,
not per thread. 

Igor Tandetnik



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-08 Thread drh
"Salles, Joaquim Campos" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Is safe to use the same database connection  at the same time in more
> than one thread? The bellow like that is safe: 
> 
> http://www.sqlite.org/34to35.html
> 
> "Restrictions on the use of the same database connection by multiple
> threads have been dropped. It is now safe for multiple threads to use
> the same database connection at the same time."
> 
> But in following URL say:
> 
> http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
> 
> "Do not use the same database connection at the same time in more than
> one thread."
> 
> 
> So, for SQlite 3.5.* is safe to use the same database connection at the
> same time in more than one thread?
> 

Yes.  The wiki page was correct when written but that was
prior to the release of version 3.5.0.

Note that SQLite uses mutexes internally so what will really
happen is one thread will block while the other is using the
database connection.  Access to database connections is serialized.
But the application code does not need to concern itself with
the serialization any more.  That is now handled automatically
by SQLite.

It is also my duty to earnestly warn programmers of all ilks
that multi-threaded programming is madness.  Multi-threading
causes programs to run slower, have more bugs, and become harder
to maintain.  Threads are deadly.  Avoid them.

--
D. Richard Hipp <[EMAIL PROTECTED]>



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] is safe to use the same database connection at the same time in more than one thread?

2007-11-08 Thread Salles, Joaquim Campos
Hello,

Is safe to use the same database connection  at the same time in more
than one thread? The bellow like that is safe: 

http://www.sqlite.org/34to35.html

"Restrictions on the use of the same database connection by multiple
threads have been dropped. It is now safe for multiple threads to use
the same database connection at the same time."

But in following URL say:

http://www.sqlite.org/cvstrac/wiki?p=MultiThreading

"Do not use the same database connection at the same time in more than
one thread."


So, for SQlite 3.5.* is safe to use the same database connection at the
same time in more than one thread?

Thanks for the help,

Best regards,

Joaquim

-
To unsubscribe, send email to [EMAIL PROTECTED]
-