static int luaP_executeplan (lua_State *L) { luaP_Plan *p = (luaP_Plan *) luaP_checkudata(L, 1, PLLUA_PLANMT); bool ro = (bool) lua_toboolean(L, 3); long c = luaL_optlong(L, 4, 0); int result = -1; if (p->nargs > 0) { luaP_Buffer *b; if (lua_type(L, 2) != LUA_TTABLE) luaP_typeerror(L, 2, "table"); b = luaP_getbuffer(L, p->nargs); luaP_fillbuffer(L, 2, p->type, b); luaP_TRY { result = SPI_execute_plan(p->plan, b->value, b->null, ro, c); } luaP_CATCH; }
static void *luaP_checkudata (lua_State *L, int ud, const char *tname) { void *p = luaP_toudata(L, ud, tname); if (p == NULL) luaP_typeerror(L, ud, tname); return p; }