mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
set utf-8
This commit is contained in:
@@ -63,14 +63,14 @@ local function test3( db)
|
|||||||
local res = db:query("select * from cats order by id asc")
|
local res = db:query("select * from cats order by id asc")
|
||||||
print ( "test3 loop times=" ,i,"\n","query result=",dump( res ) )
|
print ( "test3 loop times=" ,i,"\n","query result=",dump( res ) )
|
||||||
res = db:query("select * from cats order by id asc")
|
res = db:query("select * from cats order by id asc")
|
||||||
print ( "test3 loop times=" ,i,"\n","query result=",dump( res ) )
|
print ( "test3 loop times=" ,i,"\n","query result=",dump( res ) )
|
||||||
skynet.sleep(1000)
|
skynet.sleep(1000)
|
||||||
i=i+1
|
i=i+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
skynet.start(function()
|
skynet.start(function()
|
||||||
|
|
||||||
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",
|
||||||
@@ -83,8 +83,10 @@ skynet.start(function()
|
|||||||
end
|
end
|
||||||
print("testmysql success to connect to mysql server")
|
print("testmysql success to connect to mysql server")
|
||||||
|
|
||||||
|
db:query("set names utf8")
|
||||||
|
|
||||||
local res = db:query("drop table if exists cats")
|
local res = db:query("drop table if exists cats")
|
||||||
res = db:query("create table cats "
|
res = db:query("create table cats "
|
||||||
.."(id serial primary key, ".. "name varchar(5))")
|
.."(id serial primary key, ".. "name varchar(5))")
|
||||||
print( dump( res ) )
|
print( dump( res ) )
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ skynet.start(function()
|
|||||||
while true do
|
while true do
|
||||||
local res = db:query("select * from cats order by id asc")
|
local res = db:query("select * from cats order by id asc")
|
||||||
print ( "test1 loop times=" ,i,"\n","query result=",dump( res ) )
|
print ( "test1 loop times=" ,i,"\n","query result=",dump( res ) )
|
||||||
|
|
||||||
res = db:query("select * from cats order by id asc")
|
res = db:query("select * from cats order by id asc")
|
||||||
print ( "test1 loop times=" ,i,"\n","query result=",dump( res ) )
|
print ( "test1 loop times=" ,i,"\n","query result=",dump( res ) )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user