Ejemplo n.º 1
0
def messageGetAll():
    cursor.execute('SELECT * FROM message')
    message = cursor.fetchall()
    return message
Ejemplo n.º 2
0
def searchGetUserResults(search, user_id):
    cursor.execute(
        "SELECT * FROM users WHERE (nickname LIKE %s OR email LIKE %s) AND user_id != %s;",
        (search, search, user_id))
    users = cursor.fetchall()
    return users
Ejemplo n.º 3
0
def userGetAll():
    cursor.execute("SELECT * FROM users")
    users = cursor.fetchall()
    return users
Ejemplo n.º 4
0
def relationByFollowerId(follower_id):
    cursor.execute('SELECT * FROM relation where follower_id = %s',
                   (follower_id, ))
    rs = cursor.fetchall()
    return rs
Ejemplo n.º 5
0
def relationGetFollowingUserByFollowerId(follower_id):
    cursor.execute(
        "SELECT * FROM relation, users WHERE user_id = following_id AND follower_id = %s;",
        (follower_id, ))
    followings = cursor.fetchall()
    return followings
Ejemplo n.º 6
0
def commentByMsgIdOrder(msg_id):
    cursor.execute(
        "SELECT * FROM comment where msg_id = %s ORDER BY c_time ASC;",
        (msg_id, ))
    cs = cursor.fetchall()
    return cs
Ejemplo n.º 7
0
def likeMsgGetAll():
    cursor.execute('SELECT * FROM like_msg')
    message = cursor.fetchall()
    return message
Ejemplo n.º 8
0
def commentGetAll():
    cursor.execute('SELECT * FROM comment')
    message = cursor.fetchall()
    return message
Ejemplo n.º 9
0
def messageGetAllFromUserId(user_id):
    cursor.execute('SELECT * FROM message WHERE user_id = %s;', (user_id, ))
    message = cursor.fetchall()
    return message
Ejemplo n.º 10
0
def messageGetAllFromManyUserIdOrder(tuple_list_user_id):
    cursor.execute(
        'SELECT * FROM message where user_id IN %s ORDER BY c_time DESC',
        (tuple_list_user_id, ))
    m = cursor.fetchall()
    return m
Ejemplo n.º 11
0
def messageGetAllFromUserIdOrder(user_id):
    cursor.execute(
        'SELECT * FROM message where user_id = %s ORDER BY c_time DESC',
        (user_id, ))
    m = cursor.fetchall()
    return m
Ejemplo n.º 12
0
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, redirect, request,\
    url_for, session, flash
from helpers import conn, cursor

user_id = 5
cursor.execute('SELECT * FROM message where user_id = %s ORDER BY c_time DESC',
               (user_id, ))
m = cursor.fetchall()
messages = list(m)
for i, message in enumerate(messages):
    message = list(message)
    message.append("nickname")
    messages[i] = message
    print(message)

print(messages)