Re: [sqlite] Compile SQLite3 for MS Windows Driver Kit user-mode application

2008-10-14 Thread Bjorn Rauch

Hi again,
 
First, I am not an expert in WDK programming. But there are a few nice samples 
very close to what I need and thus I tried to compile a WDK sample with the 
sqlite3 DLL. The sample is a minifilter driver, which consists of two parts: 
the minifilter driver itself, which runs in kernel-mode and a user-mode 
application that catches the filtered requests through a communication port 
bridging the kernel- and user-mode.
 
I changed the user-mode application to use the sqlite3 api. To start with, I 
didn't do much in the code, just open/close a database. In order to build the 
user-mode application, I generated a lib-file for the sqlite3.dll. However, the 
WDK environment ignored the lib-file entirely whatever I tried. I couldn't 
figure out why but I guess this does not really work. For example, the standard 
C libraries and headers are all shipped separately with the WDK.
 
My second approach was to compile sqlite3 myself within the WDK. But the WDK 
build environment requires warnings to be treated as errors which in my opinion 
makes perfect sense. (I woudln't believe 10 agreeing programmers either; I have 
seen examples where all of them agreed that there would be no coding error. But 
of course this was the case. Btw, why checking intellectually that the 
conversions are safe when fixing it properly takes no time in comparison?? I 
don't believe it is checked.) Also, the number of warnings/errors is higher 
than in normal Win32 build (679 warnings to 524 warnings on warning level 4). 
Plus 1 error regarding localtime_s (C4013, undefined). This error is crazy as 
the function is in the defined by the WDK as well as included to the source. 
But this is a side note only.
 
Mark Spiegel wrote: > Not sure why the Win32 DLL is not compatible. I would 
think it should > be. You might want to work that out first. Can you elaborate?
> > As for compiling with the WDK, it can be done. The amalgamated source > is 
> > best.> > The flood of warnings is a pain. SQLite dev claims they are all > 
> > spurious, but with so many I wouldn't venture to guess how they can tell.>  
> > > For W32, you should be able to disable "treat warnings as errors" for > 
> > just the sqlite3.c file if your development organization allows this. > If 
> > you are building 64 bits, then you have more work to do. The last > time I 
> > ported in new SQLite source, it still cast 32 bit integers into > 64 bit 
> > pointers. The WDK compiler isn't going to allow this without > some source 
> > modifications. I did write a ticket so this might be > fixed. As of the 
> > last time I checked, it was not.> > Bjorn Rauch wrote:> > Hello,> > > > Has 
> > anybody tried to compile SQLite3 with the MS WDK? The Win32 
> > DLL is not compatible as far as I understand and recompiling with the 
> > WDK is > necessary. But using the source code as is results in many 
> > warnings (mostly conversion errors). The WDK does not tollerate these.> > > 
> > > Best regards,> > Bjorn
_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world=en-US=QBRE
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Compile SQLite3 for MS Windows Driver Kit user-mode application

2008-10-06 Thread Bjorn Rauch

Hello,
 
Has anybody tried to compile SQLite3 with the MS WDK? The Win32 DLL is not 
compatible as far as I understand and recompiling with the WDK is necessary. 
But using the source code as is results in many warnings (mostly conversion 
errors). The WDK does not tollerate these.
 
Best regards,
Björn
_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [sqlite-announce] Foreign key trigger in transactiontriggers wrongly

2008-09-17 Thread Bjorn Rauch
> From: Simon Davies <[EMAIL PROTECTED]>> Date: 2008/9/16> Subject: Re: 
> [sqlite-announce] Foreign key trigger in transaction> triggers wrongly> To: 
> [EMAIL PROTECTED], [EMAIL PROTECTED]> > > 2008/9/16 Björn Rauch <[EMAIL 
> PROTECTED]>:> > Hello,> .> .> .> > This looks to me like the trigger does not 
> see the changes made within the> > transaction, i.e. the new row in the table 
> Document. Am I doing something> > wrong? Is this unexpected behavior?> >> > 
> Thanks in advance for your help!> >> > Bjorn> >> > -> > > Hi,> > SQLite 
> version 3.4.2> Enter ".help" for instructions> sqlite>> sqlite> CREATE TABLE 
> [Document]> ...> (> ...> [Id] INTEGER PRIMARY KEY AUTOINCREMENT,> ...> 
> [Title] TEXT(200)> ...> );> sqlite>> sqlite> -- primary key read only> 
> sqlite>> sqlite> CREATE TRIGGER [pk_Document]> ...> BEFORE UPDATE OF [Id] ON 
> [Document]> ...> FOR EACH ROW> ...> BEGIN> ...> SELECT RAISE( ABORT, 'Primary 
> key invariant: pk_Document' );> ...> END;> sqlite>> sqlite> -- table File> 
> sqlite>> sqlite> CREATE TABLE File> ...> (> ...> Id INTEGER PRIMARY KEY 
> AUTOINCREMENT,> ...> DocumentId INTEGER, -- foreign key (Document.Id)> ...> 
> RootFolder TEXT(100), -- foreign key (Storage.RootFolder)> ...> FileName 
> TEXT(250),> ...> FullName TEXT(500),> ...> Path TEXT(250)> ...> );> sqlite>> 
> sqlite> -- primary key read only> sqlite>> sqlite> CREATE TRIGGER [pk_File]> 
> ...> BEFORE UPDATE OF [Id] ON [File]> ...> FOR EACH ROW> ...> BEGIN> ...> 
> SELECT RAISE( ABORT, 'Primary key invariant: pk_File' );> ...> END;> sqlite>> 
> sqlite> -- foreign key File.DocumentId --> Document.Id> sqlite>> sqlite> 
> CREATE TRIGGER [fk_File_Document_del]> ...> BEFORE DELETE ON [Document]> ...> 
> FOR EACH ROW> ...> WHEN (old.[Id] IN (SELECT [DocumentId] FROM [File] GROUP> 
> BY [DocumentId]))> ...> BEGIN> ...> SELECT RAISE( ABORT, 'Foreign key 
> violated: fk_File_Document_del' );> ...> END;> sqlite>> sqlite> CREATE 
> TRIGGER [fk_File_Document_ins]> ...> BEFORE INSERT ON [File]> ...> FOR EACH 
> ROW> ...> WHEN (new.[DocumentId]<>0 AND new.[DocumentId] NOT IN> (SELECT [Id] 
> FROM [Document]))> ...> BEGIN> ...> SELECT RAISE( ABORT, 'Foreign key 
> violated: fk_File_Document_ins' );> ...> END;> sqlite>> sqlite> CREATE 
> TRIGGER [fk_FileDocument_upd]> ...> BEFORE UPDATE ON [File]> ...> FOR EACH 
> ROW> ...> WHEN (new.[DocumentId] NOT IN (SELECT [Id] FROM [Document]))> ...> 
> BEGIN> ...> SELECT RAISE( ABORT, 'Foreign key violated: fk_File_Document_upd' 
> );> ...> END;> sqlite>> sqlite>> sqlite> --> sqlite> -- Insert some sample 
> data> sqlite> --> sqlite> BEGIN;> sqlite> INSERT INTO [Document] ([Title]) 
> VALUES ('blabla');> sqlite> INSERT INTO File VALUES( 422, 0, 'root folder', 
> 'file name',> 'full name', 'path' );> sqlite>> sqlite>> --> -- Not sure why 
> you have included this next select...> --> sqlite> SELECT [seq] FROM 
> [sqlite_sequence] WHERE [name]='Document';> 1> sqlite>> sqlite> --> sqlite> 
> -- What have we got?> sqlite> --> sqlite> select * from document;> 1|blabla> 
> sqlite> select * from file;> 422|0|root folder|file name|full name|path> 
> sqlite>> sqlite>> sqlite> --> sqlite> -- Now try the update> sqlite> --> 
> sqlite> UPDATE [File] SET [DocumentId]=1 WHERE [Id]=422;> sqlite>> sqlite> 
> COMMIT;> sqlite>> > works fine...> > Of course, if I delete all entries from 
> Document and File, then run> the script again it will fail, because the next 
> time through the> Document record will have DocumentId of 2.> > Rgds,> Simon
Yes, indeed it works this way. But I am executing these commands from a .NET 
application using SQLite.NET (SQLite for ADO.NET 2.0, 
http://sqlite.phxsoftware.com) to make these calls. Transaction handling seems 
to work there, but the trigger is raised as I explained.
 
Of course, maybe the ADO.NET provider implementation might be the culprit.
 
Regards,
Bjorn
 
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create_url=/friends.aspx=en-us
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users