What version of SQLite is starting to support foreign keys (Foreign key)

Source: Internet
Author: User

http://androidren.com/index.php?qa=298&qa_1=sqlite%E4%BB%8E%E4%BB%80%E4%B9%88%E7%89%88%E6%9C%AC%E5%BC%80% E5%a7%8b%e6%94%af%e6%8c%81%e5%a4%96%e9%94%ae-foreign-key

FOREIGN KEY constraints are supported starting from SQLite 3.6.19.

Reference:

Http://sqlite.org/foreignkeys.html

foreign key constraints is disabled by Default (for backwards compatibility), so must is enabled separately for each database connection. (Note, however, that the future releases of the SQLite might change so, foreign KEY constraints enabled by default.) Careful developers won't make any assumptions about whether or not foreign keys is enabled by default but would instead Enable or disable them as necessary.) The application can also use A pragma foreign_keys statement to determine if foreign keys is currently enabled. The following command-line session demonstrates this:

sqlite> PRAGMA foreign_keys;0sqlite> PRAGMA foreign_keys = on;sqlite> PRAGMA foreign_keys;1sqlite> PRAGMA Foreign_keys = off;sqlite> PRAGMA foreign_keys;0

Tip:if the command "PRAGMA foreign_keys" returns no data instead of a single row containing "0" or "1" and then the version of SQLite you were using does not foreign keys (either because it's older than 3.6.19 or because it was compiled W ith Sqlite_omit_foreign_key or sqlite_omit_triggerdefined).

It is not possible to enable or disable foreign key constraints in the middle of a multi-statement transaction (when Sqlit E is not in autocommit mode). Attempting to does so does not return an error; It simply has no effect.


What version of SQLite is starting to support foreign keys (Foreign key)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.