
res,err= open_sh_lib("libluaodbc.so")

if not res then
	print(err)
	return 
end

db,err= dbopen("mt", "sukru", "")

if not db then
	print(err)
	return
end

print("connected to database")

q,err= db.query("select x,y from xx")

if not q then
	print(err)
	return
end
print("query created")

for r,err in q.fetch() do
	print("new row  " .. tostring(r))
	print("x="..r.x);
	print(string.format("y=%q",r.y))
end

q.close()

res,err=db.exec([[insert into xx values (3, 'this is good')]])
if not res then
	print("error")
	print(err)
end

db.close()

print("all done")
