DJJob.php
public static function runQuery($sql, $params = array()) {
        for ($attempts = 0; $attempts < self::$retries; $attempts++) {
            try {
                $stmt = self::getConnection()->prepare($sql);
                $stmt->execute($params);

                $ret = array();
                if ($stmt->rowCount()) {
                    // calling fetchAll on a result set with no rows throws a
                    // "general error" exception
                    foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $r) $ret []= $r;
                }

                $stmt->closeCursor();
                return $ret;
            }
            catch (PDOException $e) {
                // Catch "MySQL server has gone away" error.
                if ($e->errorInfo[1] == 2006) {
                    self::$db = null;
                }
                // Throw all other errors as expected.
                else {
                    throw $e;
                }
            }
        }

        throw new DJException("DJJob exhausted retries connecting to database");
    }
public static function runQuery($sql, $params = array()) {
        for ($attempts = 0; $attempts < self::$retries; $attempts++) {
            try {
                $stmt = self::getConnection()->prepare($sql);
                $stmt->execute($params);

                $ret = array();
                if ($stmt->rowCount()) {
                    // calling fetchAll on a result set with no rows throws a
                    // "general error" exception
                    foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $r) $ret []= $r;
                }

                $stmt->closeCursor();
                return $ret;
            }
            catch (PDOException $e) {
                // Catch "MySQL server has gone away" error.
                if ($e->errorInfo[1] == 2006) {
                    self::$db = null;
                }
                // Throw all other errors as expected.
                else {
                    throw $e;
                }
            }
        }

        throw new DJException("DJJob exhausted retries connecting to database");
    }
public static function runQuery ( $ sql , $ params = array ( ) ) { for ( $ attempts = 0 ; $ attempts < self :: $ retries ; $ attempts ++ ) { try { $ stmt = self :: getConnection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( $ params ) ; $ ret = array ( ) ; if ( $ stmt -> rowCount ( ) ) { // calling fetchAll on a result set with no rows throws a // "general error" exception foreach ( $ stmt -> fetchAll ( PDO :: FETCH_ASSOC ) as $ r ) $ ret [ ] = $ r ; } $ stmt -> closeCursor ( ) ; return $ ret ; } catch ( PDOException $ e ) { // Catch "MySQL server has gone away" error. if ( $ e -> errorInfo [ 1 ] == 2006 ) { self :: $ db = null ; } // Throw all other errors as expected. else { throw $ e ; } } } throw new DJException ( "DJJob exhausted retries connecting to database" ) ; }
Runs a query with a resultset against the database.

@param string $sql The query to execute.
@param array  $params The params necessary for a prepared statement.

@return array Returns the complete resultset.
@throws DJException Throws if the query couldn't be executed.
Runs a query with a resultset against the database .