Пример #1
0
def markAllAsOld():
    conn = getConnection();
    c = conn.cursor();
    c.execute("update " + ShopTable.TABLE_NAME + " set " + ShopTable.COL_NEW + "  = 0");
    conn.commit();
    c.close();

def getNewItemCount():
    conn = getConnection();
    c = conn.cursor();
    c.execute("select * from " + ShopTable.TABLE_NAME + " where " + ShopTable.COL_NEW + " == 1")
    conn.commit();
    count = len(c.fetchall());
    c.close();
    return count;

if __name__ == '__main__':
    #createDb();
    s = Shop();
    s.city = "adfa";
    s.name = "lkj";
    s.province = "iiii";
    s.address = "j88j8j";
    success = insertShop(s);
    if success:
        print("inserted"); 
    else:
        print("duplicated");

    util.printTable();
Пример #2
0
              "  = 0")
    conn.commit()
    c.close()


def getNewItemCount():
    conn = getConnection()
    c = conn.cursor()
    c.execute("select * from " + ShopTable.TABLE_NAME + " where " +
              ShopTable.COL_NEW + " == 1")
    conn.commit()
    count = len(c.fetchall())
    c.close()
    return count


if __name__ == '__main__':
    #createDb();
    s = Shop()
    s.city = "adfa"
    s.name = "lkj"
    s.province = "iiii"
    s.address = "j88j8j"
    success = insertShop(s)
    if success:
        print("inserted")
    else:
        print("duplicated")

    util.printTable()