|
hi, i created an acces c/c++ application projectused template (basic application) then i set the target (alp-simulator)
this is my appmain.C
/*! * @file appmain.c * * @brief Basic Application with just the entrypoint defined. */
#include <stdio.h> #include <sqlite3.h> #include <sqlite3ext.h>
#ifdef __cplusplus extern "C" #endif
static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; for(i=0; i<argc; i++){ printf("%s = %sn", azColName[i], argv[i] ? argv[i] : "NULL"); } printf("n"); return 0; }
int alp_main(int argc, char *argv[]) { sqlite3 *db; char *zErrMsg = 0; int rc;
if( argc!=3 ) { fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENTn", argv[0]); exit(1); } rc = sqlite3_open("base", &db); if( rc ){ fprintf(stderr, "Can't open database: %sn", sqlite3_errmsg(db)); sqlite3_close(db); exit(1); } rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg); if( rc!=SQLITE_OK ) { fprintf(stderr, "SQL error: %sn", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(db); printf("BasicAppn"); return 0; }
and this is my makefile
include make/defs.mk
SOURCES = appmain.c RESOURCES = appicon.png DEFINES = INCLUDES = LIBRARIES = alp_appmgr alp_bundlemgr alp_ui PACKAGES = alp sqlite3
include make/rules.mk
|