direction in dataObjects->orderBy()

From: Date: Thu, 13 Feb 2003 13:33:01 +0000
Subject: direction in dataObjects->orderBy()
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3740@lists.php.net to get a copy of this message
Hy everybody! I'm currently working with dataObjects and there is no possibility to define the direction of the order-statement. So I decided to patch the orderBy-function and the find-function to fit my needs. So that my current version looks like this: ########## ..... var _order_direction = ""; ..... function orderBy( $order = false,$direction = '' ) { // perhaps it can also be set to DESC on default $this -> _order_direction = $direction; if ( $order == false ) { $this -> _order_by = ''; return; } if ( !$this -> _order_by ) { $this -> _order_by = " ORDER BY {$order} "; return; } $this -> _order_by .= " , {$order}"; } ..... function find( $n = false ) { ####snip##### $this -> _query( "SELECT " . $this -> _data_select . " FROM " . $this -> __table . " " . $this -> _join . $this -> _condition . " " . $this -> _group_by . " " . $this -> _order_by . $this -> _order_direction . " " . $this -> _limit ); // I just added $this -> _order_direction after $this -> _order_by ####snap##### } ################## Is this a practicable way? Till Dawn

« previous php.pear.general (#3740) next »