在node
对mysql
的查询中,查询的返回结果中。
-
select * from table
返回结果是数组
(Array)
类型。结构是数组中包含对象。[{},{}]
-
insert
返回结果是Object
类型,结果如下所示insert into table () values ()
{ fieldCount: 0, affectedRows: 1, //影响行数 insertId: 481, //ID serverStatus: 2, //服务器状态 warningCount: 0, //警告 message: '', //信息 protocol41: true, //协议 changedRows: 0 //改变的行数 }
-
update
返回的结果类型为Object
update table set xx = xx where xx = xx
返回结果:
{ fieldCount: 0, affectedRows: 1, insertId: 0, serverStatus: 2, warningCount: 0, message: '(Rows matched: 1 Changed: 1 Warnings: 0', protocol41: true, changedRows: 1 }
-
delete
返回的结果类型为Object
delete from table where xx = xx
返回结果:
Object
{ fieldCount: 0, affectedRows: 1, insertId: 0, serverStatus: 2, warningCount: 0, message: '(Rows matched: 1 Changed: 1 Warnings: 0', protocol41: true, changedRows: 1 }