Documentation Source Text

Check-in [72af2c4df1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved documentation for PRAGMA foreign_key_check and foreign_key_list.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 72af2c4df12c9ac1997439a761dd72b75577064a
User & Date: drh 2013-03-19 20:00:00.737
Context
2013-03-22
23:39
Fix a typo. (check-in: 349d556c0a user: drh tags: trunk)
2013-03-19
20:00
Improved documentation for PRAGMA foreign_key_check and foreign_key_list. (check-in: 72af2c4df1 user: drh tags: trunk)
2013-03-18
21:54
Add a mention of the ZIPVFS extension to the Support page. (check-in: c6ec519b53 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/pragma.in.
965
966
967
968
969
970
971
972

973
974
975
976
977

978
979

980
981
982
983
984
985
986
987
988



989
990
991
992
993
994
995
    ^(The third column is the name of the database file itself, or an empty
    string if the database is not associated with a file.)^</p>
}

Pragma foreign_key_list {
    <p>^(<b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p>

    <p>This pragma returns one row for each foreign key that references

    a column in the argument table.)^
}

Pragma foreign_key_check {
    <p><b>^(PRAGMA foreign_key_check;)^</b></p>


    <p>The foreign_key_check pragma checks the database for 

    [foreign key constraints] that are violated and returns one row of
    output for each violation.  There are four columns in each result row.
    The first column is the name of the table that contains the REFERENCES
    clause.  The second column is the [rowid] of the row that
    contains the invalid REFERENCES clause.  The third column is the name
    of the table that is referred to. The fourth column is the index of
    the specific foreign key constraint that failed.  The fourth column
    in the output of the foreign_key_check pragma is the same integer as
    the first column in the output of the [foreign_key_list pragma].</p>



}

Pragma freelist_count {
    <p>^(<b>PRAGMA freelist_count;</b></p>
    <p>Return the number of unused pages in the database file.)^</p>
}








|
>
|



|
>

|
>








|
>
>
>







965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
    ^(The third column is the name of the database file itself, or an empty
    string if the database is not associated with a file.)^</p>
}

Pragma foreign_key_list {
    <p>^(<b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p>

    <p>This pragma returns one row for each [foreign key constraint]
    created by a REFERENCES clause in the CREATE TABLE statement of
    table "<i>table-name</i>".)^
}

Pragma foreign_key_check {
    <p>^(<b>PRAGMA foreign_key_check;
        <br>PRAGMA foreign_key_check(</b><i>table-name</i><b>);</b>)^</b></p>

    <p>The foreign_key_check pragma checks the database, or the table
    called "<i>table-name</i>", for 
    [foreign key constraints] that are violated and returns one row of
    output for each violation.  There are four columns in each result row.
    The first column is the name of the table that contains the REFERENCES
    clause.  The second column is the [rowid] of the row that
    contains the invalid REFERENCES clause.  The third column is the name
    of the table that is referred to. The fourth column is the index of
    the specific foreign key constraint that failed.  The fourth column
    in the output of the foreign_key_check pragma is the same integer as
    the first column in the output of the [foreign_key_list pragma].
    When a "<i>table-name</i>" is specified, the only foreign key constraints
    checked are those created by REFERENCES clauses in the
    CREATE TABLE statement for <i>table-name</i>.</p>
}

Pragma freelist_count {
    <p>^(<b>PRAGMA freelist_count;</b></p>
    <p>Return the number of unused pages in the database file.)^</p>
}