Return new server_id from Database.servers.add

This commit is contained in:
jesopo 2018-11-13 11:13:04 +00:00
parent 73c0c911d4
commit 8fc7a7652a
2 changed files with 5 additions and 2 deletions

View file

@ -17,6 +17,8 @@ class Servers(Table):
?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
[alias, hostname, port, password, tls, ipv4, bindhost, nickname, [alias, hostname, port, password, tls, ipv4, bindhost, nickname,
username, realname]) username, realname])
return self.database.execute_fetchone(
"SELECT server_id FROM servers ORDER BY server_id DESC LIMIT 1")[0]
def get_all(self): def get_all(self):
return self.database.execute_fetchall( return self.database.execute_fetchall(
"SELECT server_id, alias FROM servers") "SELECT server_id, alias FROM servers")

View file

@ -15,5 +15,6 @@ def add_server(database: Database.Database):
username = input("username: ") username = input("username: ")
realname = input("realname: ") realname = input("realname: ")
bindhost = input("bindhost?: ") bindhost = input("bindhost?: ")
database.servers.add(alias, hostname, port, password, ipv4, tls, bindhost, nickname, username, realname) admin = input("admin nickname: ")
id = database.servers.add(alias, hostname, port, password, ipv4, tls,
bindhost, nickname, username, realname)