//
// sub_10059C250 from 0x10059c250 to 0x10059c369 (281 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:32:31 +0000
//
int __fastcall sub_10059C250(char *filename)
{
sqlite3_stmt *v1; // rax
const char *v2; // rax
int v3; // ebx
int v4; // r14d
int v5; // r15d
int v6; // eax
int v7; // r14d
int v8; // ebx
sqlite3_stmt *v10; // [rsp-28h] [rbp-28h] BYREF
if ( !byte_100BE5728 )
{
v10 = v1;
v2 = ":memory:";
if ( filename )
v2 = filename;
v3 = sqlite3_open(v2, &db);
v4 = sqlite3_prepare_v2(db, "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);", -1, &v10, nullptr);
v5 = v4 | sqlite3_step(v10);
v6 = v5 | sqlite3_finalize(v10);
if ( v6 && v6 != 101 )
puts("Error in CREATE TABLE");
v7 = v3 | sqlite3_prepare_v2(db, "SELECT value FROM data WHERE key=?;", -1, &ppStmt, nullptr);
v8 = v7 | sqlite3_prepare_v2(db, "REPLACE INTO data (key, value) VALUES (?,?);", -1, &pStmt, nullptr);
LODWORD(v1) = v8 | sqlite3_prepare_v2(db, "DELETE FROM data WHERE key=?;", -1, &qword_100BE5748, nullptr);
if ( (_DWORD)v1 )
LODWORD(v1) = puts("Error initializing DB");
byte_100BE5728 = 1;
}
return (int)v1;
}