This file contains hidden or 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; | |
} |
This file contains hidden or 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
/* | |
* res,err = db:run_command(dbname, lua_table or json_str, options) | |
*/ | |
static int dbclient_run_command(lua_State *L) { | |
DBClientBase *dbclient = userdata_to_dbclient(L, 1); | |
const char *ns = luaL_checkstring(L, 2); | |
int options = luaL_tointeger(L, 4); // if it is invalid it returns 0 | |
BSONObj command; // arg 3 | |
try { |
This file contains hidden or 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
-- LuaJIT binding to libev (http://libev.schmorp.de/) | |
-- | |
-- uses almost-identical API to lua-ev (https://github.com/brimworks/lua-ev) | |
-- Author: Evan Wies <neomantra at gmail> | |
-- | |
local ffi = require('ffi') | |
local bit = require("bit") | |
local band, bor = bit.band, bit.bor |
This file contains hidden or 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
-- mongol is based on the mongo C driver: | |
-- http://api.mongodb.org/c/current/ | |
-- BSON types are marshalled just like luamongo: | |
-- http://code.google.com/p/luamongo/wiki/BsonTypes | |
-- new empty BSON object | |
b = bson.new() | |
-- new BSON object |
NewerOlder