本文整理汇总了C++中Database::GetTableIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Database::GetTableIndex方法的具体用法?C++ Database::GetTableIndex怎么用?C++ Database::GetTableIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::GetTableIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
int initialize(lua_State* state)
{
Database* mysqldb = makeDatabase(state);
if (!mysqldb) return 0;
std::string error;
if (!mysqldb->Initialize(error))
{
LUA->PushBool(false);
LUA->PushString(error.c_str());
delete mysqldb;
return 2;
}
UserData* userdata = (UserData*)LUA->NewUserdata(sizeof(UserData));
userdata->data = mysqldb;
userdata->type = DATABASE_ID;
int uData = LUA->ReferenceCreate();
LUA->ReferencePush(iRefDatabases);
LUA->PushNumber(mysqldb->GetTableIndex());
LUA->ReferencePush(uData);
LUA->SetTable(-3);
LUA->ReferencePush(uData);
LUA->ReferenceFree(uData);
LUA->CreateMetaTableType(DATABASE_NAME, DATABASE_ID);
LUA->SetMetaTable(-2);
return 1;
}
示例2: DBDisconnect
int DBDisconnect(lua_State* state)
{
LUA->CheckType(1, DATABASE_ID);
Database * mysqldb = *reinterpret_cast<Database **>(LUA->GetUserdata(1));
if (!mysqldb) {
LUA->ThrowError("Attempted to call Disconnect on a shutdown database");
return 0;
}
LUA->ReferencePush(iRefDatabases);
LUA->PushNumber(mysqldb->GetTableIndex());
LUA->PushNil();
LUA->SetTable(-3);
DisconnectDB(state, mysqldb);
return 0;
}
示例3: create
int create(lua_State* state)
{
Database* mysqldb = makeDatabase(state);
if (!mysqldb) return 0;
UserData* userdata = (UserData*)LUA->NewUserdata(sizeof(UserData));
userdata->data = mysqldb;
userdata->type = DATABASE_ID;
int uData = LUA->ReferenceCreate();
LUA->ReferencePush(iRefDatabases);
LUA->PushNumber(mysqldb->GetTableIndex());
LUA->ReferencePush(uData);
LUA->SetTable(-3);
LUA->ReferencePush(uData);
LUA->ReferenceFree(uData);
LUA->CreateMetaTableType(DATABASE_NAME, DATABASE_ID);
LUA->SetMetaTable(-2);
return 1;
}