| 1 | package CGI::Application::Demo::Basic::Util::LogDispatchDBI; | ||
| 2 | |||
| 3 | # Note: | ||
| 4 | # o tab = 4 spaces || die | ||
| 5 | # | ||
| 6 | # Author: | ||
| 7 | # Ron Savage <ron@savage.net.au> | ||
| 8 | # Home page: http://savage.net.au/index.html | ||
| 9 | |||
| 10 | use base qw/Log::Dispatch::DBI CGI::Application::Demo::Basic::Base/; | ||
| 11 | use strict; | ||
| 12 | use warnings; | ||
| 13 | |||
| 14 | our $VERSION = '1.06'; | ||
| 15 | |||
| 16 | # -------------------------------------------------- | ||
| 17 | |||
| 18 | sub create_statement | ||
| 19 | { | ||
| 20 | my($self) = @_; | ||
| 21 | my($sql) = $self -> db_vendor eq 'ORACLE' | ||
| 22 | ? "insert into $$self{'table'} (id, lvl, message, timestamp) values (log_seq.nextval, ?, ?, localtimestamp)" | ||
| 23 | : $self -> db_vendor eq 'SQLITE' | ||
| 24 | ? "insert into $$self{'table'} (lvl, message, timestamp) values (?, ?, 'now')" | ||
| 25 | : "insert into $$self{'table'} (lvl, message, timestamp) values (?, ?, now() )"; # MySQL, Postgres. | ||
| 26 | |||
| 27 | return $$self{'dbh'} -> prepare($sql); | ||
| 28 | |||
| 29 | } # End of create_statement. | ||
| 30 | |||
| 31 | # -------------------------------------------------- | ||
| 32 | |||
| 33 | 1; |