root

Changeset 348

Show
Ignore:
Timestamp:
10/30/08 01:43:41 (2 years ago)
Author:
wbond
Message:

BackwardsCompatibilityBreak - fNoResultsException? was renamed to fNoRowsException, fResult::tossIfNoResults() was renamed to fRequest::tossIfNoRows(), fUnbufferedResult::tossIfNoResults() was renamed to fUnbufferedResult::tossIfNoRows(), fResult::getAffectedRows() was renamed to fResult::countAffectedRows() and fResult::getReturnedRows() was renamed to fRequest::countReturnedRows()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fActiveRecord.php

    r334 r348 Hide Line Numbers
    934934         
    935935            $result = fORMDatabase::retrieve()->translatedQuery($sql); 
    936             $result->tossIfNoResults(); 
     936            $result->tossIfNoRows(); 
    937937             
    938938        } catch (fExpectedException $e) { 
  • fNoRowsException.php

    • Property svn:mergeinfo set
    r214 r348 Hide Line Numbers
    11<?php 
    22/** 
    3  * An exception when no results are returned 
     3 * An exception when no rows are returned from a SQL query 
    44 *  
    55 * @copyright  Copyright (c) 2007-2008 William Bond 
     
    88 *  
    99 * @package    Flourish 
    10  * @link       http://flourishlib.com/fNoResultsException 
     10 * @link       http://flourishlib.com/fNoRowsException 
    1111 *  
    1212 * @version    1.0.0b 
    1313 * @changes    1.0.0b  The initial implementation [wb, 2007-06-14] 
    1414 */ 
    15 class fNoResultsException extends fExpectedException 
     15class fNoRowsException extends fExpectedException 
    1616{ 
    1717} 
  • fORMColumn.php

    r331 r348 Hide Line Numbers
    649649                        $sql = "SELECT " . $column . " FROM " . $table . " WHERE " . $column . " = " . fORMDatabase::retrieve()->escape('string', $value); 
    650650                     
    651                     } while (fORMDatabase::retrieve()->query($sql)->getReturnedRows()); 
     651                    } while (fORMDatabase::retrieve()->query($sql)->countReturnedRows()); 
    652652                } 
    653653            } 
  • fORMRelated.php

    r316 r348 Hide Line Numbers
    172172            $result = fORMDatabase::retrieve()->translatedQuery($sql); 
    173173             
    174             $count = ($result->getReturnedRows()) ? (int) $result->fetchScalar() : 0; 
     174            $count = ($result->valid()) ? (int) $result->fetchScalar() : 0; 
    175175        } 
    176176         
  • fORMValidation.php

    r332 r348 Hide Line Numbers
    398398                     
    399399                    $result = fORMDatabase::retrieve()->translatedQuery($sql); 
    400                     $result->tossIfNoResults(); 
    401                 } catch (fNoResultsException $e) { 
     400                    $result->tossIfNoRows(); 
     401                } catch (fNoRowsException $e) { 
    402402                    return fGrammar::compose( 
    403403                        '%s: The value specified is invalid', 
     
    534534             
    535535            $result = fORMDatabase::retrieve()->translatedQuery($sql); 
    536             $result->tossIfNoResults(); 
     536            $result->tossIfNoRows(); 
    537537             
    538538            return fGrammar::compose( 
     
    542542            ); 
    543543             
    544         } catch (fNoResultsException $e) { } 
     544        } catch (fNoRowsException $e) { } 
    545545    } 
    546546     
     
    622622                try { 
    623623                    $result = fORMDatabase::retrieve()->translatedQuery($sql); 
    624                     $result->tossIfNoResults(); 
     624                    $result->tossIfNoRows(); 
    625625                 
    626626                    // If an exception was not throw, we have existing values 
     
    641641                    } 
    642642                 
    643                 } catch (fNoResultsException $e) { } 
     643                } catch (fNoRowsException $e) { } 
    644644            } 
    645645        } 
  • fResult.php

    r347 r348 Hide Line Numbers
    226226     
    227227    /** 
     228     * Returns the number of rows affected by the query 
     229     *  
     230     * @return integer  The number of rows affected by the query 
     231     */ 
     232    public function countAffectedRows() 
     233    { 
     234        return $this->affected_rows; 
     235    } 
     236     
     237     
     238    /** 
     239     * Returns the number of rows returned by the query 
     240     *  
     241     * @return integer  The number of rows returned by the query 
     242     */ 
     243    public function countReturnedRows() 
     244    { 
     245        return $this->returned_rows; 
     246    } 
     247     
     248     
     249    /** 
    228250     * Returns the current row in the result set (required by iterator interface) 
    229251     *  
    230      * @throws fNoResultsException 
     252     * @throws fNoRowsException 
    231253     * @throws fNoRemainingException 
    232254     * @internal 
     
    238260        if(!$this->returned_rows) { 
    239261            fCore::toss( 
    240                 'fNoResultsException', 
     262                'fNoRowsException', 
    241263                fGrammar::compose('The query did not return any rows') 
    242264            ); 
     
    309331     * Returns the row next row in the result set (where the pointer is currently assigned to) 
    310332     *  
    311      * @throws fNoResultsException 
     333     * @throws fNoRowsException 
    312334     * @throws fNoRemainingException 
    313335     *  
     
    325347     * Wraps around ::fetchRow() and returns the first field from the row instead of the whole row 
    326348     *  
    327      * @throws fNoResultsException 
     349     * @throws fNoRowsException 
    328350     * @throws fNoRemainingException 
    329351     *  
     
    404426     
    405427    /** 
    406      * Returns the number of rows affected by the query 
    407      *  
    408      * @return integer  The number of rows affected by the query 
    409      */ 
    410     public function getAffectedRows() 
    411     { 
    412         return $this->affected_rows; 
    413     } 
    414      
    415      
    416     /** 
    417428     * Returns the last auto incremented value for this database connection. This may or may not be from the current query. 
    418429     *  
     
    439450     
    440451    /** 
    441      * Returns the number of rows returned by the query 
    442      *  
    443      * @return integer  The number of rows returned by the query 
    444      */ 
    445     public function getReturnedRows() 
    446     { 
    447         return $this->returned_rows; 
    448     } 
    449      
    450      
    451     /** 
    452452     * Returns the SQL used in the query 
    453453     *  
     
    474474     * Returns the current row number (required by iterator interface) 
    475475     *  
    476      * @throws fNoResultsException 
     476     * @throws fNoRowsException 
    477477     * @internal 
    478478     *  
     
    492492     * Advances to the next row in the result (required by iterator interface) 
    493493     *  
    494      * @throws fNoResultsException 
     494     * @throws fNoRowsException 
    495495     * @internal 
    496496     *  
     
    531531     * Seeks to the specified zero-based row for the specified SQL query 
    532532     *  
    533      * @throws fNoResultsException 
     533     * @throws fNoRowsException 
    534534     *  
    535535     * @param  integer $row  The row number to seek to (zero-based) 
     
    540540        if(!$this->returned_rows) { 
    541541            fCore::toss( 
    542                 'fNoResultsException', 
     542                'fNoRowsException', 
    543543                fGrammar::compose('The query did not return any rows') 
    544544            ); 
     
    673673     * Throws an fNoResultException if the query did not return any rows 
    674674     *  
    675      * @throws fNoResultsException 
     675     * @throws fNoRowsException 
    676676     *  
    677677     * @param  string $message  The message to use for the exception if there are no rows in this result set 
    678678     * @return void 
    679679     */ 
    680     public function tossIfNoResults($message=NULL) 
     680    public function tossIfNoRows($message=NULL) 
    681681    { 
    682682        if (!$this->returned_rows && !$this->affected_rows) { 
     
    684684                $message = fGrammar::compose('No rows were returned or affected by the query');  
    685685            } 
    686             fCore::toss('fNoResultsException', $message); 
     686            fCore::toss('fNoRowsException', $message); 
    687687        } 
    688688    } 
  • fSchema.php

    r339 r348 Hide Line Numbers
    543543            $row        = $result->fetchRow(); 
    544544            $create_sql = $row['Create Table']; 
    545         } catch (fNoResultsException $e) { 
     545        } catch (fNoRowsException $e) { 
    546546            return array();          
    547547        } 
     
    10141014            $row        = $result->fetchRow(); 
    10151015            $create_sql = $row['sql']; 
    1016         } catch (fNoResultsException $e) { 
     1016        } catch (fNoRowsException $e) { 
    10171017            return array();          
    10181018        } 
  • fUnbufferedResult.php

    r347 r348 Hide Line Numbers
    218218     * Returns the current row in the result set (required by iterator interface) 
    219219     *  
    220      * @throws fNoResultsException 
     220     * @throws fNoRowsException 
    221221     * @throws fNoRemainingException 
    222222     * @internal 
     
    234234        if(!$this->current_row && $this->pointer == 0) { 
    235235            fCore::toss( 
    236                 'fNoResultsException', 
     236                'fNoRowsException', 
    237237                fGrammar::compose('The query did not return any rows') 
    238238            ); 
     
    281281     * Returns the row next row in the result set (where the pointer is currently assigned to) 
    282282     *  
    283      * @throws fNoResultsException 
     283     * @throws fNoRowsException 
    284284     * @throws fNoRemainingException 
    285285     *  
     
    398398     * Returns the current row number (required by iterator interface) 
    399399     *  
    400      * @throws fNoResultsException 
     400     * @throws fNoRowsException 
    401401     * @internal 
    402402     *  
     
    416416     * Advances to the next row in the result (required by iterator interface) 
    417417     *  
    418      * @throws fNoResultsException 
     418     * @throws fNoRowsException 
    419419     * @internal 
    420420     *  
     
    497497     * Throws an fNoResultException if the query did not return any rows 
    498498     *  
    499      * @throws fNoResultsException 
     499     * @throws fNoRowsException 
    500500     *  
    501501     * @param  string $message  The message to use for the exception if there are no rows in this result set 
    502502     * @return void 
    503503     */ 
    504     public function tossIfNoResults($message=NULL) 
     504    public function tossIfNoRows($message=NULL) 
    505505    { 
    506506        try { 
    507507            $this->current(); 
    508         } catch (fNoResultsException $e) { 
     508        } catch (fNoRowsException $e) { 
    509509            if ($message !== NULL) { 
    510510                $e->getMessage($message);