private static GeneralRecordData LoadSingleTableFriendInfo(List<string> primaryKeys)
{
GeneralRecordData ret = null;
try {
using (MySqlCommand cmd = new MySqlCommand()) {
cmd.Connection = DBConn.MySqlConn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "LoadSingleTableFriendInfo";
if(primaryKeys.Count != 1)
throw new Exception("primary key number don't match !!!");
MySqlParameter inputParam;
inputParam = new MySqlParameter("@_Guid", MySqlDbType.UInt64);
inputParam.Direction = ParameterDirection.Input;
inputParam.Value = (ulong)Convert.ChangeType(primaryKeys[0],typeof(ulong));
cmd.Parameters.Add(inputParam);
using (DbDataReader reader = cmd.ExecuteReader()) {
if (reader.Read()) {
ret = new GeneralRecordData();
object val;
TableFriendInfo msg = new TableFriendInfo();
val = reader["Guid"];
msg.Guid = (ulong)val;
ret.PrimaryKeys.Add(val.ToString());
val = reader["UserGuid"];
msg.UserGuid = (ulong)val;
ret.ForeignKeys.Add(val.ToString());
val = reader["FriendGuid"];
msg.FriendGuid = (ulong)val;
val = reader["FriendNickname"];
msg.FriendNickname = (string)val;
val = reader["QQ"];
msg.QQ = (long)val;
val = reader["weixin"];
msg.weixin = (long)val;
val = reader["IsBlack"];
msg.IsBlack = (bool)val;
ret.DataVersion = (int)reader["DataVersion"];
ret.Data = DbDataSerializer.Encode(msg);
}
}
}
} catch (Exception ex) {
DBConn.Close();
throw ex;
}
return ret;
}