Skip to content

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
** 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.

5 participants