Skip to content

[MySQL] Can't get by column name when calling stored procedure #1742

@mickaelmagniez

Description

@mickaelmagniez

Hi

When calling a stored procedure, i can't retrieve column by name :

sqlx::query("call fetch()").map(|row: MySqlRow| {
    row.get("id")
}).fetch_all(&pool)

is not working, and with debugger i can see row.column_names is empty

but get by index works

sqlx::query("call fetch()").map(|row: MySqlRow| {
    row.get(0)
}).fetch_all(&pool)

Stored procedure looks like

DELIMITER $$
drop procedure if exists fetch_n;
CREATE PROCEDURE fetch_n()
BEGIN
    select id  from records;
END
$$

Best regards

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