Execute() public méthode

public Execute ( ) : IEnumerable
Résultat IEnumerable
Exemple #1
0
        public static IEnumerable <Account> FindWithAddress(string address)
        {
            var cmd = new SqlCommand("SELECT * FROM rohbot.accounts WHERE address=:addr;");

            cmd["addr"] = address;
            return(cmd.Execute().Select(row => new Account(row)));
        }
Exemple #2
0
        public static IEnumerable <LoginToken> FindAll(string username)
        {
            var cmd = new SqlCommand("SELECT * FROM rohbot.logintokens WHERE lower(name)=lower(:name);");

            cmd["name"] = username;

            return(cmd.Execute().Select(row => new LoginToken(row)));
        }
Exemple #3
0
        public static IEnumerable <LoginToken> FindAll(long userId)
        {
            var cmd = new SqlCommand("SELECT * FROM rohbot.logintokens2 WHERE userid=:userid ORDER BY accessed DESC;");

            cmd["userid"] = userId;

            return(cmd.Execute().Select(row => new LoginToken(row)));
        }
Exemple #4
0
        public static Account Get(string username)
        {
            var cmd = new SqlCommand("SELECT * FROM rohbot.accounts WHERE lower(name)=lower(:name);");

            cmd["name"] = username;
            var row = cmd.Execute().FirstOrDefault();

            return(row == null ? null : new Account(row));
        }
Exemple #5
0
        public static LoginToken Find(long userId, string token)
        {
            var cmd = new SqlCommand("SELECT * FROM rohbot.logintokens2 WHERE userid=:userid AND token=:token;");

            cmd["userid"] = userId;
            cmd["token"]  = token;

            return(cmd.Execute().Select(row => new LoginToken(row)).SingleOrDefault());
        }
        public void InvalidateNotificationCache()
        {
            var cmd = new SqlCommand(@"
                SELECT notifications.*, accounts.name, accounts.rooms
                FROM rohbot.accounts
                INNER JOIN rohbot.notifications ON (rohbot.accounts.id = rohbot.notifications.userid)");

            var newNotifications = cmd.Execute().Select(row => new Notification(row)).ToList();

            lock (_sync)
            {
                _notifications = newNotifications;
            }
        }
 public void InvalidateNotificationCache()
 {
     var cmd = new SqlCommand("SELECT notifications.*, accounts.name, accounts.rooms FROM rohbot.accounts INNER JOIN rohbot.notifications ON (rohbot.accounts.id = rohbot.notifications.userid)");
     Notifications = cmd.Execute().Select(row => new Notification(row)).ToList();
 }