Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Support for raw ODBC DSN connections. #54

wants to merge 4 commits into from

Conversation

blumf
Copy link
Contributor

@blumf blumf commented Jul 4, 2016

Usage:
env:connect{ dsn = [[...ODBC DNS...]] }

Also allows named parameters in general i.e.
env:connect{ source = "SomeODBCSource", user = "dbuser", password = "dbpass", }

Supersedes #28

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants