Skip to content

Instantly share code, notes, and snippets.

@neomantra
Created December 30, 2011 18:35
Show Gist options
  • Save neomantra/1540945 to your computer and use it in GitHub Desktop.
Save neomantra/1540945 to your computer and use it in GitHub Desktop.
luamongo dbclient_get_last_error
/*
* str = db:get_last_error()
*/
static int dbclient_get_last_error(lua_State *L) {
DBClientBase *dbclient = userdata_to_dbclient(L, 1);
string result = dbclient->getLastError();
lua_pushlstring(L, result.c_str(), result.size());
return 1;
}
/*
* tbl = db:get_last_error_detailed()
*/
static int dbclient_get_last_error_detailed(lua_State *L) {
DBClientBase *dbclient = userdata_to_dbclient(L, 1);
BSONObj res = dbclient->getLastErrorDetailed();
bson_to_lua(L, res);
return 1;
}
// add entry points
// {"get_last_error", dbclient_get_last_error},
// {"get_last_error_detailed", dbclient_get_last_error_detailed},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment