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