This is my current request to insert data:
let record = {
ip : '127.0.0.1',
...
};
conn.query('INSERT INTO events_log SET ?', [record]);
Is it possible to apply INET6_ATON
function to the IP without converting it to a plain query? There are tens of parameters in this object and I wouldn't want to disassemble it.
The IP field is varbinary(16)
type.
Yes, it is possible:
let INET6_ATON = { toSqlString: function() { return 'INET6_ATON(' + mysql.escape(ip) + ')'; } };
let record = {
ip : INET6_ATON,
...
};
conn.query('INSERT INTO events_log SET ?', [record]);