Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * LuaSQLite.h
- *
- * Created on: 27/10/2009
- * Author: bitetti
- */
- #ifndef LUASQLITE_H_
- #define LUASQLITE_H_
- #include <vector>
- #include <string.h>
- #include <sqlite3.h>
- #include "SQLiteBase.h"
- using namespace std;
- extern "C"{
- #include <lua.h>
- #include <lauxlib.h>
- #include <lualib.h>
- }
- class LuaSQLite : public SQLiteBase {
- #define LUASQLITE_CLASSNAME "SQLite"
- public:
- /*
- * Construtor
- */
- LuaSQLite();
- public:
- /*
- * Destrutor
- */
- virtual ~LuaSQLite();
- public:
- /*
- * create instance - Gera uma nova instância de controle retornando seu ponteiro
- */
- static LuaSQLite* create( lua_State * );
- static LuaSQLite* create( lua_State *, const char* );
- /*
- * Encerra todas as instancias aertas
- */
- static void dispose();
- /*
- * Registra funções no State principal de Lua
- */
- static void registraFuncoes( lua_State * );
- //membros
- private:
- lua_State* Lua;
- static vector<LuaSQLite*> elements;
- public:
- /**
- * Lua Binding function to check
- */
- static LuaSQLite* checkClass (lua_State *, int);
- static void* getObject (lua_State *, int);
- //metodos
- public:
- /**
- * Adiciona lua_State ao sistema
- */
- void addLuaState( lua_State*);
- /**
- * carrega cenario e inicializa db
- */
- static int run(lua_State*, const char*);
- /**
- * Registros para Lua
- */
- static const luaL_reg meta_methods[];
- static const luaL_reg class_methods[];
- #define newtable(L) (lua_newtable(L), lua_gettop(L))
- /**
- * Biblioteca de funções para Lua/SQLite
- */
- static int open_database(lua_State*);
- static int close_database(lua_State*);
- static int query(lua_State*);
- static int fetchRow(lua_State*);
- static int sql_error(lua_State*);
- static int reset_stmt(lua_State*);
- static int getMainDatabase(lua_State*);
- };
- #endif /* LUASQLITE_H_ */
Advertisement
Add Comment
Please, Sign In to add comment