peterhuene / sqlite-net-wp8

A C++/CX wrapper for SQLite functions that sqlite-net depends on. Can be used as an alternative to csharp-sqlite on Windows Phone 8. This library is released under the MIT license.
MIT License
74 stars 65 forks source link

Foreign Keys & "ON DELETE CASCADE" #22

Closed termvader closed 11 years ago

termvader commented 11 years ago

I wanted to know if Foreign Keys & "ON DELETE CASCADE" functionality is available. http://sqlite.org/foreignkeys.html

I see commits related to updating to SQLite 3.8 so I think that it would be available. Just wanted to confirm though. Wanted to know if the error is in my code.

Just to give some reference. I am doing "DELETE FROM tablename" without any "WHERE" property and have tables referencing the primary key column of this table but the other tables retain their rows. And I have done the following: dbConn.Execute("PRAGMA foreign_keys=ON");

peterhuene commented 11 years ago

The functionality should be present in SQLite, but nothing related to foreign key support is implemented in sqlite-net, as far as I know

termvader commented 11 years ago

Yup its working. It was my mistake, was creating the tables and then was calling PRAGMA foreign_keys=ON

/* BTW on second thought was thinking of forking https://github.com/peterhuene/sqlite-net and trying to add Foreign Key support so that one can use it directly like db.CreateTable<Stock>(); Will have to see how to give reference to property of another class */

peterhuene commented 11 years ago

If you intend to add functionality to sqlite-net, please do so from the "official" fork at https://github.com/praeclarum/sqlite-net. My fork only exists to allow it to build when using it for WP8. I will pull from upstream when it makes sense to do so, but as soon as a pull request to fix the "official" fork for building against WP8 is accepted, I plan on deleting my fork. Thanks.