lua-users home
lua-l archive

Re: Lua dbi Mysql problem

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Sep 20, 2015 at 4:25 PM, <spam@vincentcox.com> wrote:
> the following code:
> XXXXXXXXXXXXXX
> require('DBI')
>
> -- Create a connection
> local dbh = assert(DBI.Connect('Driver', db, username, password, host, port))
>
> -- set the autocommit flag
> -- this is turned off by default
> dbh:autocommit(true)
>
> -- check status of the connection
> local alive = dbh:ping()
>
> -- prepare a connection
> local sth = assert(dbh:prepare(sql_string))
>
> -- commit the transaction
> dbh:commit()
>
> -- finish up
> local ok = dbh:close()
> XXXXXXXXXXXXXX
> throws the following error:./dbi.lua:4: too many C levels (limit is 200)
> in main function near ''MySQL''"
> Any idea how to solve this?
>
>
Hello,
which Lua version do you use?
In Lua >= 5.1 modules return themselves, so use
 local DBI = require 'DBI'
Replace "Driver" with "MySQL" (or another engine).
It works for me.
-- 
Best regards,
Boris Nagaev

AltStyle によって変換されたページ (->オリジナル) /