lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
539 stars 191 forks source link

lua 5.3 support for luasql-mysql #30

Closed gnarz closed 5 years ago

gnarz commented 9 years ago

with a tiny change, luasql-mysql is ready for lua 5.3. In src/ls_mysql.c line 494 replace luaL_optint with luaL_optinteger.

ghost commented 9 years ago

I read code https://github.com/keplerproject/luasql/blob/ac557a7fcdea0f5e887d1329f96f79d66bc9ed10/src/ls_mysql.c#L494. luaL_optint has been replaced with luaL_optinteger for lua5.3.

But when I use luasql-mysql .then

sudo luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql

and write a test. some error occur :

lua: error loading module 'luasql.mysql' from file '/usr/local/lib/lua/5.3/luasql/mysql.so':
        /usr/local/lib/lua/5.3/luasql/mysql.so: undefined symbol: luaL_optint
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        test_mysql_lua.lua:1: in main chunk
        [C]: in ?

Is that because luarocks mysql.so file is old file (lua5.2)?

blumf commented 9 years ago

I'm guessing (not a rocks user) that it's pulling the old 2.3.0 branch, you'll need to use the cvs-1 version to get the current stuff.

Remove what you've just installed and, I think...

sudo luarocks install luasql-mysql cvs-1 MYSQL_INCDIR=/usr/include/mysql

...or something like that.

ghost commented 9 years ago

Thank you very much!

But, I

sudo luarocks install luasql-mysql cvs-1 MYSQL_INCDIR=/usr/include/mysql

then

Warning: falling back to wget - install luasec to get native HTTPS support

Error: No results matching query were found.

No matching!!!

rjpcomputing commented 9 years ago

You need to specify a different rock repository to get the cvs-1 release. Try using the dev repo at http://rocks.luarocks.org/dev.

sudo luarocks --from=http://rocks.luarocks.org/dev install luasql-mysql cvs-1 MYSQL_INCDIR=/usr/include/mysql
ghost commented 9 years ago

Thank you very much! That`s OK!

spongefather commented 8 years ago

thanks guys, that is very useful for lua 5.3 version .

ghost commented 8 years ago

Get it, that is very good message! Thank you very much!

huyujiang commented 8 years ago

Very good

binkoni commented 8 years ago

Helpful!

wolaiye1010 commented 7 years ago

me too ! /usr/local/bin/lua: error loading module 'luasql.mysql' from file '/usr/local/lib/lua/5.3/luasql/mysql.so': dlopen(/usr/local/lib/lua/5.3/luasql/mysql.so, 6): Symbol not found: _luaL_optint Referenced from: /usr/local/lib/lua/5.3/luasql/mysql.so Expected in: flat namespace in /usr/local/lib/lua/5.3/luasql/mysql.so stack traceback: but now!

sudo luarocks --from=http://rocks.luarocks.org/dev install luasql-mysql cvs-1 MYSQL_INCDIR=/usr/include/mysql

it is ok!

hishamhm commented 7 years ago

@tomasguisasola Perhaps it's time to package the current Git as LuaSQL-MySQL 2.3.1? Looks like lots of people are looking for Lua 5.3 support.

Etiene commented 7 years ago

Yes please... It's the only thing left for sailor 5.3 support and only a new rockspec upload of this is missing! :) @tomasguisasola

shanguichaofeng commented 7 years ago

@rjpcomputing

sudo luarocks --from=https://luarocks.org/dev install luasql-mysql cvs-1 MYSQL_DIR=/usr/local/mysql
GitHubProgarm commented 6 years ago

In the win system, lua5.3 uses mysql.dll. "Error: error loading module'luasql_mysql'from file"'.mysql.dll is obtained through luasql-master. Strangely, another generated DLL can be invoked by lua5.3.