> The tokenizer appends a semicolon to the end of input if necessary. This ensures
> that every SQL statement is terminated by a semicolon.
> H41040: When the tokenizer reaches the end of input where the last token sent to
> the parser was not a SEMI token, it shall send a SEMI token to the parser.
http://www.sqlite.org/draft/tokenreq.html#H41040
ここに書かれている statementの diagramでは、最後の semicolonは不要となる!?
http://www.sqlite.org/syntaxdiagrams.html#sql-stmt-list
それに対し sqliteのコマンドラインでは、最後の semicolonは必要
http://www.sqlite.org/sqlite.html
--
な
2012/7/31 Yasuhiro Ito <yasuhiro...@gmail.com>
>
> SQLiteDatabaseクラスのrawQueryメソッドの引数sqlについてわからないことがあります。
> Android Developerのリファレンスを見ると引数sqlの説明は
>
> the SQL query. The SQL string must not be ; terminated
>
> と書いてあります。
> 英語には自信がないのですが、must not で禁止だから
> 「SQL文字列はセミコロンで終わってはいけない。」
> という意味だと思ってます。
>
>
> しかし、自分が持っている本や "android rawQuery" で検索で上位に
> 出てくる日本語のサイトのサンプルコードを見ると
> だいたいセミコロンで終わるSQL文を引数sqlにセットしています。
>
> 実際に試してみると
> db.rawQuery("SELECT * FROM SampleTable", null);
> と
> db.rawQuery("SELECT * FROM SampleTable;", null);
> はどちらも思ったように動くのですが、
> リファレンスに「セミコロン付けるな」と書いてあるのに、
> 本やWEBサイトの多くのサンプルコードにセミコロンが付いているのが
> なんだか気になります。
>
>
> 実際、どのように書くべきなんでしょうか?
>
> --
> このメールは Google グループのグループ「日本Androidの会」の登録者に送られています。
> このディスカッションをウェブ上で閲覧するには、https://groups.google.com/d/msg/android-group-japan/-/ttACROTq7-wJ にアクセスしてください。
> このグループに投稿するには、android-g...@googlegroups.com にメールを送信してください。
> このグループから退会するには、android-group-j...@googlegroups.com にメールを送信してください。
> 詳細については、http://groups.google.com/group/android-group-japan?hl=ja からこのグループにアクセスしてください。