views:

42

answers:

1

This line of code

if (sqlite3_open(([databasePath UTF8String], &database) == SQLITE_OK) 

generates an error saying that there are too few arguments to sqlite3_open. How many arguments are required? How can this be fixed?

+2  A: 

You've got your brackets in not quite the right place - so you're calling sqlite3_open( ) with just one argument, the result of the 'is-equal' test.

This is probably closer:

if ( sqlite3_open( [databasePath UTF8String], &database ) == SQLITE_OK ) 

See also the docs for sqlite3_open( ) - there are three alternative signatures, accepting 2 or 4 args:

int sqlite3_open(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
int sqlite3_open_v2(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);
martin clayton