0
我有一個存儲過程插入數據庫並插入後返回命令ID到控制檯。RowDataPacket返回未定義的值
這裏是我的存儲過程
CREATE PROCEDURE create_old_user_order(
IN p_userid int(11),
IN p_userfname varchar(50),
IN p_userlname varchar(50),
IN p_phone varchar(20),
IN p_item int(11),
IN p_item_qty int(11))
BEGIN
INSERT INTO user_order(customer_id,
first_name,
last_name,
phone_numb,
order_item,
order_quantity)
VALUES (p_userid,
p_userfname,
p_userlname,
p_phone,
p_item,
p_item_qty);
SET @LAST_id = LAST_INSERT_ID();
SELECT @LAST_id AS `booking_id`;
END;
撥打國際長途的Node.js應用快速的過程是好的。
console.log(results)
顯示了這個
[ [ RowDataPacket { booking_id: 15646747643 } ],
OkPacket {
fieldCount: 0,
affectedRows: 0,
insertId: 0,
serverStatus: 2,
warningCount: 0,
message: '',
protocol41: true,
changedRows: 0 } ]
和
console.log(results[0])
表明這一點:
[ RowDataPacket { booking_id: 15646747643 } ]
這樣
console.log(results[0].booking_id)
我得到
Undefined.
請HELPPPP