Re: [sqlite] Bug: Database connection closed on different thread

2007-10-02 Thread drh
patters <[EMAIL PROTECTED]> wrote:
> Greetings,
> 
> We ran into a bug that's not documented behavior: closing a connection that
> was created in a different thread (where thread A calls sqlite3_open[16],
> "hands off" the connection to thread B, and thread B calls sqlite3_close). 
> 
> The documentation (http://www.sqlite.org/faq.html#q6) says that any
> functions can be used with a connection as long as it's not being used by
> another thread. With SQLITE_ENABLE_MEMORY_MANAGEMENT defined,

The documentation says that when SQLITE_ENABLE_MEMORY_MANAGEMENT
is defined then all operations against a database connection must
occur in the same thread in which the database connection was
originally opened.

This constraint exists for all versions of SQLite before and
including 3.4.2.  The constraint is removed in version 3.5.0.

And as is my custom, I must also warn you that your best remedy
is to not use threads in the first place since threads are
evil and programs that use threads are almost always buggy and 
slow. If you feel compelled to use threads in spite of this 
warning, then upgrading to SQLite version 3.5.0 will probably 
work out better for you than trying to use version 3.4.2 or 
earlier.

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


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



[sqlite] Bug: Database connection closed on different thread

2007-10-02 Thread patters

Greetings,

We ran into a bug that's not documented behavior: closing a connection that
was created in a different thread (where thread A calls sqlite3_open[16],
"hands off" the connection to thread B, and thread B calls sqlite3_close). 

The documentation (http://www.sqlite.org/faq.html#q6) says that any
functions can be used with a connection as long as it's not being used by
another thread. With SQLITE_ENABLE_MEMORY_MANAGEMENT defined, the cleanup
code in sqlite3PagerClose triggers a NULL exception, since the
thread-specific pager list for the second thread hasn't been used: 

  if( pPager==pTsd->pPager ){
pTsd->pPager = pPager->pNext;
  }else{
Pager *pTmp;
for(pTmp = pTsd->pPager; pTmp->pNext!=pPager; pTmp=pTmp->pNext){}
pTmp->pNext = pPager->pNext;
  }

In our tests, pTsd->pPager was NULL, so dereferencing pTmp (pTmp->pNext) is
the problem. This may be fixed in 3.5; we're using 3.4.2.

-- 
View this message in context: 
http://www.nabble.com/Bug%3A-Database-connection-closed-on-different-thread-tf4558261.html#a13008373
Sent from the SQLite mailing list archive at Nabble.com.


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



Re: [sqlite] SQL command support question

2007-10-02 Thread John Stanton
Those commands are specific to the sqlite3 command line tool program. 
Run sqlite3 from a command line to get them.



José Antonio Gonçalves Motta wrote:

I'm accessing SQLite through a JDBC driver in a java program, but I
get an error everytime I use SQLite line command (like ".output"). Is
it because the driver doesn't understand those commands? The driver
I'm using is from http://www.zentus.com/sqlitejdbc/ . Can anyone who
used this driver help me? I know I can do write the output file
through java itself, but it'd be more convenient if I could use the
SQLite command.

Thanks in advance,
José Antonio Motta

2007/10/1, Dwight Ingersoll <[EMAIL PROTECTED]>:


I was wondering if SQLite supports the command
SELECT ... INTO OUTFILE ...



Can't you accomplish this in the programming language you're using to access
the SQLite database?  The SQLite command line utility (
http://www.sqlite.org/sqlite.html) has an option for specifying an output
file.




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




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



[sqlite] Re: SQL command support question

2007-10-02 Thread Igor Tandetnik

José Antonio Gonçalves Motta
<[EMAIL PROTECTED]> wrote:

I'm accessing SQLite through a JDBC driver in a java program, but I
get an error everytime I use SQLite line command (like ".output").


You are confusing SQLite database engine with sqlite3 command line 
utility. Commands like .output are implemented by the latter, not the 
former. sqlite3 is an application that uses SQLite engine internally - 
just like yours.


Igor Tandetnik 



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



RE: [sqlite] SQL command support question

2007-10-02 Thread Griggs, Donald
Regarding:  I'm accessing SQLite through a JDBC driver in a java program, but I 
get an error everytime I use SQLite line command (like ".output"). Is it 
because the driver doesn't understand those commands?"



Commands such as ".output" are not part of sqlite proper. They are part of the 
command line utility program (though that program is itself open source should 
you need it).

Look on page:
   http://www.sqlite.org/download.html
for the "command-line program" (sqlite3)

 

-Original Message-
From: José Antonio Gonçalves Motta [mailto:[EMAIL PROTECTED] 


This message has been scanned for viruses by MailControl - www.mailcontrol.com

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



Re: [sqlite] getting a segfault on FreeBSD 6.2R with sqlite 3.4.1

2007-10-02 Thread Joe Wilson
Could you recompile everything with -g to enable debugging with 
line numbers in the backtrace?

If FreeBSD has valgrind, running the program through that would be 
useful as well.

--- "Chad Leigh -- Shire.Net LLC" <[EMAIL PROTECTED]> wrote:
> Running it in gdb shows
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x50c000 (LWP 100331)]
> 0x000802f76869 in sqlite3Fts2InitHashTable () from /usr/public/ 
> lib/libsqlite3.so.8
> (gdb) backtrace
> #0  0x000802f76869 in sqlite3Fts2InitHashTable () from /usr/ 
> public/lib/libsqlite3.so.8
> #1  0x000802f74f8f in sqlite3Fts2Init () from /usr/public/lib/ 
> libsqlite3.so.8
> #2  0x000802f41be5 in openDatabase () from /usr/public/lib/ 
> libsqlite3.so.8
> #3  0x000802e0bd91 in pysqlite_connection_init () from /usr/ 
> public/lib/python2.5/site-packages/pysqlite2/_sqlite.so
> #4  0x0008006ab6fb in PyType_IsSubtype () from /usr/public/lib/ 
> libpython2.5.so.1
> #5  0x00080066ec83 in PyObject_Call () from /usr/public/lib/ 
> libpython2.5.so.1
> #6  0x000802e09f95 in module_connect () from /usr/public/lib/ 
> python2.5/site-packages/pysqlite2/_sqlite.so
> #7  0x00080066ec83 in PyObject_Call () from /usr/public/lib/ 
> libpython2.5.so.1



  

Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



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



RE: [sqlite] PRAGMA synchronous=0; and crash recovery

2007-10-02 Thread Andre du Plessis
I think everyone has this requirement, I was finding many slowness
problems using synchronous = on, and I started tweaking the app with
memory tables, 
I recommend you look into it, you can create a memory Database by
specifying :memory: as the filename.

The connection you receive from this you can attach to the file
database, see the ATTACH command, then you can select data from one to
the other, for speed do all things in the memory until you want to save
at the critical point where your process must save the data or changes
it made, then you can write all of the information from the memory table
with a simple insert select from the memory table then clear memory and
continue, this also helps as youre not locking out other
threads/processes from the file db for to long.

If you search the forum you can get lots of help on ATTACH and :memory:
as you need, but then I'd leave my file DB to be as ACID as possible.

-Original Message-
From: Scott Gilbert [mailto:[EMAIL PROTECTED] 
Sent: 01 October 2007 11:01 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] PRAGMA synchronous=0; and crash recovery

A quick introduction:  I'm a software developer in Tucson AZ, and I'm a
new
sqlite user (version 3.4.2).  I'm really very impressed with this
software.
Thank you very much to everyone who has contributed to it!

I have an application that requires separate processes (under Linux) to
concurrently update records in some shared tables (multiple SELECTs and
UPDATEs inside of a transaction).  Unfortunately, when I have PRAGMA
synchronous = 1 or 2, it is too slow for my needs, while synchronous = 0
is
plenty fast enough.

It is very likely that I *will* lose power when my application is
running.
When this happens, I can live with losing the last few minutes of
transactions, but a corrupted database file that lost all data would
cause
much grief to my users (and therefore me).

So my questions are:

With synchronous = 0, are transactions still atomic across
processes?
Is running with synchronous=0 likely to non-recoverably corrupt the
database file on power failure?
Are there any recovery tools that can restore consistancy?

I apologise if this has been answered somewhere else (an hour or two of
googling didn't find anything that specifically covered synchronous =
0).
Thank you in advance for any replies!

Cheers,
-Scott

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