mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
no message
This commit is contained in:
@@ -481,12 +481,14 @@ local function _recv_auth_resp(self)
|
|||||||
if not packet then
|
if not packet then
|
||||||
--print("recv auth resp : failed to receive the result packet")
|
--print("recv auth resp : failed to receive the result packet")
|
||||||
error ("failed to receive the result packet"..err)
|
error ("failed to receive the result packet"..err)
|
||||||
|
--return nil,err
|
||||||
end
|
end
|
||||||
|
|
||||||
--print("receive auth response packet type: ",typ)
|
--print("receive auth response packet type: ",typ)
|
||||||
if typ == 'ERR' then
|
if typ == 'ERR' then
|
||||||
local errno, msg, sqlstate = _parse_err_packet(packet)
|
local errno, msg, sqlstate = _parse_err_packet(packet)
|
||||||
error( string.format("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate))
|
error( string.format("errno:%d, msg:%s,sqlstate:%s",errno,msg,sqlstate))
|
||||||
|
--return nil, errno,msg, sqlstate
|
||||||
end
|
end
|
||||||
|
|
||||||
if typ == 'EOF' then
|
if typ == 'EOF' then
|
||||||
|
|||||||
@@ -45,6 +45,24 @@ local function dump(obj)
|
|||||||
return dumpObj(obj, 0)
|
return dumpObj(obj, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function test2( db)
|
||||||
|
local i=1
|
||||||
|
while true do
|
||||||
|
local res = db:query("select * from cats order by id asc")
|
||||||
|
print ( "test2 i=" ,i,"\n",dump( res ) )
|
||||||
|
skynet.sleep(1000)
|
||||||
|
i=i+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function test3( db)
|
||||||
|
local i=1
|
||||||
|
while true do
|
||||||
|
local res = db:query("select * from cats order by id asc")
|
||||||
|
print ( "test3 i=" ,i,"\n",dump( res ) )
|
||||||
|
skynet.sleep(1000)
|
||||||
|
i=i+1
|
||||||
|
end
|
||||||
|
end
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
|
|
||||||
local db=mysql.connect{
|
local db=mysql.connect{
|
||||||
@@ -72,6 +90,9 @@ skynet.start(function()
|
|||||||
res = db:query("select * from cats order by id asc")
|
res = db:query("select * from cats order by id asc")
|
||||||
print ( dump( res ) )
|
print ( dump( res ) )
|
||||||
|
|
||||||
|
-- test in another coroutine
|
||||||
|
skynet.fork( test2, db)
|
||||||
|
skynet.fork( test3, db)
|
||||||
-- multiresultset test
|
-- multiresultset test
|
||||||
res = db:query("select * from cats order by id asc ; select * from cats")
|
res = db:query("select * from cats order by id asc ; select * from cats")
|
||||||
print ( dump( res ) )
|
print ( dump( res ) )
|
||||||
@@ -82,10 +103,15 @@ skynet.start(function()
|
|||||||
local res = db:query("select * from notexisttable" )
|
local res = db:query("select * from notexisttable" )
|
||||||
print( dump(res) )
|
print( dump(res) )
|
||||||
|
|
||||||
res = db:query("select * from cats order by id asc")
|
local i=1
|
||||||
print ( dump( res ) )
|
while true do
|
||||||
|
local res = db:query("select * from cats order by id asc")
|
||||||
|
print ( "test1 i=" ,i,"\n",dump( res ) )
|
||||||
|
skynet.sleep(1000)
|
||||||
|
i=i+1
|
||||||
|
end
|
||||||
|
|
||||||
db:disconnect()
|
--db:disconnect()
|
||||||
skynet.exit()
|
--skynet.exit()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user