mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
@@ -103,7 +103,7 @@ local function test_sp_blob(db)
|
|||||||
]]
|
]]
|
||||||
local stmt_insert = db:prepare("INSERT test (str,dt,flt,num,blb) VALUES (?,?,?,?,?)")
|
local stmt_insert = db:prepare("INSERT test (str,dt,flt,num,blb) VALUES (?,?,?,?,?)")
|
||||||
local stmt_csp = db:prepare("call get_test(?)")
|
local stmt_csp = db:prepare("call get_test(?)")
|
||||||
local test_blob = string.char(0x01,0x02,0x03,0x04,0x0a,0x0b,0x0d,0x0e,0x10,0x20,0x30,0x40)
|
local test_blob = string.char(0xFF,0x8F,0x03,0x04,0x0a,0x0b,0x0d,0x0e,0x10,0x20,0x30,0x40)
|
||||||
|
|
||||||
local r = db:execute(stmt_insert,'test_str','2020-3-20 15:30:40',3.1415,89,test_blob)
|
local r = db:execute(stmt_insert,'test_str','2020-3-20 15:30:40',3.1415,89,test_blob)
|
||||||
print("insert result : insert_id",r.insert_id,"affected_rows",r.affected_rows
|
print("insert result : insert_id",r.insert_id,"affected_rows",r.affected_rows
|
||||||
@@ -120,14 +120,14 @@ end
|
|||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
|
|
||||||
local function on_connect(db)
|
local function on_connect(db)
|
||||||
db:query("set charset utf8");
|
db:query("set charset utf8mb4");
|
||||||
end
|
end
|
||||||
local db=mysql.connect({
|
local db=mysql.connect({
|
||||||
host="127.0.0.1",
|
host="127.0.0.1",
|
||||||
port=3306,
|
port=3306,
|
||||||
database="skynet",
|
database="skynet",
|
||||||
user="root",
|
user="root",
|
||||||
password="1",
|
password="123456",
|
||||||
max_packet_size = 1024 * 1024,
|
max_packet_size = 1024 * 1024,
|
||||||
on_connect = on_connect
|
on_connect = on_connect
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user