public function load($test = true)
    {
        $missingTables = false;
        if ($test) {
            $missingTables = $this->test();
        }

        if (!$test || ($test && $missingTables !== false)) {
            foreach (explode(';', $this->schema) as $query) {
                if (!empty(trim($query))) {
                    if (!$test || $this->strposArray($query, $missingTables) !== false) {
                        if ($this->mysql->query($query) === false) {
                            throw new LoaderException(
                                "Error {$this->mysql->errno}: {$this->mysql->error}",
                                LoaderException::MYSQL
                            );
                        }
                    }
                }
            }
        }

        return ($test ? $missingTables : true);
    }
public function load($test = true)
    {
        $missingTables = false;
        if ($test) {
            $missingTables = $this->test();
        }

        if (!$test || ($test && $missingTables !== false)) {
            foreach (explode(';', $this->schema) as $query) {
                if (!empty(trim($query))) {
                    if (!$test || $this->strposArray($query, $missingTables) !== false) {
                        if ($this->mysql->query($query) === false) {
                            throw new LoaderException(
                                "Error {$this->mysql->errno}: {$this->mysql->error}",
                                LoaderException::MYSQL
                            );
                        }
                    }
                }
            }
        }

        return ($test ? $missingTables : true);
    }
public function load ( $ test = true ) { $ missingTables = false ; if ( $ test ) { $ missingTables = $ this -> test ( ) ; } if ( ! $ test || ( $ test && $ missingTables !== false ) ) { foreach ( explode ( ';' , $ this -> schema ) as $ query ) { if ( ! empty ( trim ( $ query ) ) ) { if ( ! $ test || $ this -> strposArray ( $ query , $ missingTables ) !== false ) { if ( $ this -> mysql -> query ( $ query ) === false ) { throw new LoaderException ( "Error {$this->mysql->errno}: {$this->mysql->error}" , LoaderException :: MYSQL ) ; } } } } } return ( $ test ? $ missingTables : true ) ; }
Load the schema into the database

If `$test` is set to `true`, this method will test to see if any tables
created by the schema are missing. If any tables are missing, then only
the queries affecting those tables will be run. Otherwise, if `$test` is
`false`, all queries in the schema will be run blindly, potentially
throwing `LoaderException` if an already-created table is recreated.

@param boolean $test Whether or not to test for missing tables
@return boolean|string[] (Optional, defaults to `true`) If `$test` is
`true`, returns either a list of missing tables or `false` if no
tables were missing, otherwise returns `true` on success.
@throws LoaderException `LoaderException::MYSQL` on MySQL query error
Load the schema into the database