/ Check-in [10da1361]
Login

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

Overview
Comment:Documentation that should have been checked in along with checkin (614) (CVS 615)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:10da13612583caacc6fefe3a1f24187bfae2ebd7
User & Date: danielk1977 2002-06-11 22:33:47
Context
2002-06-12
22:33
Fix for bug #70: Correct a typo in the documentation. (CVS 616) check-in: 3387d5b6 user: drh tags: trunk
2002-06-11
22:33
Documentation that should have been checked in along with checkin (614) (CVS 615) check-in: 10da1361 user: danielk1977 tags: trunk
02:25
Add RAISE() function, which allows more advanced flow-control in trigger programs (ticket #55) (CVS 614) check-in: d4a2fb10 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to www/lang.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the sqlite.html file.
     3      3   #
     4         -set rcsid {$Id: lang.tcl,v 1.38 2002/06/06 23:30:59 drh Exp $}
            4  +set rcsid {$Id: lang.tcl,v 1.39 2002/06/11 22:33:47 danielk1977 Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>Query Language Understood By SQLite</title>
     9      9   </head>
    10     10   <body bgcolor=white>
    11     11   <h1 align=center>
................................................................................
   451    451     BEGIN
   452    452       UPDATE orders SET address = new.address WHERE customer_name = old.name;
   453    453     END;
   454    454   }
   455    455   puts {
   456    456   <p>With this trigger installed, executing the statement:</p>
   457    457   }
   458         -puts {
   459         -<p>Note that currently, triggers may behave oddly when created on tables
   460         -  with INTEGER PRIMARY KEY fields. If a BEFORE trigger program modifies the 
   461         -  INTEGER PRIMARY KEY field of a row that will be subsequently updated by the
   462         -  statement that causes the trigger to fire, then the update may not occur. 
   463         -  The workaround is to declare the table with a PRIMARY KEY column instead
   464         -  of an INTEGER PRIMARY KEY column.</p>
   465         -}
   466    458   
   467    459   Example {
   468    460   UPDATE customers SET address = '1 Main St.' WHERE name = 'Jack Jones';
   469    461   }
   470    462   puts {
   471    463   <p>causes the following to be automatically executed:</p>
   472    464   }
   473    465   Example {
   474    466   UPDATE orders SET address = '1 Main St.' WHERE customer_name = 'Jack Jones';
   475    467   }
          468  +
          469  +puts {
          470  +<p>Note that currently, triggers may behave oddly when created on tables
          471  +  with INTEGER PRIMARY KEY fields. If a BEFORE trigger program modifies the 
          472  +  INTEGER PRIMARY KEY field of a row that will be subsequently updated by the
          473  +  statement that causes the trigger to fire, then the update may not occur. 
          474  +  The workaround is to declare the table with a PRIMARY KEY column instead
          475  +  of an INTEGER PRIMARY KEY column.</p>
          476  +}
          477  +
          478  +puts {
          479  +<p>A special SQL function RAISE() may be used within a trigger-program, with the following syntax</p> 
          480  +}
          481  +Syntax {raise-function} {
          482  +RAISE ( ABORT, <error-message> ) | 
          483  +RAISE ( FAIL, <error-message> ) | 
          484  +RAISE ( ROLLBACK, <error-message> ) | 
          485  +RAISE ( IGNORE )
          486  +}
          487  +puts {
          488  +<p>When one of the first three forms is called during trigger-program execution, the specified ON CONFLICT processing is performed (either ABORT, FAIL or 
          489  + ROLLBACK) and the current query terminates. An error code of SQLITE_CONSTRAINT is returned to the user, along with the specified error message.</p>
          490  +
          491  +<p>When RAISE(IGNORE) is called, the remainder of the current trigger program,
          492  +the statement that caused the trigger program to execute and any subsequent
          493  +    trigger programs that would of been executed are abandoned. No database
          494  +    changes are rolled back.  If the statement that caused the trigger program
          495  +    to execute is itself part of a trigger program, then that trigger program
          496  +    resumes execution at the beginning of the next step.
          497  +</p>
          498  +}
   476    499   
   477    500   Section {CREATE VIEW} {createview}
   478    501   
   479    502   Syntax {sql-command} {
   480    503   CREATE VIEW <view-name> AS <select-statement>
   481    504   }
   482    505