[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4542] branches/1.3



Revision: 4542
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4542&view=rev
Author:   einhverfr
Date:     2012-03-24 07:31:08 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
Correcting handling of unknown types of databases

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Database.pm

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-03-24 07:08:38 UTC (rev 4541)
+++ branches/1.3/Changelog	2012-03-24 07:31:08 UTC (rev 4542)
@@ -17,6 +17,7 @@
 * Experimental support for migrating from SQL-Ledger via Setup.pl (Chris T)
 * Fixed POD issues with lsmb-request.pl (h/t Robert C) (Chris T item 3472648)
 * Fixed means of adding parts/editing pricelist missing (Chris T, bug 3442163)
+* Fixed unknown db detected as SQL-Ledger (Chris T, bug 3510039)
 
 Andres B is Andres Basile
 

Modified: branches/1.3/LedgerSMB/Database.pm
===================================================================
--- branches/1.3/LedgerSMB/Database.pm	2012-03-24 07:08:38 UTC (rev 4541)
+++ branches/1.3/LedgerSMB/Database.pm	2012-03-24 07:31:08 UTC (rev 4542)
@@ -310,7 +310,7 @@
        my $rv=$sth->execute();     
        if(defined($rv))
        {
-        if (my ($ref) = $sth->fetchrow_hashref('NAME_lc')){
+        if (my $ref = $sth->fetchrow_hashref('NAME_lc')){
            if ($ref->{version}){
                $retval->{appname} = 'ledgersmb';
                $retval->{version} = 'legacy';
@@ -323,7 +323,7 @@
        # LedgerSMB 1.2 and above
        $sth = $dbh->prepare('SELECT value FROM defaults WHERE setting_key = ?');
        $sth->execute('version');
-       if (my ($ref) = $sth->fetchrow_hashref('NAME_lc')){
+       if (my $ref = $sth->fetchrow_hashref('NAME_lc')){
            $retval->{full_version} = $ref->{value};
            $retval->{appname} = 'ledgersmb';
            if ($ref->{value} eq '1.2.0') {
@@ -341,12 +341,15 @@
        # SQL-Ledger 2.7-2.8 (fldname, fldvalue)
        $sth = $dbh->prepare('SELECT fldvalue FROM defaults WHERE fldname = ?');
        $sth->execute('version');
-       if (my ($ref) = $sth->fetchrow_hashref('NAME_lc')){
+       if (my $ref = $sth->fetchrow_hashref('NAME_lc')){
             $retval->{appname} = 'sql-ledger';
             $retval->{full_version} = $ref->{fldname};
             $retval->{version} = $ref->{fldname};
             $retval->{version} =~ s/(\d+\.\d+).*/$1/g;
-       }
+       } else {
+            $retval->{appname} = 'unknown';
+            $retval->{exists} = 'exists';
+       } 
        $dbh->rollback;
    }
    #$logger->debug("DBI->disconnect dbh=$dbh");

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.