[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1172] trunk
- Subject: SF.net SVN: ledger-smb: [1172] trunk
- From: ..hidden..
- Date: Tue, 08 May 2007 09:06:22 -0700
Revision: 1172
http://svn.sourceforge.net/ledger-smb/?rev=1172&view=rev
Author: einhverfr
Date: 2007-05-08 09:06:22 -0700 (Tue, 08 May 2007)
Log Message:
-----------
Added stored procedure collation handling stub
Modified Paths:
--------------
trunk/LedgerSMB/DBObject.pm
trunk/LedgerSMB.pm
Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm 2007-05-08 15:38:43 UTC (rev 1171)
+++ trunk/LedgerSMB/DBObject.pm 2007-05-08 16:06:22 UTC (rev 1172)
@@ -47,7 +47,8 @@
$type =~ m/::(.*?)$/;
$type = lc $1;
print "Type: $type\n";
- $self->exec_method( procname => "$type" . "_" . $AUTOLOAD, args => ..hidden.. );
+ $self->exec_method( procname => "$type" . "_" . $AUTOLOAD, args => ..hidden..
+ order_by => $order_by);
}
sub new {
@@ -64,8 +65,19 @@
$self;
}
+sub set_ordering {
+ my $self = shift @_;
+ my %args = @_;
+
+ if (not defined $self->{_order_method}){
+ $self->{_order_method} = {};
+ }
+
+ $self->{_order_method}->{$args{method}} = $args{column};
+}
+
sub exec_method {
- my ($self) = shift @_;
+ my $self = shift @_;
my %args = @_;
my $funcname = $args{funcname};
my @in_args = @{ $args{args} };
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2007-05-08 15:38:43 UTC (rev 1171)
+++ trunk/LedgerSMB.pm 2007-05-08 16:06:22 UTC (rev 1172)
@@ -424,6 +424,7 @@
my %args = @_;
my $procname = $args{procname};
my @args = @{ $args{args} };
+ my $order_by = $args{order_by};
my $argstr = "";
my @results;
for ( 1 .. scalar @args ) {
@@ -431,6 +432,9 @@
}
$argstr =~ s/\, $//;
my $query = "SELECT * FROM $procname()";
+ if ($order_by){
+ $query .= " ORDER BY $order_by";
+ }
$query =~ s/\(\)/($argstr)/;
my $sth = $self->{dbh}->prepare($query);
$sth->execute(@args);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.