lee_crites has asked for the wisdom of the Perl Monks concerning the following question:
I have written an number of Dancer/Dancer2 applications, and really like using this framework. This time I decided to try out the Danver2::Plugin::Database. It certainly has made some things significantly easier, so I'm basically happy with the decision. But the problem I have is when there is an error, I have no idea what the error is. I'm doing a quick_select on a (SQLite) table that worked before. I made changes to the table structure and such, and now when I try to do the quick_select, it returns an error -- but I cannot figure out what the error is.
This same database connection will do the quick_insert, so I'm pretty sure it isn't a database missing or database corrupt or whatever. So I'm lost.
The (fairly limited) documentation states it is a subclass of DBI, so I tried using the ->err and ->errstr methods, neither one worked. The actual code I am using to get the info is:
my $delstatus = 'checking for: [' . $data->{'host_name'} . '][' . $data->{'service_description'} . '] for last output + entry.'; my @last_records = database('current')->quick_select('states', { host_name => $data->{'host_name'}, name => $data->{'service_description'} }, { order_by => { desc => 'id' } } ) or $delstatus .= '/error from quick_select call;' . ' ERR [' . database('current')->err . '];' . ' ERRSTR [' . database('current')->errstr . ']'; $delstatus .= '/found [' . (scalar @last_records) . '] to dele +te'; debug("QUICK SELECT STATUS: --=> $delstatus <=--");
And a sample response I am getting is:
Use of uninitialized value in concatenation (.) or string at /home/svc +anagios/n2s/bin/../lib/NagiosToServiceNow/json.pm line 699. Use of uninitialized value in concatenation (.) or string at /home/svc +anagios/n2s/bin/../lib/NagiosToServiceNow/json.pm line 699.[NagiosToS +erviceNow::json:51461] debug @2018-09-22 15:41:00> QUICK SELECT STATU +S: --=> checking for: [targethostname][targetchecktext] for last outp +ut entry./error from quick_select call; ERR []; ERRSTR []/found [0] t +o delete <=-- in /home/svcanagios/n2s/bin/../lib/NagiosToServiceNow/j +son.pm l. 709
So I know the two calls are not right. But also, a select from the command line for this particular check showed a count of 11 items. This pass made it 12 (the write is right after this block).
I cannot imagine this module has been around this long with nobody else needing to get the error message(s) from the database, so I am certain it is there and avaiable; I'm just not finding it documented anywhere.
So if you have the answer, I'll promise to pass good vibes about you into the universe for at least the next month... :D
David Lee Crites
lee@critesclan.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dancer2::Plugin::Database and database errors
by 1nickt (Canon) on Sep 23, 2018 at 02:06 UTC | |
by lee_crites (Scribe) on Sep 23, 2018 at 03:19 UTC | |
by 1nickt (Canon) on Sep 23, 2018 at 12:46 UTC | |
by 1nickt (Canon) on Sep 23, 2018 at 13:08 UTC | |
by lee_crites (Scribe) on Sep 23, 2018 at 03:47 UTC | |
by lee_crites (Scribe) on Sep 23, 2018 at 05:57 UTC | |
|
Re: Dancer2::Plugin::Database and database errors (hook database_error)
by 1nickt (Canon) on Sep 23, 2018 at 13:19 UTC | |
by lee_crites (Scribe) on Sep 24, 2018 at 04:25 UTC | |
|
Re: Dancer2::Plugin::Database and database errors
by lee_crites (Scribe) on Sep 22, 2018 at 23:46 UTC |