// File: eiskalteschatten[P]developersnotebook/src/models/AbstractSqliteModel.cpp
// Function: AbstractSqliteModel::select_one()
void AbstractSqliteModel::select_one() {
    try {
        SqliteConnectionManager connection_manager;

        std::string sql = "SELECT * FROM " + table_schema->table_name + " WHERE ID=" + std::to_string(id) + ";";
        int connection;
        sqlite3_stmt *stmt;

        connection = sqlite3_prepare_v2(connection_manager.get_db(), sql.c_str(), -1, &stmt, NULL);

        if(connection != SQLITE_OK) {
            fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(connection_manager.get_db()));
        }

        while ((connection = sqlite3_step(stmt)) == SQLITE_ROW) {
            for (int i = 0; i < sqlite3_column_count(stmt); i++) {
                std::string column_name = std::string(reinterpret_cast<const char*>(sqlite3_column_name(stmt, i)));
                std::string column_text = std::string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, i)));
                contents[column_name]   = column_text;
            }

            break; // We only want one row. There should only be one with the id, but just be sure.
        }

        sqlite3_finalize(stmt);

        fill_model();
    }
    catch(const std::exception& e) {
        fprintf(stderr, "An exception occured while trying to set up the database: %s\n", e.what());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x1cc70
jmp 0x227d5
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x3139f(%rip), %rsi     # 0x53b86
leaq -0xa0(%rbp), %rdi
callq 0x110c0
jmp 0x227f5
leaq 0x31399(%rip), %rdx     # 0x53b95
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x10eb0
jmp 0x2280e
movq -0x138(%rbp), %rax
movl 0x58(%rax), %esi
leaq -0xc0(%rbp), %rdi
callq 0x19050
jmp 0x22826
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x23350
jmp 0x2283c
leaq 0x30f71(%rip), %rdx     # 0x537b4
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x10eb0
jmp 0x22852
leaq -0x60(%rbp), %rdi
callq 0xb430
leaq -0xc0(%rbp), %rdi
callq 0xb430
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0xa0(%rbp), %rdi
callq 0xb430
leaq -0x10(%rbp), %rdi
callq 0x1d940
movq %rax, -0x140(%rbp)
jmp 0x2288e
leaq -0x40(%rbp), %rdi
callq 0xa1d0
movq -0x140(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %r8d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0xd0(%rbp), %rcx
callq 0xacb0
movl %eax, -0x144(%rbp)
jmp 0x228bf
movl -0x144(%rbp), %eax
movl %eax, -0xc4(%rbp)
cmpl $0x0, -0xc4(%rbp)
je 0x229c9
movq 0x526a1(%rip), %rax     # 0x74f80
movq (%rax), %rax
movq %rax, -0x158(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x1d940
movq %rax, -0x150(%rbp)
jmp 0x228fb
movq -0x150(%rbp), %rdi
callq 0xb2e0
movq %rax, -0x160(%rbp)
jmp 0x22910
movq -0x160(%rbp), %rdx
movq -0x158(%rbp), %rdi
leaq 0x30e91(%rip), %rsi     # 0x537b6
movb $0x0, %al
callq 0xa320
jmp 0x229c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x22bf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x22be8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x229a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x2299e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x22992
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xb430
leaq -0xc0(%rbp), %rdi
callq 0xb430
leaq -0x80(%rbp), %rdi
callq 0xb430
leaq -0xa0(%rbp), %rdi
callq 0xb430
jmp 0x22be8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x22bdf
jmp 0x229cb
movq -0xd0(%rbp), %rdi
callq 0xa440
movl %eax, -0x164(%rbp)
jmp 0x229df
movl -0x164(%rbp), %eax
movl %eax, -0xc4(%rbp)
cmpl $0x64, %eax
jne 0x22bac
movl $0x0, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x16c(%rbp)
movq -0xd0(%rbp), %rdi
callq 0xb060
movl %eax, -0x168(%rbp)
jmp 0x22a1e
movl -0x16c(%rbp), %eax
movl -0x168(%rbp), %ecx
cmpl %ecx, %eax
jge 0x22baa
movq -0xd0(%rbp), %rdi
movl -0xd4(%rbp), %esi
callq 0xaaa0
movq %rax, -0x178(%rbp)
jmp 0x22a4d
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0xaf80
movq -0x178(%rbp), %rsi
movq -0x180(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x10f00
jmp 0x22a7c
leaq -0xf9(%rbp), %rdi
callq 0xb410
movq -0xd0(%rbp), %rdi
movl -0xd4(%rbp), %esi
callq 0xa150
movq %rax, -0x188(%rbp)
jmp 0x22aa3
leaq -0x121(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0xaf80
movq -0x188(%rbp), %rsi
movq -0x190(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0x10f00
jmp 0x22ad2
leaq -0x121(%rbp), %rdi
callq 0xb410
movq -0x138(%rbp), %rdi
addq $0x10, %rdi
leaq -0xf8(%rbp), %rsi
callq 0x23420
movq %rax, -0x198(%rbp)
jmp 0x22afe
movq -0x198(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xb240
jmp 0x22b13
leaq -0x120(%rbp), %rdi
callq 0xb430
leaq -0xf8(%rbp), %rdi
callq 0xb430
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x229fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xf9(%rbp), %rdi
callq 0xb410
jmp 0x22bdf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x22b9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x121(%rbp), %rdi
callq 0xb410
jmp 0x22b9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xb430
leaq -0xf8(%rbp), %rdi
callq 0xb430
jmp 0x22bdf
jmp 0x22bac
movq -0xd0(%rbp), %rdi
callq 0xad50
jmp 0x22bba
movq -0x138(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x22bcb
leaq -0x40(%rbp), %rdi
callq 0xb430
leaq -0x10(%rbp), %rdi
callq 0x1ccf0
jmp 0x22c48
leaq -0x40(%rbp), %rdi
callq 0xb430
leaq -0x10(%rbp), %rdi
callq 0x1ccf0
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x22c51
movq -0x18(%rbp), %rdi
callq 0xa0b0
movq %rax, -0x130(%rbp)
movq 0x5236c(%rip), %rax     # 0x74f80
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
movq -0x130(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x1a0(%rbp), %rdi
movq %rax, %rdx
leaq 0x30baa(%rip), %rsi     # 0x537e6
movb $0x0, %al
callq 0xa320
callq 0xac00
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0xaa00
nopw (%rax,%rax)