db.c
changeset 10 d07309450285
parent 7 e4f1a551d45c
child 13 23a242d7b7fa
equal deleted inserted replaced
9:bdf20e6eefd7 10:d07309450285
   104 		if ( sqlite3_exec( v.db, upgrade_sql, NULL, NULL, NULL ) != SQLITE_OK ) {
   104 		if ( sqlite3_exec( v.db, upgrade_sql, NULL, NULL, NULL ) != SQLITE_OK ) {
   105 			debug( 2, LOC, "Error %s database: %s\n",
   105 			debug( 2, LOC, "Error %s database: %s\n",
   106 					(i == 1 ? "initalizing" : "upgrading"), sqlite3_errmsg(v.db) );
   106 					(i == 1 ? "initalizing" : "upgrading"), sqlite3_errmsg(v.db) );
   107 			return( sqlite3_errcode(v.db) );
   107 			return( sqlite3_errcode(v.db) );
   108 		}
   108 		}
   109 		free( upgrade_sql );
   109 		free( upgrade_sql ), upgrade_sql = NULL;
   110 		upgrade_sql = NULL;
       
   111 
   110 
   112 		/* update version metadata in DB if update was successful */
   111 		/* update version metadata in DB if update was successful */
   113 		current_version = i;
   112 		current_version = i;
   114 		sprintf( user_pragma, "PRAGMA user_version = %hu;", current_version );
   113 		sprintf( user_pragma, "PRAGMA user_version = %hu;", current_version );
   115 		if ( sqlite3_exec( v.db, user_pragma, NULL, NULL, NULL ) != SQLITE_OK ) {
   114 		if ( sqlite3_exec( v.db, user_pragma, NULL, NULL, NULL ) != SQLITE_OK ) {