Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread Joe Wilson
--- Nathaniel Smith <[EMAIL PROTECTED]> wrote: > On Wed, Jun 07, 2006 at 01:24:38PM -0400, [EMAIL PROTECTED] wrote: > > If it is inconvenient to rollback and retry the entire transaction, > > then start the transaction initially with BEGIN EXCLUSIVE. This > > will acquire the reserved lock

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Joe Wilson
What you're trying to do is possible without .def files or import files or whatever. Just put something like this in sqlite3.h before everything: #ifdef _WIN32 #define S3EXPORT __declspec(dllexport) #define S3IMPORT __declspec(dllimport) #define S3CALL __stdcall #ifdef

Re: [sqlite] disabling rollback journal

2006-06-07 Thread Michael Scharf
Without journalling, you cannot have a ROLLBACK command. And the semantics of UPDATE become UPDATE OR FAIL instead of the default UPDATE OR ABORT. The difference is subtle, but important. There are other reasons to disable the rollback journal: Suppose you want to create a database for

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread A. Pagaltzis
* Pat Wibbeler <[EMAIL PROTECTED]> [2006-06-07 22:55]: > It's entirely possible I'm reading these docs incorrectly, but > this strategy has worked quite well for me. No, I don’t see any error in your reading. My apologies; I should have consulted the docs instead of going by mailing list posts.

Re: [sqlite] Large DB Performance Questions

2006-06-07 Thread Michael Sizaki
Hi Mark, have you tried to do a VACUUM on the database? It helps a lot when it comes to the 'read ahead' feature of the database. Michael Mark Drago wrote: Hello, I'm writing a web cache and I want to use SQLite to store the log of all of the accesses made through the web cache. The idea

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Ted Unangst
Robert Simpson wrote: Pardon my ignorance about *nix, but what happens during this whole global symbol mapping thing if two libraries both export the same function name? generally the first one is picked, though there's variations between OS. the search order for first is fairly flexible

Re: [sqlite] Help. Database 4096 Mb in Windows XP

2006-06-07 Thread Eduardo
At 22:56 07/06/2006, you wrote: Hi. In mine to a database after the size of a file of base has reached 4096 Mb, I am not added any more records. After a command sqlite3_step the mistake (sqlite3_errmsg) stands out: "SQL logic error or missing database". Please help, it is necessary for me to

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread Bill KING
Jay Sprenkle wrote: > On 6/7/06, Bill KING <[EMAIL PROTECTED]> wrote: >> I understand why I'm getting the deadlock now, lazy locking, (it's >> against the logical grain of transaction/locking, but that's a whole >> other argument) . Maybe this should be highlighted with big arrows in >> the

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread Bill KING
[EMAIL PROTECTED] wrote: > Bill King <[EMAIL PROTECTED]> wrote: > >> Christian Smith wrote: >> >>> If one transaction already has a read lock, and another transaction >>> has a reserved lock (trying to get a write lock), neither thread can >>> get a write lock. One of the transactions

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Dennis Cote
Dennis Jenkins wrote: You can do something very similar on windows. Just dump a hacked "kernel32.dll" into the same directory as the EXE. This might not work with SP2 of XP for system DLLs. However, if the EXE uses a non-system DLL (like libJpeg.dll), then just replace that one. Put some

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread Craig Morrison
Bill King wrote: It would be nice if SQLite told us this. However, SQLite detects the reserved lock and returns SQLITE_BUSY, telling niether transaction much other than to try again. If a reserved lock is detected when trying to promote an existing read lock, this is a deadlock situation

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Dennis Jenkins
[EMAIL PROTECTED] wrote: > Dennis Jenkins <[EMAIL PROTECTED]> wrote: > >> The Windows way does not seem as powerful as the Unix way. I hate >> the M$ operating systems, but I code for them almost every day. So my >> next statement isn't so much a defense of Microsoft , but a rebuttal to

Re: [sqlite] :memory: DB releasing storage

