X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F04_BasicCRUD.pod;h=f19da1ee59fd102bbaa48e227df4aefe4b9dc1b3;hp=7e29687cb8d865d97713fb76b2744b7950b30488;hb=b3876d9eb98d14bd0b30e58c760fa7e4bcd3eaab;hpb=a9a6fb3fc40130d2617274382a2ced4b84ed1d00 diff --git a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod index 7e29687..f19da1e 100644 --- a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod @@ -595,14 +595,14 @@ Edit C and update it to match the following header, and 2) the five lines for the Delete link near the bottom): [% # This is a TT comment. -%] - + [%- # Provide a title -%] [% META title = 'Book List' -%] - + [% # Note That the '-' at the beginning or end of TT code -%] [% # "chomps" the whitespace/newline at that end of the -%] [% # output (use View Source in browser to see the effect) -%] - + [% # Some basic HTML with a loop to display books -%] @@ -787,8 +787,6 @@ cascading delete operation via the DBIC_TRACE output: SELECT me.id, me.title, me.rating FROM book me WHERE ( ( me.id = ? ) ): '6' DELETE FROM book WHERE ( id = ? ): '6' - SELECT me.book_id, me.author_id FROM book_author me WHERE ( me.book_id = ? ): '6' - DELETE FROM book_author WHERE ( author_id = ? AND book_id = ? ): '4', '6' =head2 Fixing a Dangerous URL @@ -897,7 +895,10 @@ query parameter: Although the sample above only shows the C div, leave the rest of the file intact -- the only change we made to the C was to add "C<|| c.request.params.status_msg>" to the -Cspan class="message"E> line. +Cspan class="message"E> line. Note that we definitely want +the "C<| html>" TT filter here since it would be easy for users to +modify the message on the URL and possibly inject harmful code into the +application if we left that off. =head2 Try the Delete and Redirect With Query Param Logic @@ -943,6 +944,15 @@ book was added and when each book is updated: sqlite> .quit $ +Here are the commands without the surrounding sqlite3 prompt and output +in case you want to cut and paste them as a single block (but still +start sqlite3 before you paste these in): + + ALTER TABLE book ADD created TIMESTAMP; + ALTER TABLE book ADD updated TIMESTAMP; + UPDATE book SET created = DATETIME('NOW'), updated = DATETIME('NOW'); + SELECT * FROM book; + This will modify the C table to include the two new fields and populate those fields with the current time. @@ -971,11 +981,11 @@ call to C. However, also notice that the C relationships we manually added below the "C<# DO NOT MODIFY...>" line were automatically preserved. -While we have this file open, let's update it with some additional -information to have DBIC automatically handle the updating of these two -fields for us. Insert the following code at the bottom of the file (it -B be B the "C<# DO NOT MODIFY...>" line and B the -C<1;> on the last line): +While we C open, let's update it with +some additional information to have DBIC automatically handle the +updating of these two fields for us. Insert the following code at the +bottom of the file (it B be B the "C<# DO NOT MODIFY...>" +line and B the C<1;> on the last line): # # Enable automatic date handling
TitleRatingAuthor(s)Links