public function execute()
    {
        try {
            $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
            $pdo  = new PDO('mysql:host=' . $this->host, $this->user, $this->pass, $opts);

            foreach ($this->queries as $query) {
                if (!is_array($query)) {
                    // Simple query
                    $pdo->query($this->phpci->interpolate($query));
                } elseif (isset($query['import'])) {
                    // SQL file execution
                    $this->executeFile($query['import']);
                } else {
                    throw new \Exception(Lang::get('invalid_command'));
                }
            }
        } catch (\Exception $ex) {
            $this->phpci->logFailure($ex->getMessage());
            return false;
        }
        return true;
    }
public function execute()
    {
        try {
            $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
            $pdo  = new PDO('mysql:host=' . $this->host, $this->user, $this->pass, $opts);

            foreach ($this->queries as $query) {
                if (!is_array($query)) {
                    // Simple query
                    $pdo->query($this->phpci->interpolate($query));
                } elseif (isset($query['import'])) {
                    // SQL file execution
                    $this->executeFile($query['import']);
                } else {
                    throw new \Exception(Lang::get('invalid_command'));
                }
            }
        } catch (\Exception $ex) {
            $this->phpci->logFailure($ex->getMessage());
            return false;
        }
        return true;
    }
public function execute ( ) { try { $ opts = array ( PDO :: ATTR_ERRMODE => PDO :: ERRMODE_EXCEPTION ) ; $ pdo = new PDO ( 'mysql:host=' . $ this -> host , $ this -> user , $ this -> pass , $ opts ) ; foreach ( $ this -> queries as $ query ) { if ( ! is_array ( $ query ) ) { // Simple query $ pdo -> query ( $ this -> phpci -> interpolate ( $ query ) ) ; } elseif ( isset ( $ query [ 'import' ] ) ) { // SQL file execution $ this -> executeFile ( $ query [ 'import' ] ) ; } else { throw new \ Exception ( Lang :: get ( 'invalid_command' ) ) ; } } } catch ( \ Exception $ ex ) { $ this -> phpci -> logFailure ( $ ex -> getMessage ( ) ) ; return false ; } return true ; }
Connects to MySQL and runs a specified set of queries.
@return boolean
Connects to MySQL and runs a specified set of queries .