marscld has asked for the wisdom of the Perl Monks concerning the following question:
However, after accessing URL "http://localhost:3000/books/url_create/TCPIP_Illustrated_Vol-2/5/4", error shows up as :sub url_create : Local { # In addition to self & context, get the title, rating, & # author_id args from the URL. Note that Catalyst automatical +ly # puts extra information after the "/<controller_name>/<action +_name/" # into @_ my ($self, $c, $title, $rating, $author_id) = @_; # Call create() on the book model object. Pass the table # columns/field values we want to set as hash values my $book = $c->model('DB::Books')->create({ title => $title, rating => $rating }); # Add a record to the join table for this book, mapping to # appropriate author $book->add_to_book_authors({author_id => $author_id}); # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_ +id}); # Assign the Book object to the stash for display in the view $c->stash->{book} = $book; # This is a hack to disable XSUB processing in Data::Dumper # (it's used in the view). This is a work-around for a bug in # the interaction of some versions or Perl, Data::Dumper & DBI +C. # You won't need this if you aren't using Data::Dumper (or if # you are running DBIC 0.06001 or greater), but adding it does +n't # hurt anything either. $Data::Dumper::Useperl = 1; # Set the TT template to use $c->stash->{template} = 'books/create_done.tt2'; }
INSERT INTO books (rating, title) VALUES (?, ?): '5', 'TCPIP_Illustrat +ed_Vol-2' SELECT COUNT( * ) FROM books me: SELECT COUNT( * ) FROM books me: [info] *** Request 1 (0.038/s) [5225] [Thu Aug 14 15:29:27 2008] *** [debug] "GET" request for "books/url_create/TCPIP_Illustrated_Vol-2/5/ +4" from "202.38.40.128" [debug] Path is "books/url_create" [debug] Arguments are "TCPIP_Illustrated_Vol-2/5/4" [error] DBI Exception: DBD::Oracle::st execute failed: ORA-01400: cann +ot insert NULL into ("SDB2"."BOOKS"."ID") (DBD ERROR: OCIStmtExecute) + [for Statement "INSERT INTO books (rating, title) VALUES (?, ?)" wit +h ParamValues: :p1='5', :p2='TCPIP_Illustrated_Vol-2'] at /usr/local/ +lib/perl5/site_perl/5.10.0/DBIx/Class/Schema.pm line 954
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error while using Catalyst to insert record to Oracle
by psini (Deacon) on Aug 14, 2008 at 10:07 UTC | |
by marscld (Beadle) on Aug 15, 2008 at 01:53 UTC | |
by igelkott (Priest) on Aug 17, 2008 at 18:24 UTC | |
by marscld (Beadle) on Aug 15, 2008 at 01:40 UTC | |
|
Re: Error while using Catalyst to insert record to Oracle
by phaylon (Curate) on Aug 19, 2008 at 11:40 UTC |