private static GeneralRecordData LoadSingleTableAccount(List<string> primaryKeys)
{
GeneralRecordData ret = null;
try {
using (MySqlCommand cmd = new MySqlCommand()) {
cmd.Connection = DBConn.MySqlConn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "LoadSingleTableAccount";
if(primaryKeys.Count != 1)
throw new Exception("primary key number don't match !!!");
MySqlParameter inputParam;
inputParam = new MySqlParameter("@_AccountId", MySqlDbType.VarChar);
inputParam.Direction = ParameterDirection.Input;
inputParam.Value = primaryKeys[0];
inputParam.Size = 64;
cmd.Parameters.Add(inputParam);
using (DbDataReader reader = cmd.ExecuteReader()) {
if (reader.Read()) {
ret = new GeneralRecordData();
object val;
TableAccount msg = new TableAccount();
val = reader["AccountId"];
msg.AccountId = (string)val;
ret.PrimaryKeys.Add(val.ToString());
val = reader["IsBanned"];
msg.IsBanned = (bool)val;
val = reader["UserGuid"];
msg.UserGuid = (ulong)val;
val = reader["IsValid"];
msg.IsValid = (bool)val;
ret.DataVersion = (int)reader["DataVersion"];
ret.Data = DbDataSerializer.Encode(msg);
}
}
}
} catch (Exception ex) {
DBConn.Close();
throw ex;
}
return ret;
}