/* ** Create metatables for each class of object. */ static void create_metatables (lua_State *L) { struct luaL_reg environment_methods[] = { {"__gc", env_gc}, {"close", env_close}, {"connect", env_connect}, {NULL, NULL}, }; struct luaL_reg connection_methods[] = { {"__gc", conn_gc}, {"close", conn_close}, {"execute", conn_execute}, {"commit", conn_commit}, {"rollback", conn_rollback}, {"setautocommit", conn_setautocommit}, {"escape", conn_escape}, {NULL, NULL}, }; struct luaL_reg cursor_methods[] = { {"__gc", cur_gc}, {"close", cur_close}, {"fetch", cur_fetch}, {"getcoltypes", cur_coltypes}, {"getcolnames", cur_colnames}, {NULL, NULL}, }; luasql_createmeta (L, LUASQL_ENVIRONMENT_FIREBIRD, environment_methods); luasql_createmeta (L, LUASQL_CONNECTION_FIREBIRD, connection_methods); luasql_createmeta (L, LUASQL_CURSOR_FIREBIRD, cursor_methods); lua_pop (L, 3); }
/* ** Create metatables for each class of object. */ static void create_metatables (lua_State *L) { struct luaL_Reg environment_methods[] = { {"__gc", env_close}, /* Should this method be changed? */ {"close", env_close}, {"connect", env_connect}, {NULL, NULL}, }; struct luaL_Reg connection_methods[] = { {"__gc", conn_close}, /* Should this method be changed? */ {"close", conn_close}, {"execute", conn_execute}, {"commit", conn_commit}, {"rollback", conn_rollback}, {"setautocommit", conn_setautocommit}, {NULL, NULL}, }; struct luaL_Reg cursor_methods[] = { {"__gc", cur_close}, /* Should this method be changed? */ {"close", cur_close}, {"fetch", cur_fetch}, {"getcoltypes", cur_coltypes}, {"getcolnames", cur_colnames}, {NULL, NULL}, }; luasql_createmeta (L, LUASQL_ENVIRONMENT_ODBC, environment_methods); luasql_createmeta (L, LUASQL_CONNECTION_ODBC, connection_methods); luasql_createmeta (L, LUASQL_CURSOR_ODBC, cursor_methods); lua_pop (L, 3); }