// File: /workspace/github_cpp_makefile_star2_O2/eiskalteschatten[P]developersnotebook/src/models/AbstractSqliteModel.cpp
// Function: AbstractSqliteModel::select_query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void AbstractSqliteModel::select_query(std::string sql) {
    try {
        SqliteConnectionManager connection_manager;

        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) {
            tableRowMap 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)));
                row[column_name]        = column_text;
            }

            full_table.push_back(row);
        }

        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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %rdi
callq 0xf86c
movq 0x18(%rsp), %rdi
movq (%rbx), %rsi
pushq $-0x1
popq %rdx
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
callq 0x8a80
testl %eax, %eax
jne 0x125e1
movq %r14, 0x20(%rsp)
addq $0x40, %r14
leaq 0x78(%rsp), %r15
leaq 0x58(%rsp), %r12
leaq 0xf(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq 0x10(%rsp), %rdi
callq 0x8320
cmpl $0x64, %eax
jne 0x125b1
andl $0x0, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
callq 0x8db0
cmpl %eax, %ebx
jge 0x12599
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x8880
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xb078
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x8130
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0xb078
movq %rbp, %rdi
movq %r15, %rsi
callq 0x12e4c
movq %rax, %rdi
movq %r12, %rsi
callq 0x8f00
movq %r12, %rdi
callq 0x9120
movq %r15, %rdi
callq 0x9120
incl %ebx
jmp 0x1252d
movq %r14, %rdi
movq %rbp, %rsi
callq 0x12eb2
movq %rbp, %rdi
callq 0xe450
jmp 0x124f8
movq 0x10(%rsp), %rdi
callq 0x8b10
movq 0x20(%rsp), %rdi
movq (%rdi), %rax
callq *(%rax)
leaq 0x18(%rsp), %rdi
callq 0xf8c0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1f9a8(%rip), %rax     # 0x31f90
movq (%rax), %rbx
movq 0x18(%rsp), %rdi
callq 0x8ff0
leaq 0xff8a(%rip), %rsi      # 0x22586
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8250
jmp 0x124db
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12666
jmp 0x1261a
jmp 0x12630
movq %rdx, %rbx
movq %rax, %r14
jmp 0x1265c
jmp 0x12630
jmp 0x12626
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12648
jmp 0x12630
movq %rdx, %rbx
movq %rax, %r14
jmp 0x12652
movq %rdx, %rbx
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x9120
leaq 0x78(%rsp), %rdi
callq 0x9120
leaq 0x28(%rsp), %rdi
callq 0xe450
leaq 0x18(%rsp), %rdi
callq 0xf8c0
movq %r14, %rdi
cmpl $0x1, %ebx
jne 0x126a4
callq 0x8090
movq 0x1f916(%rip), %rcx     # 0x31f90
movq (%rcx), %rbx
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
leaq 0xff29(%rip), %rsi      # 0x225b6
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8250
callq 0x89d0
jmp 0x125cf
callq 0x87f0
nop