Re: [sqlite] Compiling with VS 2010 (force foreign key constraints)
OK, i am getting somewhere. I try to use SQLite with custom compiles dll (System.Data.SQLite, System.Data.SQLite.Linq, SQLite.Interop) and it works. No error, which is a huge think for me. But for foregein key ID i can add anythink i want also ID that is not in reference table. I did edit SQLite.Interop\props\sqlite3.props and SQLite.Interop\props\sqlite3.vsprops and add param to common_defines: SQLITE_THREADSAFE=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_DEFAULT_FOREIGN_KEYS=1 I am close. Any idea now? 2012/4/7 Joe Mistachkin > > Matjaž Cof wrote: > > > > Thank's to all. > > Stupid me. But still not working. Is there any documentation how to > compile > > SQLite.NET.2010 solution with SQLITE_DEFAULT_FOREIGN_KEYS=1. > > > > This would require modifying the Visual Studio properties file for the > correct version of > Visual Studio (2010 in your case?) and then recompiling the SQLite.Interop > project. > > The Visual Studio properties files are located in the source tree at the > following location: > > > http://system.data.sqlite.org/index.html/dir?name=SQLite.Interop/props > > The above location corresponds to the "SQLite.Interop\props" directory > inside the root > of the local source tree. The file that you'll need to modify is either > the > "SQLite.Interop\props\sqlite3.vsprops" file (for Visual Studio 2005 or > 2008) > or the > "SQLite.Interop\props\sqlite3.props" file (for Visual Studio 2010). > > Either way, the SQLITE_COMMON_DEFINES macro should be modified to add the > extra preprocessor defines that you require. > > > > > I think, that the problem is, that i am using > > precompiled SQLite.Interop.dll (which is compiled without > > SQLITE_DEFAULT_FOREIGN_KEYS=1 - i think - downloaded from > > > > http://system.data.sqlite.org/downloads/1.0.80.0/sqlite-netFx40-binary-Win32 > -2010-1.0.80.0.zip > > ). > > > > Yes, that could be the problem. The precompiled binary does not have that > preprocessor > define enabled. > > > > > Is there any documentation, how is SQLite.Interop.2010 project integraded > > into System.Data.SQLite.2010 project? > > > > Please refer to the following web pages for details on how the > System.Data.SQLite build process > works: > >http://system.data.sqlite.org/index.html/doc/trunk/www/build.wiki > >http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki > > Other than that, having a good understanding of Visual Studio, interop with > native code, and > multi-language solutions is also very useful. > > -- > Joe Mistachkin > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Compiling with VS 2010 (force foreign key constraints)
Thank's to all. Stupid me. But still not working. Is there any documentation how to compile SQLite.NET.2010 solution with SQLITE_DEFAULT_FOREIGN_KEYS=1. I think, that the problem is, that i am using precompiled SQLite.Interop.dll (which is compiled without SQLITE_DEFAULT_FOREIGN_KEYS=1 - i think - downloaded from http://system.data.sqlite.org/downloads/1.0.80.0/sqlite-netFx40-binary-Win32-2010-1.0.80.0.zip ). Is there any documentation, how is SQLite.Interop.2010 project integraded into System.Data.SQLite.2010 project? 2012/4/6 Joe Mistachkin > > Matjaž Cof wrote: > > > > I am running the latest version. (Just starting to use SQLite and really > > like it). > > Like i sad, i don't want to write sql every time i connec't to database. > > And i use EntityFramework, witch means that ObjectContext doesn't have > any > > ExecuteSql method and because of that, i try to recompile with > > SQLITE_DEFAULT_FOREIGN_KEYS. > > > > It looks like you'll need to make sure you have the > "SQLITE_DEFAULT_FOREIGN_KEYS=1" > set in your preprocess defines (i.e. you cannot just define it with no > value). > > -- > Joe Mistachkin > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Compiling with VS 2010 (force foreign key constraints)
I am running the latest version. (Just starting to use SQLite and really like it). Like i sad, i don't want to write sql every time i connec't to database. And i use EntityFramework, witch means that ObjectContext doesn't have any ExecuteSql method and because of that, i try to recompile with SQLITE_DEFAULT_FOREIGN_KEYS. 2012/4/6 Simon Slavin > > On 6 Apr 2012, at 1:50pm, Matjaž Cof wrote: > > > But here is the problem. For foregein key i can insert any value even if > > inserted ID not exist in reference table. > > See this page > > <http://sqlite.org/foreignkeys.html> > > You must be running at least 3.6.19. And you must have > > PRAGMA foreign_keys = ON > > Simon. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Compiling with VS 2010 (force foreign key constraints)
I figure it out, that ObjectListView "eat" error. I was missing SQLite.Interop.dll. I found it in prebuild ( http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki). But here is the problem. For foregein key i can insert any value even if inserted ID not exist in reference table. I add the SQLITE_DEFAULT_FOREIGN_KEYS to the proprocessor definitions to both of SQLite.Interop.2010 and SQLite.Interop.Static.2010 projects. I expect, that build solution will give me the new SQLite.Interop.dll with SQLITE_DEFAULT_FOREIGN_KEYS. Am i incorrect? 2012/4/5 Joe Mistachkin > > Matjaž Cof wrote: > > > > I recompiled it, add reference to System.Data.SQlite and > > System.Data.SQLite.Linq to my project and run. I get: The type > > initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. > > I try to add SQLite.Interop.Static.2010 SQLITE_DEFAULT_FOREIGN_KEYS > > in preprocessor definitions, still same problem. > > > > Without knowing what the thrown exception actually was, it's a bit hard to > diagnose your issue. However, to further the discussion, I'm going to just > assume it was either DllNotFoundException or BadImageFormatException. > > When using the System.Data.SQLite assemblies, it is very important to > understand where the native SQLite code will be loaded from (i.e. normally > the "SQLite.Interop.dll" file). Also, the processor architecture for the > native > SQLite code [assembly] must match that of the machine running the code > (unless the application executable has been flagged as "32-bit only", which > is quite rare). > > The "SQLite.Interop.dll" file must be located in the application binary > directory > or along the PATH and the processor architecture must be appropriate for > the > application process. > > -- > Joe Mistachkin > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Compiling with VS 2010 (force foreign key constraints)
I am trying something, and i am confused as far as i can be. I only want that SQlite would enforce foreign key constraint by default. I don't want to use PRAGMA foreign_keys every time i mada a connection. After searching on net, i found that i can compile with SQLITE_DEFAULT_FOREIGN_KEYS. I downloaded full source from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki. I recompiled it, add reference to System.Data.SQlite and System.Data.SQLite.Linq to my project and run. I get: The type initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. I try to add SQLite.Interop.Static.2010 SQLITE_DEFAULT_FOREIGN_KEYS in preprocessor definitions, still same problem. I can't beleive it that there is not precompiled library with SQLITE_DEFAULT_FOREIGN_KEYS on the download page. I am sure that everyone is using pragma for now. Any help would be appreciated. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users