Stack Exchange
Node MySQL connection resultset having issue
Connected Node using MySQL (using mysql2/promise)
on
const sql = `
            SELECT *
            FROM Applicant
            WHERE ApplicationId = ?
            `;

const result = await this.mysqlManager.Query(sql,number);
console.log(result);



public async Query(sql: any, parameters?: any, connection?: PoolConnection): Promise<any>
    {
        const con = connection || (await this.GetConnection());
        try
        {
            const data = await con.query(sql, parameters);
            return data;
        }
        catch (error)
        {
            con.release();
            throw error;
        }
    }

but got response

ColumnDefinition {
_buf: <Buffer 3a 00 00 16 03 64 65 66 08 70 72 6f 70 65 6c 6c 64 09 41 70 70 6c 69 63 61 6e 74 09 41 70 70 6c 69 63 61 6e 74 05 50 43
69 74 79 05 50 43 69 74 79 0c ... 2376 more bytes>,
_clientEncoding: 'utf8',
_catalogLength: 3,
_catalogStart: 2329,
_schemaLength: 8,
_schemaStart: 2333,
_tableLength: 9,
_tableStart: 2342,
_orgTableLength: 9,
_orgTableStart: 2352,
_orgNameLength: 16,
_orgNameStart: 2379,
characterSet: 224,
encoding: 'utf8',
name: 'SalaryDayRangeTo',
columnLength: 80,
columnType: 253,
flags: 0,
decimals: 0
}

Can someone please help me with this issue?


const data = await con.query(sql, parameters); return data[0];

Since first element consist of data with other attributes consisting schema information.
