Pergunta

I don't know why I can't access my property.

connection.query("call VerifyAccountToken(0, null)", function(err, rows, fields) {
    if(err) console.log("Error: " + err);

    console.log("SQLRet: ", rows[0].result);
    console.log(rows);
    console.log(fields);
});

VerifyAccountToken returns a single row/column result with the column named 'result'. The console outputs the following:

SQLRet: undefined

[ [ { result: 0 } ], { fieldCount: 0, affectedRows: 0, insertId: 0, serverStatus: 2, warningCount: 1, message: '', protocol41: true, changedRows: 0 } ]

[ [ { catalog: 'def', db: '', table: '', orgTable: '', name: 'result', orgName: 'iRes', filler1: , charsetNr: 63, length: 11, type: 3, flags: 0, decimals: 0, filler2: , default: undefined, zeroFill: false, protocol41: true } ], undefined ]

Everything I know tells me this should work.

Foi útil?

Solução

Ok apparently I needed to use

rows[0][0].result;

I'm not sure why node-mysql nests stored procedures' returned results.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top