2 ms·
Quick guide to the code (see https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.3/LedgerSMB/DBObject.pm https://ledger-smb.svn.sourceforge.net
by einhverfr 14y ago
Quick guide to the code (see https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.3/LedgerSMB/DBObject.pm https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/br... and https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.3/LedgerSMB.pm https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/br...).
The typical call goes something like this:
$object->execute_method({funcname => 'my_stored_procedure'});
This calls execute_method in DBObject.pm
The primary magic happens between lines 112 and 170 which is where we look up the argument names and process them. Then this gets handed off to LedgerSMB.pm's "call_procedure" interface which builds the query and executes it.
It isn't great code and there is room for improvement. It will be improved over coming versions. The 1.4 codebase is moving to use Moose for newer code (all code by 2.0), and the combination of Moose and this approach to method mapping is proving quite useful.
I am also working on a more ambitious library for doing this query sort of thing which will add the possibility to add windows and windowed columns onto stored procedure calls at mapping time, so you can ask for a GL running balance while specifying ordering.... That probably won't be ready for 1.4 though.