$output
$output : string
The output generated during script execution. Useful for trouble-shooting failed scripts.
This class makes it easy to run SQL scripts through the CLI tool of your RDBMS. It will attempt to auto-detect the location of your "psql" or "mysql" binaries and will run the scripts in such a way that errors halt execution.
__construct(string $dbType, string $username, string $password, string $hostname, string $dbName, string $binaryPath = null)
Note that $dbType must be "pgsql" or "mysql" so that we can construct a CLI command for your DB.
string | $dbType | |
string | $username | |
string | $password | |
string | $hostname | |
string | $dbName | |
string | $binaryPath |
run(string $path, boolean $throwExceptions = true) : boolean
Run the supplied SQL script. If it fails, by default, we'll throw an exception with the command's output. If the command generates a successful exit status (0), then we return true. Any non-zero exit status will return false.
string | $path | |
boolean | $throwExceptions |