mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
#3: create account in SQL not in Python.
This commit is contained in:
parent
111a8c9b63
commit
c5d1fc3402
3 changed files with 57 additions and 1 deletions
|
@ -40,7 +40,8 @@ class Account:
|
|||
@classmethod
|
||||
def create(cls, db, name, currency, acctype):
|
||||
""" Constructor for new account """
|
||||
id = db.execute_and_fetch("INSERT INTO accounts (name, currency, acctype) VALUES (%s, %s, %s) RETURNING id", [name, currency.id, acctype])
|
||||
# id = db.execute_and_fetch("INSERT INTO accounts (name, currency, acctype) VALUES (%s, %s, %s) RETURNING id", [name, currency.id, acctype])
|
||||
id = db.execute_and_fetch("SELECT public.create_account(%s, %s, %s)", [name, currency.id, acctype])
|
||||
id = id[0]
|
||||
return cls(db, name = name, id = id, currency = currency, acctype = acctype)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue