android.database.sqlite.SQLiteException:靠近“,”:语法错误(代码 1):,编译时

android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling

android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling: SELECT id, title, tagline, overview, release_date, vote_average, popularity, posterPath, runtime, genres, cast, crew, follow, notified FROM MoviesNowPlaying

.

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {

    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();

    switch (uriMatcher.match(uri)) {
        case uriCodeNowPlaying:
            queryBuilder.setTables(MoviesSchema.MoviesNowPlaying.TABLE_NAME);
            break;

        case uriCodeUpComing:
            queryBuilder.setTables(MoviesSchema.MoviesUpComing.TABLE_NAME);
            break;

        case uriCodePopular:
            queryBuilder.setTables(MoviesSchema.MoviesPopular.TABLE_NAME);
            break;
      default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }

    Cursor cursor = queryBuilder.query(sqlDB, projection, selection, selectionArgs, null, null, sortOrder);

    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
}

.

static interface MoviesNowPlaying {

    String TABLE_NAME = "MoviesNowPlaying";

    String CREATE_DB_TABLE = " CREATE TABLE IF NOT EXISTS " + TABLE_NAME
            + "(" + id + " INTEGER PRIMARY KEY, "
            + title + " TEXT, "
            + tagline + " TEXT, "
            + overview + " TEXT, "
            + release_date + " TEXT, "
            + vote_average + " REAL, "
            + popularity + " REAL, "
            + poster_path + " TEXT, "
            + runtime + " INTEGER, "
            + genres + " TEXT, "
            + cast + " TEXT, "
            + crew + " TEXT, "
            + follow + " INTEGER, "
            + notified + " INTEGER );";

}


public static Cursor getMovies(Uri uri, Context context){

    String[] projection = new String[]{MoviesSchema.id, MoviesSchema.title, MoviesSchema.tagline,
            MoviesSchema.overview, MoviesSchema.release_date, MoviesSchema.vote_average,
            MoviesSchema.popularity, MoviesSchema.poster_path, MoviesSchema.runtime,
            MoviesSchema.genres, MoviesSchema.cast, MoviesSchema.crew,
            MoviesSchema.follow, MoviesSchema.notified};

    return context.getContentResolver().query(uri, projection, null, null,null);
}

CAST 是一个 sqlite keyword。您需要更改列的名称。