#include "sqlite3.h"
#if defined(CAFE) || defined(NN_PLATFORM_CTR)
#endif
static int Callback(void* arg, int columns, char** value, char** name) {
NLIB_UNUSED(arg);
for (int i = 0; i < columns; ++i) {
}
return 0;
}
NLIB_PATHMAPPER_FORSAMPLE
bool SampleMain(int, char**) {
InitPathMapperForSample();
char dbdir[1024];
g_pathmapper.ResolvePath(NULL, dbdir, "nlibpath:///readonly/");
sqlite3* db;
int result;
result = sqlite3_open("sample.db", &db);
if (result != SQLITE_OK) return false;
char* errmsg = NULL;
result = sqlite3_exec(db,
"SELECT * FROM t_menu",
Callback,
NULL,
&errmsg);
if (result != SQLITE_OK) {
sqlite3_free(errmsg);
sqlite3_close(db);
return false;
}
nlib_printf(
"> SELECT * FROM t_menu WHERE LIKE 't%%';\n");
result = sqlite3_exec(db,
"SELECT * FROM t_menu WHERE name LIKE 't%'",
Callback,
NULL,
&errmsg);
if (result != SQLITE_OK) {
sqlite3_free(errmsg);
sqlite3_close(db);
return false;
}
nlib_printf(
"> SELECT * FROM t_menu ORDER BY price ASC;\n");
result = sqlite3_exec(db,
"SELECT * FROM t_menu ORDER BY price ASC",
Callback,
NULL,
&errmsg);
if (result != SQLITE_OK) {
sqlite3_free(errmsg);
sqlite3_close(db);
return false;
}
sqlite3_close(db);
return true;
}
#if defined(CAFE) || defined(NN_PLATFORM_CTR)
#ifdef NLIB_HAS_VIRTUALMEMORY
extern "C" const NMallocSettings g_nmalloc_settings = { NULL, 1024 * 1024 * 16, 0 };
#else
const size_t heapmem_size = 1024 * 1024 * 16;
extern "C" const NMallocSettings g_nmalloc_settings = { heapmem, heapmem_size, 0 };
#endif
#endif
NLIB_MAINFUNC