示例#1
0
def save_transaction(t):

    global db
    db.execute(
        'insert into transactions (date, payer, amount, memo, payee) values (?, ?, ?, ?, ?)',
        (format_tran_date_for_db(t.date), t.payer, t.amount, t.memo, t.payee))
    db.commit()
示例#2
0
def save_transaction(t):

    global db
    db.execute('insert into transactions (date, payer, amount, memo, payee) values (?, ?, ?, ?, ?)',
               (
                format_tran_date_for_db(t.date),
                t.payer,
                t.amount,
                t.memo,
                t.payee
               )
              )
    db.commit()
示例#3
0
def is_transaction_in_db(t):

    global db
    cur = db.execute(
        '''
                     select * from transactions where
                        date = ?
                        and payer = ?
                        and amount = ?
                        and memo = ?
                        and payee = ?
                     ''',
        (format_tran_date_for_db(t.date), t.payer, t.amount, t.memo, t.payee))

    row = cur.fetchall()
    if not row:
        return False

    return True
示例#4
0
def is_transaction_in_db(t):

    global db
    cur = db.execute('''
                     select * from transactions where
                        date = ?
                        and payer = ?
                        and amount = ?
                        and memo = ?
                        and payee = ?
                     ''',
                     (format_tran_date_for_db(t.date),
                      t.payer,
                      t.amount,
                      t.memo,
                      t.payee))

    row = cur.fetchall()
    if not row:
        return False

    return True