protected function dump()
    {
        $this->write('-- '.date('c').' - '.$this->config->dsn, false);

        if ($this->config->disableAutoCommit === true) {
            $this->write('SET AUTOCOMMIT = 0');
        }

        if ($this->config->disableForeignKeyChecks === true) {
            $this->write('SET FOREIGN_KEY_CHECKS = 0');
        }

        if ($this->config->disableUniqueKeyChecks === true) {
            $this->write('SET UNIQUE_CHECKS = 0');
        }

        if ($this->config->createDatabase) {
            if ($this->config->createDatabase === true) {
                $database = $this->database;
            } else {
                $database = (string) $this->config->createDatabase;
            }

            $this->write(
                'CREATE DATABASE IF NOT EXISTS `'.$database.'` '.
                'DEFAULT CHARACTER SET = '.$this->escape($this->config->encoding)
            );
            $this->write('USE `'.$database.'`');
        }

        $this->dumpTables();
        $this->dumpViews();
        $this->dumpTriggers();
        $this->dumpEvents();

        if ($this->config->disableForeignKeyChecks === true) {
            $this->write('SET FOREIGN_KEY_CHECKS = 1');
        }

        if ($this->config->disableUniqueKeyChecks === true) {
            $this->write('SET UNIQUE_CHECKS = 1');
        }

        if ($this->config->disableAutoCommit === true) {
            $this->write('COMMIT');
            $this->write('SET AUTOCOMMIT = 1');
        }

        $this->write("\n-- Completed on: ".date('c'), false);
    }
protected function dump()
    {
        $this->write('-- '.date('c').' - '.$this->config->dsn, false);

        if ($this->config->disableAutoCommit === true) {
            $this->write('SET AUTOCOMMIT = 0');
        }

        if ($this->config->disableForeignKeyChecks === true) {
            $this->write('SET FOREIGN_KEY_CHECKS = 0');
        }

        if ($this->config->disableUniqueKeyChecks === true) {
            $this->write('SET UNIQUE_CHECKS = 0');
        }

        if ($this->config->createDatabase) {
            if ($this->config->createDatabase === true) {
                $database = $this->database;
            } else {
                $database = (string) $this->config->createDatabase;
            }

            $this->write(
                'CREATE DATABASE IF NOT EXISTS `'.$database.'` '.
                'DEFAULT CHARACTER SET = '.$this->escape($this->config->encoding)
            );
            $this->write('USE `'.$database.'`');
        }

        $this->dumpTables();
        $this->dumpViews();
        $this->dumpTriggers();
        $this->dumpEvents();

        if ($this->config->disableForeignKeyChecks === true) {
            $this->write('SET FOREIGN_KEY_CHECKS = 1');
        }

        if ($this->config->disableUniqueKeyChecks === true) {
            $this->write('SET UNIQUE_CHECKS = 1');
        }

        if ($this->config->disableAutoCommit === true) {
            $this->write('COMMIT');
            $this->write('SET AUTOCOMMIT = 1');
        }

        $this->write("\n-- Completed on: ".date('c'), false);
    }
protected function dump ( ) { $ this -> write ( '-- ' . date ( 'c' ) . ' - ' . $ this -> config -> dsn , false ) ; if ( $ this -> config -> disableAutoCommit === true ) { $ this -> write ( 'SET AUTOCOMMIT = 0' ) ; } if ( $ this -> config -> disableForeignKeyChecks === true ) { $ this -> write ( 'SET FOREIGN_KEY_CHECKS = 0' ) ; } if ( $ this -> config -> disableUniqueKeyChecks === true ) { $ this -> write ( 'SET UNIQUE_CHECKS = 0' ) ; } if ( $ this -> config -> createDatabase ) { if ( $ this -> config -> createDatabase === true ) { $ database = $ this -> database ; } else { $ database = ( string ) $ this -> config -> createDatabase ; } $ this -> write ( 'CREATE DATABASE IF NOT EXISTS `' . $ database . '` ' . 'DEFAULT CHARACTER SET = ' . $ this -> escape ( $ this -> config -> encoding ) ) ; $ this -> write ( 'USE `' . $ database . '`' ) ; } $ this -> dumpTables ( ) ; $ this -> dumpViews ( ) ; $ this -> dumpTriggers ( ) ; $ this -> dumpEvents ( ) ; if ( $ this -> config -> disableForeignKeyChecks === true ) { $ this -> write ( 'SET FOREIGN_KEY_CHECKS = 1' ) ; } if ( $ this -> config -> disableUniqueKeyChecks === true ) { $ this -> write ( 'SET UNIQUE_CHECKS = 1' ) ; } if ( $ this -> config -> disableAutoCommit === true ) { $ this -> write ( 'COMMIT' ) ; $ this -> write ( 'SET AUTOCOMMIT = 1' ) ; } $ this -> write ( "\n-- Completed on: " . date ( 'c' ) , false ) ; }
Dumps database contents to a temporary file.
Dumps database contents to a temporary file .