Skip to content

Is it possible to capture the output of a shell command? #1394

@your-diary

Description

@your-diary

If I understand correctly, that is not possible in the official mysql command.

But does mycli perhaps have that feature (given that mycli implements many shell-related extensions such as $| and $>)?

What I want is like this though I'm not particular about the actual syntax:

-- The command is executed in shell and its stdout is captured/returned.
-- The entire statement is aborted when the command exits with non-zero status.
SET @my_id = CAPTURE_OUTPUT("my_id_generator --short");

INSERT INTO user (id) VALUES (@my_id);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions