Created
December 30, 2011 18:35
-
-
Save neomantra/1540945 to your computer and use it in GitHub Desktop.
luamongo dbclient_get_last_error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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