Exemplo n.º 1
0
def add_thumb_up(info_id):
    connection = sqlite3.connect(get_db_path.db_path())
    cursor = connection.cursor()
    cursor.execute("""UPDATE wishes SET thumb_up=thumb_up+1 WHERE id=?""",
                   (info_id, ))
    connection.commit()
    connection.close()
Exemplo n.º 2
0
def add_wish(name, title, wish, contact_info, ctime=time.localtime(), thumb_up = 0):
  format_time = time.strftime('%Y-%m-%d %H:%M:%S',ctime)
  connection = sqlite3.connect(get_db_path.db_path())
  cursor = connection.cursor()
  cursor.execute("""INSERT INTO wishes(title, name, wish, contact_info, time, thumb_up)
    VALUES (?,?,?,?,?,?)""", (title, name, wish, contact_info, format_time, thumb_up))
  connection.commit()
  connection.close()
Exemplo n.º 3
0
def add_wish(name,
             title,
             wish,
             contact_info,
             ctime=time.localtime(),
             thumb_up=0):
    format_time = time.strftime('%Y-%m-%d %H:%M:%S', ctime)
    connection = sqlite3.connect(get_db_path.db_path())
    cursor = connection.cursor()
    cursor.execute(
        """INSERT INTO wishes(title, name, wish, contact_info, time, thumb_up)
    VALUES (?,?,?,?,?,?)""",
        (title, name, wish, contact_info, format_time, thumb_up))
    connection.commit()
    connection.close()
Exemplo n.º 4
0
def add_thumb_up(info_id):
    connection = sqlite3.connect(get_db_path.db_path())
    cursor = connection.cursor()
    cursor.execute("""UPDATE wishes SET thumb_up=thumb_up+1 WHERE id=?""", (info_id,))
    connection.commit()
    connection.close()
Exemplo n.º 5
0
#!/usr/bin/python3
import sqlite3
import sys, os
import get_db_path


def cur_file_dir():
    path = sys.path[0]
    if os.path.isdir(path):
        return path
    elif os.path.isfile(path):
        return os.path.dirname(path)


db_name = get_db_path.db_path()


def get_wishes_from_store():
    connection = sqlite3.connect(db_name)
    cursor = connection.cursor()
    results = cursor.execute("""SELECT * FROM wishes""")
    response = results.fetchall()
    connection.close()
    return (response)
Exemplo n.º 6
0
#!/usr/bin/python3
import sqlite3
import sys,os
import get_db_path

def cur_file_dir():
    path = sys.path[0]
    if os.path.isdir(path):
        return path
    elif os.path.isfile(path):
        return os.path.dirname(path)

db_name = get_db_path.db_path()

def get_wishes_from_store():
    connection = sqlite3.connect(db_name)
    cursor = connection.cursor()
    results = cursor.execute("""SELECT * FROM wishes""")
    response = results.fetchall()
    connection.close()
    return(response)
Exemplo n.º 7
0
#!/usr/bin/python3
import os
import sqlite3
import get_db_path

connection = sqlite3.connect(get_db_path.db_path())

cursor = connection.cursor()
cursor.execute("""CREATE TABLE wishes(
                    id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL,
                    name TEXT,
                    title TEXT,
                    wish TEXT NOT NULL,
                    contact_info NOT NULL,
                    time DATETIME NOT NULL,
                    thumb_up INTEGER NOT NULL)""")
connection.commit()
connection.close()