SQLite3 compilation:

Install libsqlite3-dev file

cd /usr/lib/
wget -O  libsqlite3.a https://www.dropbox.com/s/bdbtxyhpbkor2zi/libsqlite3.a?dl=0 --no-check-certificate
cd /usr/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/include/
wget -O sqlite3.h https://www.dropbox.com/s/naatzfv04x5e63h/sqlite3.h?dl=0  --no-check-certificate

Install libsqlite3 and userspace file:

opkg update
opkg install sqlite3-cli
opkg install libsqlite3
nano /mnt/sda1/opendb.c
#include <stdio.h>
#include <sqlite3.h> 
#include <stdlib.h>
int main(int argc, char* argv[])
{
   sqlite3 *db;
   char *zErrMsg = 0;
   int rc;
   rc = sqlite3_open("test.db", &db);
   if( rc ){
      fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
      exit(0);
   }else{
      fprintf(stderr, "Opened database successfully\n");
   }
   sqlite3_close(db);
}
cd /mnt/sda1
gcc -o opendb opendb.c -lsqlite3 -ldl -lpthread
root@Arduino:/mnt/sda1# ./opendb
Opened database successfully

Comments powered by CComment