本文整理汇总了C#中Reality.Storage.SqlDatabaseClient.ExecuteScalar方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabaseClient.ExecuteScalar方法的具体用法?C# SqlDatabaseClient.ExecuteScalar怎么用?C# SqlDatabaseClient.ExecuteScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reality.Storage.SqlDatabaseClient
的用法示例。
在下文中一共展示了SqlDatabaseClient.ExecuteScalar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEffect
public static AvatarEffect CreateEffect(SqlDatabaseClient MySqlClient, uint UserId, int SpriteId, double Duration)
{
MySqlClient.SetParameter("userid", UserId);
MySqlClient.SetParameter("spriteid", SpriteId);
MySqlClient.SetParameter("duration", Duration);
string RawId = MySqlClient.ExecuteScalar("INSERT INTO avatar_effects (user_id,sprite_id,duration) VALUES (@userid,@spriteid,@duration); SELECT LAST_INSERT_ID();").ToString();
uint Id = 0;
uint.TryParse(RawId, out Id);
if (Id == 0)
{
return null;
}
return new AvatarEffect(Id, SpriteId, Duration, 1, false, 0.0);
}
示例2: CreatePet
public static Pet CreatePet(SqlDatabaseClient MySqlClient, uint UserId, int Type, string Name, int Race)
{
MySqlClient.SetParameter("userid", UserId);
MySqlClient.SetParameter("type", Type);
MySqlClient.SetParameter("name", Name);
MySqlClient.SetParameter("race", Race);
MySqlClient.SetParameter("timestamp", UnixTimestamp.GetCurrent());
string RawId = MySqlClient.ExecuteScalar("INSERT INTO pets (user_id,type,name,race,timestamp) VALUES (@userid,@type,@name,@race,@timestamp); SELECT LAST_INSERT_ID();").ToString();
uint Id = 0;
uint.TryParse(RawId, out Id);
if (Id == 0)
{
return null;
}
return new Pet(Id, Name, Type, Race, UserId, 0, new Vector3(0, 0, 0), UnixTimestamp.GetCurrent(), 0, 120, 100, 0);
}
示例3: FillCache
public static void FillCache(SqlDatabaseClient MySqlClient, uint LinkedItemId)
{
if (mCache.ContainsKey(LinkedItemId))
{
mCache.Remove(LinkedItemId);
}
uint IdValue = 0;
MySqlClient.SetParameter("id", LinkedItemId);
object Result = MySqlClient.ExecuteScalar("SELECT room_id FROM items WHERE id = @id LIMIT 1");
if (Result != null)
{
IdValue = (uint)Result;
}
if (IdValue > 0)
{
mCache.Add(LinkedItemId, IdValue);
}
}
示例4: CreateItem
public static Item CreateItem(SqlDatabaseClient MySqlClient, uint DefinitionId, uint UserId, string Flags, string FlagsDisplay, double ExpireTimestamp, bool Untradable = false, WiredManager WiredManager = null)
{
MySqlClient.SetParameter("definitionid", DefinitionId);
MySqlClient.SetParameter("userid", UserId);
MySqlClient.SetParameter("flags", Flags);
MySqlClient.SetParameter("flagsd", FlagsDisplay);
MySqlClient.SetParameter("untradable", Untradable ? "1" : "0");
MySqlClient.SetParameter("expiretimestamp", ExpireTimestamp);
string RawId = MySqlClient.ExecuteScalar("INSERT INTO items (definition_id,user_id,flags,flags_display,untradable,expire_timestamp) VALUES (@definitionid,@userid,@flags,@flagsd,@untradable,@expiretimestamp); SELECT LAST_INSERT_ID();").ToString();
uint Id = 0;
uint.TryParse(RawId, out Id);
if (Id == 0)
{
return null;
}
return new Item(Id, DefinitionId, UserId, 0, new Vector3(), string.Empty, 0, Flags, Flags, Untradable, 0, 0,
ExpireTimestamp, WiredManager);
}