-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for raw ODBC DSN connections. #54
base: master
Are you sure you want to change the base?
Conversation
Usage: `env:connect{ dsn = [[...ODBC DNS...]] }` Also allows named parameters in general i.e. `env:connect{ source = "SomeODBCSource", user = "dbuser", password = "dbpass", }`
src/luasql.c
Outdated
res = lua_tonumber(L, -1); | ||
lua_pop(L, 1); | ||
|
||
return lua_isnumber(L, -1) ? res : def; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function appears to be unused for now. Anyway, it doesn't work because lua_isnumber
check is performed after the supposed number is popped, so it always returns default value unless another number happens to be at the top of the stack when it's called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it in the ODBC DNS branch
src/ls_odbc.c
Outdated
** source: data source | ||
** user, pass: data source authentication information | ||
** Lua Returns: | ||
** new connection details table | ||
*/ | ||
static void env_connect_fix_old (lua_State *L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: replace terms such as "old" and "new"; over the years these definitions get outdated and stop making sense (e.g. what if a third way of connecting comes up? becomes newer
?). I suggest env_connect_convert_args_to_table
instead.
Also, "fix" is a heavy term, because it implies something was "broken", when in this case it was clearly not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
Usage:
env:connect{ dsn = [[...ODBC DNS...]] }
Also allows named parameters in general i.e.
env:connect{ source = "SomeODBCSource", user = "dbuser", password = "dbpass", }
Supersedes #28