2006-06-07 Thread drh
"Rick Keiner" <[EMAIL PROTECTED]> wrote: > Yes, apparently. The :memory: DB doesn't show the storage being reclaimed by > the OS. In fact, after some more analysis, it's not reusing storage already > allocated. :( Could that be? > > After checking the vacuum.c code. It's not doing anything for an

[sqlite] Help. Database 4096mb

2006-06-07 Thread Андрей Лапин
Hi. In mine to a database after the size of a file of base has reached 4096 Mb, I am not added any more records. After a command sqlite3_step the mistake (sqlite3_errmsg) stands out: "SQL logic error or missing database". Please help, it is necessary for me to process a lot of records. Operation

Re: [sqlite] :memory: DB releasing storage

2006-06-07 Thread Rick Keiner
Yes, apparently. The :memory: DB doesn't show the storage being reclaimed by the OS. In fact, after some more analysis, it's not reusing storage already allocated. :( Could that be? After checking the vacuum.c code. It's not doing anything for an in-memory DB. Would that be handled elsewhere?

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread A. Pagaltzis
* Pat Wibbeler <[EMAIL PROTECTED]> [2006-06-07 20:50]: > Beginning everything with BEGIN IMMEDIATE should eliminate the > possibility of deadlock, but you will serialize read-only > operations. Why? BEGIN IMMEDIATE acquires a for-read lock. Multiple for-read locks can be acquired concurrently. It

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread drh
Dennis Jenkins <[EMAIL PROTECTED]> wrote: > > The Windows way does not seem as powerful as the Unix way. I hate > the M$ operating systems, but I code for them almost every day. So my > next statement isn't so much a defense of Microsoft , but a rebuttal to > your assertion that "the

RE: [sqlite] OT: SQL Help

2006-06-07 Thread Jarrett, Zachary
If filestamp is your identifier, the following statement will do the job... DELETE FROM files WHERE filestamp IN (SELECT filestamp FROM snapshot); I recommend that you check out some tutorials online and at least learn the basics. There's no reason to continue to suck at SQL. A good place to

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Dennis Jenkins
Robert Simpson wrote: >> -Original Message- >> From: Dennis Jenkins [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, June 07, 2006 11:46 AM >> To: sqlite-users@sqlite.org >> Subject: Re: [sqlite] DLLs containing user-defined SQL functions >> >> Robert Simpson wrote: >>

RE: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Robert Simpson
> -Original Message- > From: Dennis Jenkins [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 07, 2006 11:46 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] DLLs containing user-defined SQL functions > > Robert Simpson wrote: > >> -Original Message- > >> From: [EMAIL

[sqlite] OT: SQL Help

2006-06-07 Thread Craig Morrison
With all the other discussions going on with more important matters please excuse this brief interruption.. I have two tables that are created thusly: CREATE TABLE files (filehash VARCHAR(48) UNIQUE, filestamp INTEGER, filename VARCHAR(2048)); CREATE TABLE snapshot (filehash VARCHAR(48)

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Dennis Jenkins
Robert Simpson wrote: >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, June 07, 2006 10:36 AM >> To: sqlite-users@sqlite.org >> Subject: Re: [sqlite] DLLs containing user-defined SQL functions >> >> >> It's official then: The lack of sensible

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Pat Wibbeler
Beginning everything with BEGIN IMMEDIATE should eliminate the possibility of deadlock, but you will serialize read-only operations. If your transactions are short or contention is low, using BEGIN IMMEDIATE makes things easy. However, if you find that you have a set of read-only operations that

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Jiri Hajek
> If it is inconvenient to rollback and retry the entire transaction, then start the transaction initially with BEGIN EXCLUSIVE. > This will acquire the reserved lock immediately (instead of waiting to the first write occurs) and so you will either get an > SQLITE_BUSY right away (when it is a

[sqlite] help - sqlite3_get_table returns SQLITE_ROW?

2006-06-07 Thread Doug Fajardo
I have a sqlite3_get_table query that sometimes returns error code 100 ( SQLITE_ROW). Can someone explain what condition would cause this - I didn't think that this return code would happen for this function, since it should fill up the 'results' table. The query sometimes works, sometimes

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread drh
"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > > Note an inherent chicken and egg problem: you can't build two DLLs (or > an EXE and a DLL) using this approach where a circular dependency > exists, that is, where DLL A needs a function exported from DLL B, and > at the same time DLL B needs a

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Laurent Blanquet
Hello, It could be done using something like that : === sharedenv.h// used in calling program and DLL. === typedef struct{ pointer to functions funA,funB ... etc } mysharedfuns; = Main Program = mysharedfuns sharedfuns; main() {

[sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Dave Dyer
Have the main program pass the DLL a callback table. Main and DLL can share the definition of the callback, but the DLL should do a reasonable runtime check that the table it is presented matches the one it expects.

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread drh
Christian Smith <[EMAIL PROTECTED]> wrote: > On Wed, 7 Jun 2006, Jiri Hajek wrote: > > > However, right after fixing this, I found another problem. It certainly can > > be my fault, but I don't see how could it be: If I don't use transactions, > > multiple threads seem to proceed well, but then

[sqlite] Re: Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Igor Tandetnik
Christian Smith <[EMAIL PROTECTED]> wrote: This is one of the most painful aspects of Windows programming (among many) but can be somewhat mitigated by doing away with .def files: http://msdn2.microsoft.com/en-us/library/3y1sfaz2.aspx Basically, wrap the above in a macro, something like: #ifdef

Re: [sqlite] BEGIN and Backup [was [sqlite] Problems with multiple threads?]

2006-06-07 Thread drh
"Pat Wibbeler" <[EMAIL PROTECTED]> wrote: > You can use BEGIN IMMEDIATE or BEGIN EXCLUSIVE depending on the type of > lock you'd like. > If you are just trying to make sure the database does not change while you back it up, then Jay's suggestion of BEGIN IMMEDIATE is the better approach (better

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Pat Wibbeler
Do you have any transactions that look like: BEGIN SELECT INSERT/DELETE/UPDATE COMMIT If you do, you may have multiple threads trying to escalate from a SHARED to a RESERVED lock as described here: http://sqlite.org/capi3ref.html#sqlite3_busy_handler It's important that if you have

RE: [sqlite] BEGIN and Backup [was Re: [sqlite] Problems with multiple threads?]

2006-06-07 Thread Pat Wibbeler
You can use BEGIN IMMEDIATE or BEGIN EXCLUSIVE depending on the type of lock you'd like. SQLite BEGIN syntax: http://sqlite.org/lang_transaction.html SQLite locks: http://sqlite.org/lockingv3.html SQLite Busy Handler: http://sqlite.org/capi3ref.html#sqlite3_busy_handler Pat -Original

Re: [sqlite] BEGIN and Backup [was [sqlite] Problems with multiple threads?]

2006-06-07 Thread Russell Leighton
Thx! [EMAIL PROTECTED] wrote: Russell Leighton <[EMAIL PROTECTED]> wrote: So, this was very enlightening...I have a simple backup function that I now question is correct. It does: - execute "begin" // lock from writes -copy db file to new file byte by byte - execute "commit" //

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Christian Smith
On Wed, 7 Jun 2006, Jiri Hajek wrote: However, right after fixing this, I found another problem. It certainly can be my fault, but I don't see how could it be: If I don't use transactions, multiple threads seem to proceed well, but then right after I add BEGIN and COMMIT to some place, all

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread Jay Sprenkle
On 6/7/06, Jiri Hajek <[EMAIL PROTECTED]> wrote: However, right after fixing this, I found another problem. It certainly can be my fault, but I don't see how could it be: If I don't use transactions, multiple threads seem to proceed well, but then right after I add BEGIN and COMMIT to some

Re: [sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Christian Smith
On Wed, 7 Jun 2006, Igor Tandetnik wrote: Dennis Jenkins <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: On Windows, the loader works in a very different way. Basically, export/import connections are established at link time, not at load time.

RE: [sqlite] disabling rollback journal

2006-06-07 Thread Allan, Mark
> I have been in contact with the developer of your flash filesystem > and we are working on a solution now... That really is excellent news. Thanks for your interest and effort. I look forward to the solution. DISCLAIMER: This information and any attachments contained in this email message

Re: [sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Christian Smith
On Wed, 7 Jun 2006, Igor Tandetnik wrote: [EMAIL PROTECTED] wrote: "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: On Windows, the loader works in a very different way. Basically, export/import connections are established at link time, not at load time. The loader does not perform a symbol search

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Jiri Hajek
Thanks for an additional explanation, I used sqlite3_get_autocommit() for debugging and it helped me to find out that it really was my fault. There was an incorrect processing after COMMIT returned SQLITE_BUSY. So sorry for this. However, right after fixing this, I found another problem. It

[sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Igor Tandetnik
Dennis Jenkins <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: On Windows, the loader works in a very different way. Basically, export/import connections are established at link time, not at load time. The loader does not perform a symbol search

[sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: On Windows, the loader works in a very different way. Basically, export/import connections are established at link time, not at load time. The loader does not perform a symbol search over all the DLLs, the import tables in the

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Jay Sprenkle
On 6/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: The disadvantages to the windows approach are obvious. Before I add this characteristic to the ever-growing list of reasons why I hate windows and especially hate programming for windows, I should be fair and ask if there are any advantages

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Dennis Jenkins
[EMAIL PROTECTED] wrote: > "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > >>> This all works great on Unix. When I use dlopen() to >>> attach the shared library, the procA() reference in >>> the shared library is automatically resolved to the >>> address of procA() in the main program. >>>

Re: [sqlite] BEGIN and Backup [was Re: [sqlite] Problems with multiple threads?]

2006-06-07 Thread Jay Sprenkle
On 6/7/06, Russell Leighton <[EMAIL PROTECTED]> wrote: So, this was very enlightening...I have a simple backup function that I now question is correct. It does: - execute "begin" // lock from writes -copy db file to new file byte by byte - execute "commit" // unlock ...I was

Re: [sqlite] :memory: DB releasing storage

2006-06-07 Thread drh
"Rick Keiner" <[EMAIL PROTECTED]> wrote: > Hello, > > Is there anything similar with a ":memory:" DB to auto-vacuum with a disk > DB. I would like to release storage that is no longer being used by SQLite. > Is this possible? > I think auto-vacuum work with :memory: databases just as well as

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread drh
"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > > > This all works great on Unix. When I use dlopen() to > > attach the shared library, the procA() reference in > > the shared library is automatically resolved to the > > address of procA() in the main program. > > On Windows, the loader works in

Re: [sqlite] disabling rollback journal

2006-06-07 Thread drh
"Allan, Mark" <[EMAIL PROTECTED]> wrote: > > Apparently, yes the flash filesystem implements fully atomic writes, = > indeed this was one of the features that made us choose this particular = > filesystem. I know from development of our product that files are only = > updated when the file is

[sqlite] :memory: DB releasing storage

2006-06-07 Thread Rick Keiner
Hello, Is there anything similar with a ":memory:" DB to auto-vacuum with a disk DB. I would like to release storage that is no longer being used by SQLite. Is this possible? Thanks, Rick Keiner

[sqlite] Re: DLLs containing user-defined SQL functions

2006-06-07 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: Suppose the main program (the .exe file) contains a function procA() and the DLL contains a function procB(). I want procB() to be able to call procA(). While it is possible for the EXE to export a function via a .def file, and for DLL to import it, it's a

RE: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Robert Simpson
> -Original Message- > From: Robert Simpson [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 07, 2006 7:55 AM > To: 'sqlite-users@sqlite.org' > Subject: RE: [sqlite] DLLs containing user-defined SQL functions > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL

RE: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Robert Simpson
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 07, 2006 7:30 AM > To: Sqlite-users > Subject: [sqlite] DLLs containing user-defined SQL functions > [snip] > Another way to ask the question is this: How do I build > a DLL in windows that

Re: [sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread Ulrich Schöbel
Hi Richard, I'm no windows expert, but why don't you use something like the tcl stubs mechanism? Build a static sqlite_stubs.a library and link all loadable dynamic libs against it. Kind regards Ulrich On Wednesday 07 June 2006 16:30, [EMAIL PROTECTED] wrote: > I'm trying to add the ability

RE: [sqlite] Problems with multiple threads?

2006-06-07 Thread Brannon King
For me, I have a bunch of threads writing to the database. That is the only part I do multithreaded. (All my read queries are handled after all the data is written.) I just use the scoped_lock operator from the Boost library at the top of my function that does the bind and step calls. I pass a

[sqlite] DLLs containing user-defined SQL functions

2006-06-07 Thread drh
I'm trying to add the ability to dynamically load DLLs containing SQL functions and collating sequences to SQLite. Things are working great on Unix, but I'm having issues with Windows. Windows experts, please help me. Suppose the main program (the .exe file) contains a function procA() and the

RE: [sqlite] disabling rollback journal

2006-06-07 Thread Allan, Mark
Dr Hipp, Thanks for your reply. I have contacted the authors of our filesystem HCC Embedded. The filesystem we are using is called EFFS, some information can be found at http://www.hcc-embedded.com/site.php if necessary. Apparently, yes the flash filesystem implements fully atomic writes,

Re: [sqlite] disabling rollback journal

2006-06-07 Thread drh
"Allan, Mark" <[EMAIL PROTECTED]> wrote: > > our flash file system is 100% power-fail proof and thus the > journalling of the database for us is not required. > Without journalling, you cannot have a ROLLBACK command. And the semantics of UPDATE become UPDATE OR FAIL instead of the default

[sqlite] disabling rollback journal

2006-06-07 Thread Allan, Mark
All, I have already posted some messages some months ago concerning disabling the creation of the journal file. It seems that currently there is no way to configure SQLite to do this. Journalling, it seems, is an integral part of the paging layer, is this correct? My question is thus, has

Re: [sqlite] Problems with multiple threads?

2006-06-07 Thread drh
As various people search for application and/or SQLite bugs related to multiple threads and BEGIN, let me try to aid the effort by better describing exactly what BEGIN does and suggesting some debugging tricks. Realize that BEGIN does not actually create any file locks or check to see if any

[sqlite] 3.2.8Undefined

2006-06-07 Thread yuyen
Hi, all I install PHP and Apache on a WINDOWS XP box. After I enable the php_pdo.dll and php_pdo_sqlite.dll, the PHP info shows the sqlite version as "3.2.8Undefined". Why is it Undefined? And is it possible to get a later version of php_sqlite.dll , such as 3.3.3? Jack