Skip to content

Commit

Permalink
Merge pull request #85 from KOSASIH/deepsource-transform-245b6848
Browse files Browse the repository at this point in the history
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
  • Loading branch information
KOSASIH authored May 10, 2024
2 parents c9d8ef4 + 1f0eaf4 commit 68a231e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions database/database.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import sqlite3


class Database:
def __init__(self):
self.connection = sqlite3.connect('banking.db')
self.connection = sqlite3.connect("banking.db")
self.cursor = self.connection.cursor()

def create_table(self):
self.cursor.execute('''CREATE TABLE IF NOT EXISTS accounts (id INTEGER PRIMARY KEY, name TEXT, balance REAL)''')
self.cursor.execute(
"""CREATE TABLE IF NOT EXISTS accounts (id INTEGER PRIMARY KEY, name TEXT, balance REAL)"""
)
self.connection.commit()

def insert_account(self, name, balance):
self.cursor.execute("INSERT INTO accounts (name, balance) VALUES (?, ?)", (name, balance))
self.cursor.execute(
"INSERT INTO accounts (name, balance) VALUES (?, ?)", (name, balance)
)
self.connection.commit()

def update_account(self, id, name, balance):
self.cursor.execute("UPDATE accounts SET name=?, balance=? WHERE id=?", (name, balance, id))
self.cursor.execute(
"UPDATE accounts SET name=?, balance=? WHERE id=?", (name, balance, id)
)
self.connection.commit()

def delete_account(self, id):
Expand Down

0 comments on commit 68a231e

Please sign in to comment.