[sqlite] sqlite thread safe builds
Hi, I'm a sqlite 3.0.8 user on windows only to date. I am using sqlite in a multi-threaded application and have read and understand the requirement to define THREADSAFE=1 in order to ensure that sqlite is built correctly for multi-threaded execution. Would the developer(s) of sqlite consider the following patch, which i believe, automatically builds sqlite with multi-threading support if the MSVC build target is a multi-threaded build? --- os_win.c17 Nov 2004 00:21:38 - 1.1 +++ os_win.c4 Feb 2005 04:10:02 - 1.2 @@ -21,6 +21,16 @@ /* ** Macros used to determine whether or not to use threads. */ +#if defined(_MSC_VER) +# if defined(_MT) +# define SQLITE_W32_THREADS 1 +# pragma message("sqlite3 thread-safe support enabled.") +# else +# undef SQLITE_W32_THREADS +# pragma message("sqlite3 thread-safe support disabled.") +# endif +#endif + #if defined(THREADSAFE) && THREADSAFE # define SQLITE_W32_THREADS 1 #endif The "pragma message" directives are optional, of course. I added them to ensure that my build output would tell me whether sqlite was being built correctly for my project. Since the patch checks for the _MSC_VER macro, it would only affect windows builds, using Microsoft's compilers. There may be similar methods for Borland, Intel, etc., but I'm afraid that I'm only familiar with MS's compilers. Thanks, -- Jeff Thompson [EMAIL PROTECTED]
Re: [sqlite] still struggling with "Database schema has changed" errors
> I am using SQLite 3.0.8 in a Win32 threaded > environment. > > I keep getting random "Database schema has changed" > errors even though I am using thread local > storage to make sure sqlite3_open() gets called > on each thread and a there is a sqlite3* per thread. > > Has anyone had any luck with resolving SQLITE_SCHEMA > errors in a threaded environment? The docs for SQLite mention that you need to specifically compile the libs (DLL) with the THREADSAFE preprocessor macro set to 1 for you to be able to use SQLite in threads Not sure what the DLL's on the web site are compiled with, perhaps that's the issue?
Re: [sqlite] still struggling with "Database schema has changed" errors
On Thu, 03 Feb 2005 14:15:52 -0500, you wrote: >Hello, > >I am using SQLite 3.0.8 in a Win32 threaded >environment. > >I keep getting random "Database schema has changed" >errors even though I am using thread local >storage to make sure sqlite3_open() gets called >on each thread and a there is a sqlite3* per thread. > >Has anyone had any luck with resolving SQLITE_SCHEMA >errors in a threaded environment? How are you accessing the database? Do you open it multiple times and write to it? I had the same problem with the schema errors. I was opening the database twice, and when I would create a table with one of the open instances, the other would get the schema error the next time I started a write operation. I did end up fixing it by rewriting part of the SQLITE code. Randall Fox
Re: [sqlite] Not getting the speed I think is possoble. Basic select statment slow?
> Did you try www.aducom.com/sqlite, you can create it dynamically in your > code or use it as VCL-component. > It also works in Delphi6 > > Use the Database component and the Query component, you get a > tdataset-alike resultset. That's the one we were using initially that seemed slow. I tried the version for SQLite 3 but I don't think it is completely working at this point. It seemed as if they where still converting from the old style 2.8 callbacks Eventually we discovered a wrapper that, while it doesn't have the same functionality as the Aducom stuff, it was faster so I stopped trying to work out what I was doing wrong and swopped over The wrappers don't even have a decent name :) they were from http://www.itwriting.com/sqlitesimple.php off the SQLite wrappers page. Work fine so far
[sqlite] lol: that was supposed to be "Writing an in-memory database??"
erh, uh... little Freudian slip... -Original Message- From: Lukasik, Andrew [BL60:SF34:EXCH] Sent: Thursday, February 03, 2005 5:56 PM To: 'sqlite-users@sqlite.org' Subject: [sqlite] wringing an in-memory database?? I am currently using sqlite3 as an in-memory (:memory:) database. Is it possible to write a snapshot of the in-memory database to a disk file? I'd like to then be able to use the sqlite3 binary to paw over the data. I realize I could simply change the file name from :memory: if I wanted to do a debugging session during development. But what I'm after here is a way to do debugging/viewing on an in-memory production database. I'd even be intersting to take this snapshot for report generation etc... I've seen a thread here about having multiple binaries connect to a shared in-memory sqlite database. Is this functionality avaliable. I suppose this would work as well. /Andrew
[sqlite] wringing an in-memory database??
I am currently using sqlite3 as an in-memory (:memory:) database. Is it possible to write a snapshot of the in-memory database to a disk file? I'd like to then be able to use the sqlite3 binary to paw over the data. I realize I could simply change the file name from :memory: if I wanted to do a debugging session during development. But what I'm after here is a way to do debugging/viewing on an in-memory production database. I'd even be intersting to take this snapshot for report generation etc... I've seen a thread here about having multiple binaries connect to a shared in-memory sqlite database. Is this functionality avaliable. I suppose this would work as well. /Andrew
RE: [sqlite] Not getting the speed I think is possoble. Basic select statment slow?
Tried to compile your wrapper this morning with no luck The code seems to be written with Delphi 7 or higher? We are still using delphi 6 which doesn't have the SysUtils data structure TFormatSettings, and the functions FormatDateTime have different declarations (only 2 paramaters) Those where the only issues I could see at a glacne, may try and hack that out at a later date when I get more time > out of curiocity, can you give a try to my delphi wrappers? > http://www.sqlite.org/contrib > (not Tdataset replacement, though, but they should be quite fast for this > reason. also try the "serverCursor" setting, which allows you to step thorugh > the result set one at a time, meaning there is no double-buffering required: > > rs:=db.createStatement; > rs.serverCursor:=true; > rs.open > while not rs.eof do.. > > let me know how they fare speed-wise, as I have not tested any other > wrappers..
[sqlite] malformed 2.8.15 database
I have a malformed 2.8.15 database and I'm reasonably sure it is my own fault. But would anybody be interested in looking at it just in case? When I run integrity_check on it, I get a lot of these: rowid 536 missing from index (els_task_score autoindex 1) And then finally: SQL error: database disk image is malformed
[sqlite] still struggling with "Database schema has changed" errors
Hello, I am using SQLite 3.0.8 in a Win32 threaded environment. I keep getting random "Database schema has changed" errors even though I am using thread local storage to make sure sqlite3_open() gets called on each thread and a there is a sqlite3* per thread. Has anyone had any luck with resolving SQLITE_SCHEMA errors in a threaded environment? Thanks, Kervin
Re: [sqlite] Adding a new field in sqlite
ALTER table-name ADD COLUMN column-name TYPE ... is not supported under SQLite. The best approach is to create a new table with the extra column and copy the existing table into it. Regards, Uriel_Carrasquilla "Anirban Sarkar" <[EMAIL PROTECTED]To:escltd.com> cc: Subject: [sqlite] Adding a new field in sqlite 02/03/2005 04:02 AM Please respond to sqlite-users Hi all, I want to add a new field 'flag' to my existing table 'mri' in sqlite. How can I do that? Regards, Anirban Sarkar
[sqlite] Adding a new field in sqlite
Hi all, I want to add a new field 'flag' to my existing table 'mri' in sqlite. How can I do that? Regards, Anirban Sarkar