|
require "luasql.odbc"
G_Env=assert(luasql.odbc())
G_Conn=assert(G_Env:connect("perky","",""))
G_Rd={}
G_Rd.Value={}
G_Rd.Cur={}
function G_Rd.Open(i_conn,i_sql)
G_Rd.Cur=assert (i_conn:execute(i_sql))
G_Rd.Value=G_Rd.Cur:fetch({},"a")
end
function G_Rd.Next()
G_Rd.Value=G_Rd.Cur:fetch(G_Rd.Value,"a")
end
function G_Rd.Close()
G_Rd.Cur:close()
end
G_Rd.Open(G_Conn,"select * from players")
while G_Rd.Value do
print(G_Rd.Value["name"].."|"..G_Rd.Value["class"])
G_Rd.Next()
end
在lua环境下通过,换到mush下第一行需要改成
luapath=string.match(GetInfo(35),"^.*\\")
assert (package.loadlib (luapath.."odbc.dll","luaopen_luasqlodbc")) ()
北大侠客行MUD,中国最好的MUD |
|