// File: /workspace/github_cpp_makefile_star2_O2/eiskalteschatten[P]developersnotebook/src/models/AbstractSqliteModel.cpp
// Function: AbstractSqliteModel::abstract_save_all()
void AbstractSqliteModel::abstract_save_all() {
    try {
        if (!id) {
            insert_new_row();
        }

        std::string set = "";

        for (auto const &column : contents) {
            set.append(column.first);
            set.append("=\"");
            set.append(text_escape(column.second));
            set.append("\",");
        }

        if (set != "") {
            set = set.substr(0, set.size()-1); // Remove the dangling comma

            SqliteConnectionManager connection_manager;

            char *error_message = 0;
            int connection;
            std::string sql = "UPDATE " + table_schema->table_name +
                              " SET " + set +
                              " WHERE id=" + std::to_string(id) + ";";

            connection = sqlite3_exec(connection_manager.get_db(), sql.c_str(), NULL, 0, &error_message);

            if(connection != SQLITE_OK) {
                fprintf(stderr, "SQL error: %s\n", error_message);
                sqlite3_free(error_message);
            }
        }
        else {
            fprintf(stderr, "There are no contents to save!");
        }
    }
    catch(const std::exception& e) {
        fprintf(stderr, "An exception occured while trying to save to the database: %s\n", e.what());
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
cmpl $0x0, 0x58(%rdi)
jne 0x12a16
movq %rbx, %rdi
callq 0x11982
leaq 0xff48(%rip), %rsi      # 0x22965
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xb078
movq 0x28(%rbx), %r12
movq %rbx, 0x30(%rsp)
leaq 0x18(%rbx), %r15
leaq 0x38(%rsp), %r14
leaq 0x118(%rsp), %r13
leaq 0x10(%rsp), %rbp
leaq 0xfe91(%rip), %rbx      # 0x228e3
cmpq %r15, %r12
je 0x12abe
leaq 0x20(%r12), %rsi
movq %r14, %rdi
callq 0x8bc0
movq %r14, %rdi
leaq 0xfe72(%rip), %rsi      # 0x228e0
callq 0x8830
leaq 0x40(%r12), %rsi
movq %r13, %rdi
callq 0x86e0
movq %rbp, %rdi
movq %r13, %rdx
callq 0x1217a
movq %r14, %rdi
movq %rbp, %rsi
callq 0x8bc0
movq %rbp, %rdi
callq 0x9120
movq %r13, %rdi
callq 0x9120
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8830
movq %r12, %rdi
callq 0x8d00
movq %rax, %r12
jmp 0x12a52
leaq 0xfea0(%rip), %rsi      # 0x22965
leaq 0x38(%rsp), %rdi
callq 0xe2ea
testb %al, %al
je 0x12c53
leaq 0x38(%rsp), %rsi
movq 0x8(%rsi), %rcx
decq %rcx
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x8d30
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x8660
movq %rbx, %rdi
callq 0x9120
leaq 0x8(%rsp), %rdi
callq 0xf86c
andq $0x0, (%rsp)
movq 0x30(%rsp), %rbx
movq 0x8(%rbx), %rdx
leaq 0xfcfc(%rip), %rsi      # 0x22824
leaq 0x78(%rsp), %rdi
callq 0xb117
leaq 0xfcf3(%rip), %rdx      # 0x2282c
leaq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xb059
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0xbabb
leaq 0xfccb(%rip), %rdx      # 0x22837
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xb059
movl 0x58(%rbx), %esi
leaq 0x58(%rsp), %rdi
callq 0xe22b
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x12de5
leaq 0xf9d5(%rip), %rdx      # 0x22584
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xb059
leaq 0xf8(%rsp), %rdi
callq 0x9120
leaq 0x58(%rsp), %rdi
callq 0x9120
leaq 0xd8(%rsp), %rdi
callq 0x9120
leaq 0xb8(%rsp), %rdi
callq 0x9120
leaq 0x98(%rsp), %rdi
callq 0x9120
leaq 0x78(%rsp), %rdi
callq 0x9120
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rsp, %r8
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x80c0
testl %eax, %eax
jne 0x12c71
leaq 0x10(%rsp), %rdi
callq 0x9120
leaq 0x8(%rsp), %rdi
callq 0xf8c0
leaq 0x38(%rsp), %rdi
callq 0x9120
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1f336(%rip), %rax     # 0x31f90
movq (%rax), %rcx
leaq 0xfc82(%rip), %rdi      # 0x228e6
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x8e70
jmp 0x12c37
movq 0x1f318(%rip), %rax     # 0x31f90
movq (%rax), %rdi
movq (%rsp), %rdx
leaq 0xf900(%rip), %rsi      # 0x22586
xorl %eax, %eax
callq 0x8250
movq (%rsp), %rdi
callq 0x9060
jmp 0x12c23
jmp 0x12d3a
movq %rdx, %rbx
movq %rax, %r14
leaq 0xf8(%rsp), %rdi
callq 0x9120
jmp 0x12cb8
movq %rdx, %rbx
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x9120
jmp 0x12cca
movq %rdx, %rbx
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
callq 0x9120
jmp 0x12cdf
movq %rdx, %rbx
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0x9120
jmp 0x12cf4
movq %rdx, %rbx
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x9120
leaq 0x78(%rsp), %rdi
callq 0x9120
leaq 0x8(%rsp), %rdi
callq 0xf8c0
jmp 0x12d71
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12d01
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12d0b
jmp 0x12d6b
jmp 0x12d6b
movq %rdx, %rbx
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x12d06
jmp 0x12d6b
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12d7b
movq %rdx, %rbx
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x9120
jmp 0x12d5c
jmp 0x12d6b
movq %rdx, %rbx
movq %rax, %r14
leaq 0x118(%rsp), %rdi
callq 0x9120
jmp 0x12d71
movq %rdx, %rbx
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x9120
movq %r14, %rdi
cmpl $0x1, %ebx
jne 0x12db9
callq 0x8090
movq 0x1f201(%rip), %rcx     # 0x31f90
movq (%rcx), %rbx
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
leaq 0xfa43(%rip), %rsi      # 0x227e5
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8250
callq 0x89d0
jmp 0x12c41
callq 0x87f0