Beispiel #1
0
        public static object ExecuteSqlScalar(Query command)
        {
            EnsureConnected();

            command.Command.Connection = m_sqlConnection;

            return command.Command.ExecuteScalar();
        }
Beispiel #2
0
        public static void ExecuteSql(Query command, SqlCallback callback)
        {
            EnsureConnected();

            command.Command.Connection = m_sqlConnection;

            var reader = command.Command.ExecuteReader();

            callback(reader);

            reader.Close();
        }
Beispiel #3
0
        private List<RaidSignup> ReadAllHelper(Query query)
        {
            var newList = new List<RaidSignup>();

            using (new ReaderLock(_lock))
            {
                Connection.ExecuteSql(query, delegate(SqlDataReader reader)
                    {
                        while (reader.Read())
                        {
                            var newRaidSignup = new RaidSignup
                            {
                                RaidInstanceID = (int)reader[0],
                                Character = reader[1].ToString(),
                                Comment = reader[2].ToString(),
                                IsRostered = (bool)reader[3],
                                IsCancelled = (bool)reader[4],
                                RosteredSpecialization = (int)reader[5],
                                SignupDate = (DateTime)reader[6]
                            };

                            newList.Add(newRaidSignup);
                        }
                    });
            }

            return newList.Count > 0 ? newList : null;
        }