本文整理汇总了C++中SqlStatement::addFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ SqlStatement::addFloat方法的具体用法?C++ SqlStatement::addFloat怎么用?C++ SqlStatement::addFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlStatement
的用法示例。
在下文中一共展示了SqlStatement::addFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
RealmDataDatabase.BeginTransaction();
DeleteFromDB();
static SqlStatementID saveCorpse;
SqlStatement stmt = RealmDataDatabase.CreateStatement(saveCorpse, "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
stmt.addUInt64(GetGUIDLow());
stmt.addUInt64(GUID_LOPART(GetOwnerGUID()));
stmt.addFloat(GetPositionX());
stmt.addFloat(GetPositionY());
stmt.addFloat(GetPositionZ());
stmt.addFloat(GetOrientation());
stmt.addUInt32(GetZoneId());
stmt.addUInt32(GetMapId());
stmt.addString(GetUInt32ValuesString());
stmt.addUInt64(m_time);
stmt.addUInt32(GetType());
stmt.addInt32(GetInstanceId());
stmt.Execute();
RealmDataDatabase.CommitTransaction();
}
示例2: SaveToDB
bool PlayerLogger::SaveToDB(PlayerLogMask mask, bool removeSaved, bool insideTransaction)
{
bool written = false;
uint64 serverStart = uint64(sWorld.GetStartTime());
for (uint8 i = 0; i < MAX_PLAYER_LOG_ENTITIES; ++i)
{
if ((mask & CalcLogMask(PlayerLogEntity(i))) == 0 || data[i] == NULL)
continue;
if (!insideTransaction)
CharacterDatabase.BeginTransaction();
written = true;
for (uint8 id = 0; id < data[i]->size(); ++id)
{
switch (PlayerLogEntity(i))
{
case PLAYER_LOG_DAMAGE_GET:
{
PlayerLogDamage info = *(PlayerLogDamage*)(&data[i]->at(id));
static SqlStatementID dmgGetStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(dmgGetStmt, "INSERT INTO playerlog_damage_get SET guid = ?, `time` = ?, aggressor = ?, isPlayer = ?, damage = ?, spell = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addUInt32(info.GetId());
stmt.addBool(info.IsPlayer());
stmt.addInt32(info.damage);
stmt.addUInt16(info.spell);
stmt.Execute();
}
break;
case PLAYER_LOG_DAMAGE_DONE:
{
PlayerLogDamage info = *(PlayerLogDamage*)(&data[i]->at(id));
static SqlStatementID dmgDoneStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(dmgDoneStmt, "INSERT INTO playerlog_damage_done SET guid = ?, `time` = ?, victim = ?, isPlayer = ?, damage = ?, spell = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addUInt32(info.GetId());
stmt.addBool(info.IsPlayer());
stmt.addInt32(info.damage);
stmt.addUInt16(info.spell);
stmt.Execute();
}
break;
case PLAYER_LOG_LOOTING:
{
PlayerLogLooting info = *(PlayerLogLooting*)(&data[i]->at(id));
static SqlStatementID lootStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(lootStmt, "INSERT INTO playerlog_looting SET guid = ?, `time`= ?, item = ?, sourceType = ?, sourceEntry = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addUInt32(info.GetItemEntry());
stmt.addUInt8(uint8(info.GetLootSourceType()));
stmt.addUInt32(info.droppedBy);
stmt.Execute();
}
break;
case PLAYER_LOG_TRADE:
{
PlayerLogTrading info = *(PlayerLogTrading*)(&data[i]->at(id));
static SqlStatementID tradeStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(tradeStmt, "INSERT INTO playerlog_trading SET guid = ?, `time`= ?, itemEntry = ?, itemGuid = ?, aquired = ?, partner = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addUInt32(info.GetItemEntry());
stmt.addUInt32(info.itemGuid);
stmt.addBool(info.IsItemAquired());
stmt.addUInt16(info.partner);
stmt.Execute();
}
break;
case PLAYER_LOG_KILL:
{
PlayerLogKilling info = *(PlayerLogKilling*)(&data[i]->at(id));
static SqlStatementID killStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(killStmt, "INSERT INTO playerlog_killing SET guid = ?, `time`= ?, iskill = ?, entry = ?, victimGuid = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addBool(info.IsKill());
stmt.addUInt32(info.GetUnitEntry());
stmt.addUInt32(info.unitGuid);
stmt.Execute();
}
break;
case PLAYER_LOG_POSITION:
{
PlayerLogPosition info = *(PlayerLogPosition*)(&data[i]->at(id));
static SqlStatementID posStmt;
SqlStatement stmt = CharacterDatabase.CreateStatement(posStmt, "INSERT INTO playerlog_position SET guid = ?, `time`= ?, map = ?, posx = ?, posy = ?, posz = ?");
stmt.addUInt32(playerGuid);
stmt.addUInt64(info.timestamp + serverStart);
stmt.addUInt16(info.map);
stmt.addFloat(info.x);
stmt.addFloat(info.y);
stmt.addFloat(info.z);
stmt.Execute();
}
break;
case PLAYER_LOG_PROGRESS:
{
//.........这里部分代码省略.........