Reputation: 3966
I know WebSQL itself is technically not supported anymore, but it seems a lot of people still use it (as I need to). However, I can't seem to find a definitive answer to the Foreign Key question. I found this reference to the fact that it isn't permitted, but that answer is almost 3 years old (as of this writing). I have also seen other people discussing their use of foreign keys with webSQL, such as here (though they indicate some browsers don't support the work around).
So, does WebSQL permit the use of Foreign Keys? Is it a simple "yes" or "no" or is it more complicated?
Upvotes: 0
Views: 894
Reputation: 477
All you need to confirm that is to actually open a DB connection and create tables however you want and run SQLs that fits your requirements.
Here is how you can do it with just a single line of code and then just SQLs:
Create a test.html file and places just this content in that file:
<script>
var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
</script>
Open this file in chrome(double click/drop it on chrome) and then press F12, this will open up Chrome debugger.
Go to "Resources Tab" and then select WebSQL->mydb on left hand pane, This will give you a prompt to write any SQL query. create table, insert values or any SQL that sqllite support:
http://www.sqlite.org/lang_createtable.html
Upvotes: 1