有谁能告诉我什么是错的
这是表
create table ms_registereduser(userID Varchar(10),socketID Varchar(255));
这是我的server.js
var http = require("http");
var MysqL = require('MysqL');
var connection = MysqL.createConnection({
host : 'localhost',user : 'root',password : '',database : 'pushnotificationdb'
});
var userID = "1234567890",socketID = "asd123";
http.createServer(function(request,response) {
response.writeHead(200,{"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(1111);
connection.connect();
connection.query('callpushnotificationdb.spUpdateSocketID('+userID+','+socketID+');').on('end',function()
{
console.log('User '+ userID+' has updated his socketID to '+socketID);
});
connection.end();
这是我的spUpdateSocketID,带有’//’作为分隔符
DROP PROCEDURE IF EXISTS spUpdateSocketID//
CREATE PROCEDURE spUpdateSocketID(IN userID Varchar(10),IN socketID Varchar(255))
BEGIN
set @userID = userID;
set @socketID = socketID;
set @s = CONCAT('UPDATE ms_registereduser SET socketID = @socketID WHERE userID = @userID');
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END//
call pushnotificationdb.spUpdateSocketID('1234567890','asd123');
它工作,但如果我尝试从node.js调用它它给我这样的错误错误:ER_BAD_FIELD_ERROR:’字段列表’中的未知列’asd123′,请帮助
最佳答案
原文链接:https://www.f2er.com/mysql/434269.html