Trying to use prepare with luasql odbc. The README on github has this example:
odbc = require "odbc"
dbassert = odbc.assert
cnn = odbc.connect('EmptyDB')
cnn:setautocommit(false)
stmt = cnn:prepare("insert into test_table(f1, f2) values(?, ?)")
But that does not work for me:
odbc = require "odbc"
stdin:1: module 'odbc' not found:
no field package.preload['odbc']
no file '/usr/local/share/lua/5.3/odbc.lua'
no file '/usr/local/share/lua/5.3/odbc/init.lua'
no file '/usr/local/lib/lua/5.3/odbc.lua'
no file '/usr/local/lib/lua/5.3/odbc/init.lua'
no file '/usr/share/lua/5.3/odbc.lua'
no file '/usr/share/lua/5.3/odbc/init.lua'
no file './odbc.lua'
no file './odbc/init.lua'
no file '/usr/local/lib/lua/5.3/odbc.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/odbc.so'
no file '/usr/lib/lua/5.3/odbc.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './odbc.so'
This require works, but does not have a connect method:
> odbc = require "luasql.odbc"
> con = odbc.connect("dbame", "user", "pass", "localhost", "3306")
stdin:1: attempt to call a nil value (field 'connect')
I can get a handle that does have a connect method this way, but then it does not have a prepare method:
> env = odbc.odbc()
> con = odbc.connect("dbame", "user", "pass", "localhost", "3306")
> con:prepare("select distinct host, port from CondorSession where session_id = ?")
stdin:1: attempt to call a nil value (method 'prepare')
Has anyone got this to work, and if so can you please provide an example.