mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
测试单元
This commit is contained in:
@@ -68,6 +68,13 @@ local function test3( db)
|
|||||||
i=i+1
|
i=i+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function test4( db)
|
||||||
|
local stmt = db:prepare("SELECT * FROM cats WHERE name=?")
|
||||||
|
print ( "test4 prepare result=",dump( stmt ) )
|
||||||
|
local res = db:execute(stmt,'Bob')
|
||||||
|
print ( "test4 query result=",dump( res ) )
|
||||||
|
db:stmt_close(stmt)
|
||||||
|
end
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
|
|
||||||
local function on_connect(db)
|
local function on_connect(db)
|
||||||
@@ -102,6 +109,7 @@ skynet.start(function()
|
|||||||
-- test in another coroutine
|
-- test in another coroutine
|
||||||
skynet.fork( test2, db)
|
skynet.fork( test2, db)
|
||||||
skynet.fork( test3, db)
|
skynet.fork( test3, db)
|
||||||
|
skynet.fork( test4, 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 ("multiresultset test result=", dump( res ) )
|
print ("multiresultset test result=", dump( res ) )
|
||||||
|
|||||||
Reference in New Issue
Block a user