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

SF.net SVN: ledger-smb:[3156] trunk



Revision: 3156
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3156&view=rev
Author:   einhverfr
Date:     2011-05-22 20:19:44 +0000 (Sun, 22 May 2011)

Log Message:
-----------
Correcting unexpected behavior in setting_get for easier readability of code, must drop setting_get(varchar) and re-apply sql/modules/Settings.sql for it to take effect.

Modified Paths:
--------------
    trunk/LedgerSMB/Setting.pm
    trunk/sql/modules/Settings.sql

Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm	2011-05-22 19:55:13 UTC (rev 3155)
+++ trunk/LedgerSMB/Setting.pm	2011-05-22 20:19:44 UTC (rev 3156)
@@ -57,7 +57,7 @@
         $self->{key} = $key;
     }
     my ($hashref) = $self->exec_method( funcname => 'setting_get' ) ;
-    $self->{value} = $hashref->{setting_get};
+    $self->{value} = $hashref->{setting_key};
     return $self->{value};
 }
 

Modified: trunk/sql/modules/Settings.sql
===================================================================
--- trunk/sql/modules/Settings.sql	2011-05-22 19:55:13 UTC (rev 3155)
+++ trunk/sql/modules/Settings.sql	2011-05-22 20:19:44 UTC (rev 3156)
@@ -9,15 +9,10 @@
 END;
 $$ language plpgsql;
 
-CREATE OR REPLACE FUNCTION setting_get (in_key varchar) RETURNS varchar AS
+CREATE OR REPLACE FUNCTION setting_get (in_key varchar) RETURNS defaults AS
 $$
-DECLARE
-	out_value varchar;
-BEGIN
-	SELECT value INTO out_value FROM defaults WHERE setting_key = in_key;
-	RETURN out_value;
-END;
-$$ LANGUAGE plpgsql;
+SELECT * FROM defaults WHERE setting_key = $1;
+$$ LANGUAGE sql;
 
 CREATE OR REPLACE FUNCTION setting_get_default_accounts () 
 RETURNS SETOF defaults AS


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