Hello Team.

I have a problem with running SQLite.
I am running linux 2.6.17 on *ARM* and basically problem is that my 
application
is crushing on *sqlite3_open*()  function while the sqlite3 command 
shell is
running without problems.
I added the sqlite3.h file to my project.
/******************/
#include <stdio.h>
#include "sqlite3.h"

static int callback(void *NotUsed, int argc, char **argv, char
**azColName){
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  printf("\n");
  return 0;
}

int main(int argc, char **argv){
  sqlite3 *db;
  char *zErrMsg = 0;
  int rc;

  printf("Before Opened");
  rc = sqlite3_open("mydatabase.db", &db);
  printf("Opened");

  if( rc ){
    fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    exit(1);
  }

  rc = sqlite3_exec(db, "select *from Artists;", callback, 0, &zErrMsg);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "SQL error: %s\n", zErrMsg);
    sqlite3_free(zErrMsg);
  }
  sqlite3_close(db);
  return 0;
}
/******************/
NOTE: the same appplication compiled for linux PC is working fine.

Best regards
Leandro


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to