sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

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

Open mickaelmagniez opened this issue 3 years ago • 1 comments

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

mickaelmagniez avatar Mar 10 '22 09:03 mickaelmagniez

I'm also facing the same issue, did you got any update meantime?

Esotopo21 avatar Jun 01 '22 13:06 Esotopo21