73 password = luaL_checkstring(L, 3); |
73 password = luaL_checkstring(L, 3); |
74 case 2: |
74 case 2: |
75 if (lua_isnil(L, 2) == 0) |
75 if (lua_isnil(L, 2) == 0) |
76 user = luaL_checkstring(L, 2); |
76 user = luaL_checkstring(L, 2); |
77 case 1: |
77 case 1: |
78 if (lua_isnil(L, 1) == 0) |
78 /* |
79 db = luaL_checkstring(L, 1); |
79 * db is the only mandatory parameter |
|
80 */ |
|
81 db = luaL_checkstring(L, 1); |
80 } |
82 } |
81 |
83 |
82 conn = (connection_t *)lua_newuserdata(L, sizeof(connection_t)); |
84 conn = (connection_t *)lua_newuserdata(L, sizeof(connection_t)); |
83 |
85 |
84 conn->postgresql = PQsetdbLogin(host, port, options, tty, db, user, password); |
86 conn->postgresql = PQsetdbLogin(host, port, options, tty, db, user, password); |