includes/DBManager.php
/**
     * Executes given query using PDO prepared statements.
     * returns query output if shouldReturn is true
     *
     * @param string $query
     * @param array|false $bindParams
     * @param boolean $shouldReturn
     * @return bool|array
     */
Executes given query using PDO prepared statements.
returns query output if shouldReturn is true

@param string $query
@param array|false $bindParams
@param boolean $shouldReturn
@return bool|array
Executes given query using PDO prepared statements . returns query output if shouldReturn is true @param string $query @param array|false $bindParams @param boolean $shouldReturn @return bool|array
public static function executeQuery($query, $bindParams = false, $shouldReturn = false) {
        try {
            $instance = self::getInstance();
            $instance->beginTransaction();
            Logger::getLogger()->LogDebug('Executing Query: '.$query);
            $stmt = $instance->prepare($query);
            $querySuccess = false;
            if (!empty($bindParams)) {
                $querySuccess = $stmt->execute($bindParams);
            } else {
                $querySuccess = $stmt->execute();
            }
            if ($querySuccess) {
                if ($shouldReturn) {
                    $resultSet = array();
                    while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                        $resultSet[] = $row;
                    }
                } else {
                    $resultSet = true;
                }
            } else {
                $resultSet = false;
            }
            $instance->commit();
            return $resultSet;
        } catch (PDOException $e) {
            $instance->rollBack();
            Logger::getLogger()->LogFatal($e->getMessage());
        }
    }
public static function executeQuery ( $ query , $ bindParams = false , $ shouldReturn = false ) { try { $ instance = self :: getInstance ( ) ; $ instance -> beginTransaction ( ) ; Logger :: getLogger ( ) -> LogDebug ( 'Executing Query: ' . $ query ) ; $ stmt = $ instance -> prepare ( $ query ) ; $ querySuccess = false ; if ( ! empty ( $ bindParams ) ) { $ querySuccess = $ stmt -> execute ( $ bindParams ) ; } else { $ querySuccess = $ stmt -> execute ( ) ; } if ( $ querySuccess ) { if ( $ shouldReturn ) { $ resultSet = array ( ) ; while ( $ row = $ stmt -> fetch ( PDO :: FETCH_ASSOC ) ) { $ resultSet [ ] = $ row ; } } else { $ resultSet = true ; } } else { $ resultSet = false ; } $ instance -> commit ( ) ; return $ resultSet ; } catch ( PDOException $ e ) { $ instance -> rollBack ( ) ; Logger :: getLogger ( ) -> LogFatal ( $ e -> getMessage ( ) ) ; } }
Executes given query using PDO prepared statements.
Executes given query using PDO prepared statements .