Execute() public method

public Execute ( ) : IEnumerable
return IEnumerable
Example #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)));
        }
Example #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)));
        }
Example #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)));
        }
Example #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));
        }
Example #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());
        }
Example #6
0
        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;
            }
        }
Example #7
0
 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();
 }