root

Changeset 483

Show
Ignore:
Timestamp:
01/14/09 12:49:55 (1 year ago)
Author:
wbond
Message:

Added a few error suppression operators back to fDatabase so that developers don't get errors and exceptions when a SQL query fails

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fDatabase.php

    r448 r483 Hide Line Numbers
    3333 *   - [http://php.net/sqlite sqlite] (for v2.x) 
    3434 *  
    35  * @copyright  Copyright (c) 2007-2008 Will Bond 
     35 * @copyright  Copyright (c) 2007-2009 Will Bond 
    3636 * @author     Will Bond [wb] <will@flourishlib.com> 
    3737 * @license    http://flourishlib.com/license 
     
    4040 * @link       http://flourishlib.com/fDatabase 
    4141 *  
    42  * @version    1.0.0b3 
     42 * @version    1.0.0b4 
     43 * @changes    1.0.0b4  Added a few error suppression operators back in so that developers don't get errors and exceptions [wb, 2009-01-14] 
    4344 * @changes    1.0.0b3  Removed some unnecessary error suppresion operators [wb, 2008-12-11] 
    4445 * @changes    1.0.0b2  Fixed a bug with PostgreSQL when using the PDO extension and executing an INSERT statement [wb, 2008-12-11] 
     
    10441045    { 
    10451046        if ($this->extension == 'mssql') { 
    1046             $result->setResult(mssql_query($result->getSQL(), $this->connection)); 
     1047            $result->setResult(@mssql_query($result->getSQL(), $this->connection)); 
    10471048        } elseif ($this->extension == 'mysql') { 
    1048             $result->setResult(mysql_query($result->getSQL(), $this->connection)); 
     1049            $result->setResult(@mysql_query($result->getSQL(), $this->connection)); 
    10491050        } elseif ($this->extension == 'mysqli') { 
    1050             $result->setResult(mysqli_query($this->connection, $result->getSQL())); 
     1051            $result->setResult(@mysqli_query($this->connection, $result->getSQL())); 
    10511052        } elseif ($this->extension == 'odbc') { 
    10521053            $rows = array(); 
    1053             $resource = odbc_exec($this->connection, $result->getSQL()); 
     1054            $resource = @odbc_exec($this->connection, $result->getSQL()); 
    10541055            if (is_resource($resource)) { 
    10551056                // Allow up to 1MB of binary data 
     
    10641065            } 
    10651066        } elseif ($this->extension == 'pgsql') { 
    1066             $result->setResult(pg_query($this->connection, $result->getSQL())); 
     1067            $result->setResult(@pg_query($this->connection, $result->getSQL())); 
    10671068        } elseif ($this->extension == 'sqlite') { 
    1068             $result->setResult(sqlite_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $sqlite_error_message)); 
     1069            $result->setResult(@sqlite_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $sqlite_error_message)); 
    10691070        } elseif ($this->extension == 'sqlsrv') { 
    10701071            $rows = array(); 
    1071             $resource = sqlsrv_query($this->connection, $result->getSQL()); 
     1072            $resource = @sqlsrv_query($this->connection, $result->getSQL()); 
    10721073            if (is_resource($resource)) { 
    10731074                while ($row = sqlsrv_fetch_array($resource, SQLSRV_FETCH_ASSOC)) { 
     
    11181119    { 
    11191120        if ($this->extension == 'mssql') { 
    1120             $result->setResult(mssql_query($result->getSQL(), $this->connection, 20)); 
     1121            $result->setResult(@mssql_query($result->getSQL(), $this->connection, 20)); 
    11211122        } elseif ($this->extension == 'mysql') { 
    1122             $result->setResult(mysql_unbuffered_query($result->getSQL(), $this->connection)); 
     1123            $result->setResult(@mysql_unbuffered_query($result->getSQL(), $this->connection)); 
    11231124        } elseif ($this->extension == 'mysqli') { 
    1124             $result->setResult(mysqli_query($this->connection, $result->getSQL(), MYSQLI_USE_RESULT)); 
     1125            $result->setResult(@mysqli_query($this->connection, $result->getSQL(), MYSQLI_USE_RESULT)); 
    11251126        } elseif ($this->extension == 'odbc') { 
    1126             $result->setResult(odbc_exec($this->connection, $result->getSQL())); 
     1127            $result->setResult(@odbc_exec($this->connection, $result->getSQL())); 
    11271128        } elseif ($this->extension == 'pgsql') { 
    1128             $result->setResult(pg_query($this->connection, $result->getSQL())); 
     1129            $result->setResult(@pg_query($this->connection, $result->getSQL())); 
    11291130        } elseif ($this->extension == 'sqlite') { 
    1130             $result->setResult(sqlite_unbuffered_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $sqlite_error_message)); 
     1131            $result->setResult(@sqlite_unbuffered_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $sqlite_error_message)); 
    11311132        } elseif ($this->extension == 'sqlsrv') { 
    1132             $result->setResult(sqlsrv_query($this->connection, $result->getSQL())); 
     1133            $result->setResult(@sqlsrv_query($this->connection, $result->getSQL())); 
    11331134        } elseif ($this->extension == 'pdo') { 
    11341135            $result->setResult($this->connection->query($result->getSQL())); 
     
    18821883 
    18831884/** 
    1884  * Copyright (c) 2007-2008 Will Bond <will@flourishlib.com> 
     1885 * Copyright (c) 2007-2009 Will Bond <will@flourishlib.com> 
    18851886 *  
    18861887 * Permission is hereby granted, free of charge, to any person obtaining a copy