=?ISO-8859-1?Q?Tobias_Rundstr=F6m?= <[EMAIL PROTECTED]> wrote:
>
> Got this email from this a developer of XMMS2 Sounds a bit scary,
> anyone have seen this before?
>
> Begin forwarded message:
>
> > From: Alexander Botero-Lowry <[EMAIL PROTECTED]>
> > Date: måndag 3 jul 2006 16.13.29 GMT-04:00
> > To: [EMAIL PROTECTED]
> > Subject: Fw: sqlite3_busy_timeout() on NetBSD
> >
> >
> > I'm an xmms2 developer who does most of the work of getting xmms2
> > working on the various BSDs. I've currently run into a strange problem
> > with sqlite3_busy_timeout on NetBSD. It seems that it doesn't timeout
> > at all. ....
> >
> > !DSPAM:44a97a9f190355315134984!
> >
>
Thanks for the login, Alex.
To test the behavior of sqlite3_busy_timeout on NetBSD, I
used the simple program shown below. This program sets the
busy timeout to 60, then runs the SQL statement given in its
second argument.
To do the test, I first opened the test database using the
regular sqlite3 shell and executed "BEGIN EXCLUSIVE" there.
Like this:
$ sqlite3 t1.db
sqlite> BEGIN EXCLUSIVE;
Then in a separate terminal window, Ii typed:
./a.out t1.db 'SELECT * FROM t1'
The a.out program froze waiting on the lock to clear. In
the first window I typed: COMMIT. This caused the a.out
program running in the second window to immediately return
its results.
So I am unable to reproduce the problem you are having
with sqlite3_busy_timeout. It appears to be working correctly
to me.
Perhaps you can suggest an different test that will
reproduce the problem?
-------------------------------------------------------------------
#include <stdio.h>
#include <sqlite3.h>
static int print_result(void *notUsed, int nArg, char **apArg, char **apCol){
int i;
for(i=0; i<nArg; i++){
printf("%s = %s\n", apCol[i], apArg[i]);
}
return 0;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg;
if( argc!=3 ){
fprintf(stderr, "Usage: %s DBNAME SQL\n", *argv);
return 1;
}
if( sqlite3_open(argv[1], &db)!=SQLITE_OK ){
fprintf(stderr, "Error opening database\n");
return 1;
}
sqlite3_busy_timeout(db, 60000);
if( sqlite3_exec(db, argv[2], print_result, 0, &zErrMsg)!=SQLITE_OK ){
fprintf(stderr, "Error: %s\n", zErrMsg);
return 1;
}
return 0;
}
--
D. Richard Hipp <[EMAIL PROTECTED]>