[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: minor bug in LuaSQL test case, and a couple of questions
- From: "Vijay Aswadhati" <wyseman@...>
- Date: Thu, 18 Aug 2005 08:15:45 -0700
When testing LuaSQL with SQLite the following line is a false assertion:
<in test.lua: line 76>
assert2 (nil, ENV:connect ("/unknown-data-base"), "this should be an error")
</in test.lua: line 76>
This is because SQLite happily creates 'unknown-data-base' at the root level,
if you have appropriate permissions. In Windows it will create the file in C:\
and this assertion will be triggered falsely.
Ok with that out of the way, I have a question. I am using Lua-work6 and I want
to build LuaSQL as a DLL with SQLite, MySQL and ODBC all in the same DLL. What
this means is that the LuaSQL.dll would export:
luaopen_sqlite,
luaopen_mysql,
luaopen_odbc
Now if someone requires("luasql.sqlite") how would I direct the mechanisms to
look for that package in LuaSQL.dll?
Currently the approach I am taking is to have sqlite.lua, mysql.lua, odbc.lua
stub files. As an example here is how sqlite.lua looks:
<lua code>
-- Lua stub to load SQLite binding on: require('sqlite') ---
local function path()
if _DEBUG == true then
return "LuaSQLd.dll"
else
return "LuaSQL.dll"
end
end
local fn = "luaopen_sqlite";
assert(loadlib(path(), fn))()
</lua code>
But I remember reading a post sometime ago stating that with the new package
proposal that is being discussed, stub files will not be needed. I am wondering
how that can be so?
-- v.a