From: Roy W P. <arc...@mt...> - 2008-04-17 18:45:51
|
These problems that have recently been posted in the list seem to be due to a new version of either DBI DBD-PG perl or postgresql I'm running Version 2.6.27 and everything worked fine on mandriva 2008. I just upgraded to mandriva 2008.1 spring to try solve a DVD burner problem. Now I get the "....Attempt to free unreferenced scalar....." error when printing. I get this error when "posting as new" invoices... DBD::Pg::db do failed: ERROR: syntax error at or near ")" LINE 4: '04-03-2008', NULL, ) ^ at SL/IS.pm line 854. a bit of testing with 2.8 and even with dieter's fix... http://abacus.sql-ledger.com/userforum/forum_entry.php?id=911 i get the bizarre copy of array error as noted in this thread. http://abacus.sql-ledger.com/userforum/forum_entry.php?id=941 previously running postgresql 8.2.6 perl-DBD-pg-1.49 perl-DBI 1.59 now running postgresql 8.2.7 perl-DBD-pg 2.2.2 perl-DBI 1.601 I suspect it's an DBD/DBI issue anyone narrow this down ? ------------------ Roy W Pennington |
From: Roy P <or...@sh...> - 2008-04-18 12:54:39
|
On April 17, 2008 01:45:33 pm Roy W Pennington wrote: > These problems that have recently been posted in the list seem to be due to > a new version of either DBI DBD-PG perl or postgresql > > I'm running Version 2.6.27 and everything worked fine on mandriva 2008. > > I just upgraded to mandriva 2008.1 spring to try solve a DVD burner > problem. > > Now I get the "....Attempt to free unreferenced scalar....." error when > printing. > > I get this error when "posting as new" invoices... > > DBD::Pg::db do failed: ERROR: syntax error at or near ")" > LINE 4: '04-03-2008', NULL, ) > ^ at SL/IS.pm line 854. > > > a bit of testing with 2.8 and even with dieter's fix... > http://abacus.sql-ledger.com/userforum/forum_entry.php?id=911 > > i get the bizarre copy of array error as noted in this thread. > http://abacus.sql-ledger.com/userforum/forum_entry.php?id=941 > > previously running > postgresql 8.2.6 > perl-DBD-pg-1.49 > perl-DBI 1.59 > > now running > postgresql 8.2.7 > perl-DBD-pg 2.2.2 > perl-DBI 1.601 > > I suspect it's an DBD/DBI issue > anyone narrow this down ? > On more investigation... I tested postgresql 8.2.6 and 8.3 with a clean install and still no luck. So it appears this is due to Perl 5.10, DBI 1.601, or DBD-pg 2.2.2. I'll try getting the latest DBI and DBD-pg from cpan to see if that fixes it. Any ideas ? Roy |
From: Wallace R. C. <wrc...@gm...> - 2008-04-18 13:41:56
|
On Thu, Apr 17, 2008 at 11:45 AM, Roy W Pennington <arc...@mt...> wrote: ... > I get this error when "posting as new" invoices... > > DBD::Pg::db do failed: ERROR: syntax error at or near ")" > LINE 4: '04-03-2008', NULL, ) > ^ at SL/IS.pm line 854. The above line is obviously in error -- the last parameter (before the closing parenthesis) is missing. Can you post the code snippet around SL/IS.pm, line 854? That would certainly help. -- Best Regards, Wallace |
From: Roy W P. <arc...@mt...> - 2008-04-18 14:12:04
|
> On Thu, Apr 17, 2008 at 11:45 AM, Roy W Pennington <arc...@mt...> wrote: > ... > > I get this error when "posting as new" invoices... > > > > DBD::Pg::db do failed: ERROR: syntax error at or near ")" > > LINE 4: '04-03-2008', NULL, ) > > ^ at SL/IS.pm line 854. > > The above line is obviously in error -- the last parameter (before the > closing parenthesis) is missing. Can you post the code snippet around > SL/IS.pm, line 854? That would certainly help. > Yup that last parameter is missing. Here's the code. --------------------------- # add lineitems + tax $amount = 0; $grossamount = 0; $fxgrossamount = 0; for (@{ $form->{acc_trans}{lineitems} }) { $amount += $_->{amount}; $grossamount += $_->{grossamount}; $fxgrossamount += $_->{fxgrossamount}; } $invnetamount = $amount; $amount = 0; for (split / /, $form->{taxaccounts}) { $amount += $form->{acc_trans}{$form->{id}}{$_}{amount} = $form->round_amount($form->{acc_trans}{$form->{id}}{$_}{amount}, 2) } $invamount = $invnetamount + $amount; $diff = 0; if ($form->{taxincluded}) { $diff = $form->round_amount($grossamount - $invamount, 2); $invamount += $diff; } $fxdiff = $form->round_amount($fxdiff,2); $invnetamount += $fxdiff; $invamount += $fxdiff; if ($form->round_amount($form->{paid} - $fxgrossamount,2) == 0) { $form->{paid} = $invamount; } else { $form->{paid} = $form->round_amount($form->{paid} * $form->{exchangerate}, 2); } foreach $ref (sort { $b->{amount} <=> $a->{amount} } @ { $form->{acc_trans}{lineitems} }) { $amount = $ref->{amount} + $diff + $fxdiff; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, invoice_id) VALUES ($form->{id}, $ref->{chart_id}, $amount, '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; $dbh->do($query) || $form->dberror($query); $diff = 0; $fxdiff = 0; } $form->{receivables} = $invamount * -1; delete $form->{acc_trans}{lineitems}; ------------------------ But the fact is the code hasn't been changed.... it worked fine until i upgraded my distro and newer versions of DBI, DBD-pg, and perl were installed. Either: 1) the newer perl/dbi/dbd-pg packages (or code) is broken 2) something has changed in rgeards to the DBI/DBD implementation has changed and the old SL code is not compatible. 3) ?? If I roll back the version of perl, perl-DBI, and DBD-pg to the version packaged with Mandriva 2008, the SQL-ledger works fine.. but then most of the perl based gui in mandriva 2008.1 is broken. judging from the previous threads... this is a issue that others have had: http://abacus.sql-ledger.com/userforum/forum_entry.php?id=941 http://abacus.sql-ledger.com/userforum/forum_entry.php?id=910 http://abacus.sql-ledger.com/userforum/forum_entry.php?id=888 Due to the fact that "arblake" had the problem with a different version of perl (from what i have running) and I get the same problem with multiple versions of Postgresql.... I suspect it's DBD-pg or DBI. Regards, Roy |
From: Wallace R. C. <wrc...@gm...> - 2008-04-18 14:28:39
|
On Fri, Apr 18, 2008 at 7:11 AM, Roy W Pennington <arc...@mt...> wrote: ... > $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, > transdate, project_id, invoice_id) > VALUES ($form->{id}, $ref->{chart_id}, $amount, > '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; > $dbh->do($query) || $form->dberror($query); >From the generated error, it appears that the following variables might be undefined: $ref->{project_id}, $ref->{invoice_id} You could place a conditional in the perl code to check those variables & use some kind of default value if they don't exist. -- Best Regards, Wallace |
From: Roy W P. <arc...@mt...> - 2008-04-18 14:42:08
|
On Friday 18 April 2008, Wallace Roberts Consulting wrote: > On Fri, Apr 18, 2008 at 7:11 AM, Roy W Pennington <arc...@mt...> wrote: > ... > > $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, > > transdate, project_id, invoice_id) > > VALUES ($form->{id}, $ref->{chart_id}, $amount, > > '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; > > $dbh->do($query) || $form->dberror($query); > > >From the generated error, it appears that the following variables > might be undefined: > > $ref->{project_id}, $ref->{invoice_id} > > You could place a conditional in the perl code to check those > variables & use some kind of default value if they don't exist. So you're saying that SQL-ledger's official code is broken ? Roy |
From: Wallace R. C. <wrc...@gm...> - 2008-04-18 14:53:42
|
On Fri, Apr 18, 2008 at 7:41 AM, Roy W Pennington <arc...@mt...> wrote: > On Friday 18 April 2008, Wallace Roberts Consulting wrote: > > On Fri, Apr 18, 2008 at 7:11 AM, Roy W Pennington <arc...@mt...> wrote: > > ... > > > $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, > > > transdate, project_id, invoice_id) > > > VALUES ($form->{id}, $ref->{chart_id}, $amount, > > > '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; > > > $dbh->do($query) || $form->dberror($query); > > > > >From the generated error, it appears that the following variables > > might be undefined: > > > > $ref->{project_id}, $ref->{invoice_id} > > > > You could place a conditional in the perl code to check those > > variables & use some kind of default value if they don't exist. > > So you're saying that SQL-ledger's official code is broken ? No. I'm saying that a pathological interaction has cropped up among the new pieces of code, & making a very simple change to the above SQL-Ledger code will ameliorate said pathology. -- Best Regards, Wallace |
From: Roy W P. <arc...@mt...> - 2008-04-18 15:54:30
|
On Friday 18 April 2008, Wallace Roberts Consulting wrote: > On Fri, Apr 18, 2008 at 7:41 AM, Roy W Pennington <arc...@mt...> wrote: > > On Friday 18 April 2008, Wallace Roberts Consulting wrote: > > > On Fri, Apr 18, 2008 at 7:11 AM, Roy W Pennington <arc...@mt...> wrote: > > > ... > > > > $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, > > > > transdate, project_id, invoice_id) > > > > VALUES ($form->{id}, $ref->{chart_id}, $amount, > > > > '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; > > > > $dbh->do($query) || $form->dberror($query); > > > > > > >From the generated error, it appears that the following variables > > > might be undefined: > > > > > > $ref->{project_id}, $ref->{invoice_id} > > > > > > You could place a conditional in the perl code to check those > > > variables & use some kind of default value if they don't exist. > > > > So you're saying that SQL-ledger's official code is broken ? > > No. I'm saying that a pathological interaction has cropped up among > the new pieces of code, & making a very simple change to the above > SQL-Ledger code will ameliorate said pathology. I'm gonna get 1.49 dbd-pg via cpan and see if that helps. Gonna take the easiest route if possible. I'm not a real coder.. just a geek/user. "pathological interaction" brought a smile to my face... Hehe I had the same issue with a girlfriend many many years ago. I had just 'migrated' to a new GF and a "pathological interaction" developed. I found that the legacy version was more compatible and switching would have had an ameliorative effect. unfortunately there was no way to roll back the changes. Cheers ! Roy |