runSqlScript method
Implementation
Future<CliResult> runSqlScript({
required String user,
required String database,
required String scriptFilepath,
String? host,
int? port,
String? password,
}) async {
// The path seperator must be '/' for the "source filename" statement.
final posixScriptFilepath =
checkFileExists(scriptFilepath, "scriptFilepath").absolutePosixPath;
return _execute(
// We do not need to encapsulate the script filepath in double/single
// quotes. Actually doing that only causes errors.
statement: "source $posixScriptFilepath;",
user: user,
database: database,
password: password,
host: host,
port: port,
extraArgs: [
"--abort-source-on-error",
],
);
}