Пример #1
0
    private ExportTxtStmtRunner(Notebook notebook, ScriptEnv env, ScriptRunner runner, Ast.ExportTxtStmt stmt)
    {
        _notebook = notebook;
        _env      = env;
        _runner   = runner;
        _stmt     = stmt;

        _filePath = GetFilePath();

        foreach (var option in _stmt.OptionsList.GetOptionKeys())
        {
            switch (option)
            {
            case "TRUNCATE_EXISTING_FILE":
                _truncateExistingFile = _stmt.OptionsList.GetOptionBool(option, _runner, _env, false);
                break;

            case "FILE_ENCODING":
                _fileEncoding =
                    _stmt.OptionsList.GetOptionEncoding(option, _runner, _env);
                break;

            default:
                throw new Exception($"\"{option}\" is not a recognized option name.");
            }
        }

        if (_fileEncoding == null)
        {
            _fileEncoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
        }
    }
Пример #2
0
    // must be run from the SQLite thread
    public static void Run(Notebook notebook, ScriptEnv env, ScriptRunner runner, Ast.ExportTxtStmt stmt)
    {
        var exporter = new ExportTxtStmtRunner(notebook, env, runner, stmt);

        exporter.Export();
    }
Пример #3
0
 private void ExecuteExportTxtStmt(Ast.ExportTxtStmt stmt, ScriptEnv env)
 {
     ExportTxtStmtRunner.Run(_notebook, env, this, stmt);
 }