2012-01-15 14 views
0

私は再作成できないアンドロイドマーケットでエラーが報告されました。エラーはAndroidのSQLiteエラー再作成できません

Caused by: android.database.sqlite.SQLiteException: near ".": syntax error: , while compiling: SELECT _id, Song, Number FROM HOLA. 
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 
at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91) 
at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64) 
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80) 
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:46) 
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42) 
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1454) 
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1338) 
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1293) 
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1373) 
at com.example.program.DBase.fetchData(DBase.java:89) 
at com.example.program.View.fillData(View.java:57) 
at com.example.program.View.onCreate(View.java:29) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
... 11 more 

です。HOLAはユーザーが入力した表です。私が使用するコードは

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getLoc(); 
    setContentView(R.layout.notepad_list); 
    db = new DBase(this); 
    db.open(); 
    fillData(); 
    db.close(); 

} 

private void fillData() { 
    // Get all of the notes from the database and create the item list 
    Cursor c = db.fetchData(loc); 
    startManagingCursor(c); 

    String[] from = new String[] { DBase.KEY_ONE, DBase.KEY_TWO }; 
    int[] to = new int[] { R.id.text1, R.id.text2 }; 

    // Now create an array adapter and set it to display using our row 
    SimpleCursorAdapter notes = new SimpleCursorAdapter(this, 
      R.layout.notes_row, c, from, to); 
    setListAdapter(notes); 

} 

最後に

public Cursor fetchData(String loc) { 
    // TODO Auto-generated method stub 

    return ourDatabase.query(loc, new String[] { KEY_ROWID, KEY_ONE, KEY_TWO }, 
      null, null, null, null, null); 
} 

あるLOCは、現在のテーブルに変数指しています。これがどうして起こるのか?私はaを含むデータを入力しようとしました。そして、エラーで言及された、しかし、私はFCを得ることができませんでした。私の追加テーブルコード

public long addTable(String loc) { 
    // TODO Auto-generated method stub 
    ourDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + loc + " (" 
      + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_2TBL 
      + " TEXT NOT NULL, " + KEY_TWO + " TEXT NOT NULL, " 
      + KEY_ONE + " TEXT NOT NULL);"); 
    ContentValues cv = new ContentValues(); 
    cv.put(KEY_2TBL, loc); 
    return ourDatabase.insert(loc, null, cv); 

} 
+0

私は外国語で私のダウンロードの約40%を持っている気づいた。テーブル名HOLAから、私はユーザーがスペイン語を使用していると推測しています。私のアプリはローカライズされていません。それが問題なのでしょうか? –

答えて

1

を追加

EDIT私はユーザーではなく、単に "HOLA" よりも "HOLA。"(ドット付き)が入っていると思います。それはアプリが与えた理由かもしれない

+0

それはそれでした!ユーザーがテーブル名に許可されていない文字を入力しないようにする方法はありますか?ユーザが入力したテーブルには、曲リストの「場所」が格納されます。私の投稿を編集して私のテーブルコードを追加する。 –

+1

あなたのテキストボックスにLoginFilterを追加し、許可されている文字に対してのみtrueを返すことができるisallowed関数を実装することができます – nandeesh

関連する問題