Beispiel #1
0
/*
 * ok,err = query:explain()
 */
static int query_explain(lua_State *L) {
    Query *query = userdata_to_query(L, 1);

    try {
        query->explain();
    } catch (std::exception &e) {
        lua_pushboolean(L, 0);
        lua_pushfstring(L, LUAMONGO_ERR_QUERY_FAILED, e.what());
        return 2;
    }

    lua_pushboolean(L, 1);
    return 1;
}
/* Query Class */
TEST(QueryTest, Explain) {
    Query q;
    q.explain();
    ASSERT_TRUE(q.isComplex());
    ASSERT_TRUE(q.isExplain());
}