ことの始まりは、つい先日 SourceForge.net の RSS から ADO.NET 2.0 Provider for SQLite が 1.0.42.0 から 1.0.43.0 にバージョンアップしたのを知ったので、早速バージョンアップしてみました。
インストールも特に問題なく完了。SQLite3.4かぁ。ふーん。
でもって、開発中のアプリのコーディングを再開してしばらくすると、不可解なエラーが。
色々調べてみると、SQLのMAX関数やCOUNT関数で件数とかをチェックしているロジックが機能しない。intで返ってくるはずのところがstringになっていたり。それで変換できないエラーとか起こっている。なんじゃこれ!
ウーン、特に手を入れてないのにな…、と、ふと DataSet.Designer.cs を直接除いてみると、なんかおかしい。ん?
なんで COUNT で件数返すだけなのに return が string なんだ??
とりあえず、ADO.NET 2.0 Provider for SQLiteのバージョンを1.0.42.0に戻してみると、ソースも元に戻る。ウーン、バグなんだろうか?それともこういう仕様なんだろうか?
とりあえず、時間も無いので、1.0.42.0で開発続行しました。
SQLite-1.0.42.0-binary.exe
-
// MAX() にて最大値を求めているクエリー
-
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
-
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
-
public virtual System.Nullable
ScalarQueryTest1(long xxx_id) { -
System.Data.SQLite.SQLiteCommand command = this.CommandCollection[6];
-
command.Parameters[0].Value = ((long)(xxx_id));
-
System.Data.ConnectionState previousConnectionState = command.Connection.State;
-
if (((command.Connection.State & System.Data.ConnectionState.Open)
-
!= System.Data.ConnectionState.Open)) {
-
command.Connection.Open();
-
}
-
object returnValue;
-
try {
-
returnValue = command.ExecuteScalar();
-
}
-
finally {
-
if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
-
command.Connection.Close();
-
}
-
}
-
if (((returnValue == null)
-
}
-
else {
-
}
-
}
-
// COUNT() にて最大値を求めているクエリー
-
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
-
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
-
public virtual System.Nullable
ScalarQueryTest2(long xxx_id) { -
System.Data.SQLite.SQLiteCommand command = this.CommandCollection[7];
-
command.Parameters[0].Value = ((long)(xxx_id));
-
System.Data.ConnectionState previousConnectionState = command.Connection.State;
-
if (((command.Connection.State & System.Data.ConnectionState.Open)
-
!= System.Data.ConnectionState.Open)) {
-
command.Connection.Open();
-
}
-
object returnValue;
-
try {
-
returnValue = command.ExecuteScalar();
-
}
-
finally {
-
if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
-
command.Connection.Close();
-
}
-
}
-
if (((returnValue == null)
-
}
-
else {
-
}
-
}
SQLite-1.0.43.0-binary.exe
-
// MAX() にて最大値を求めているクエリー
-
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
-
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
-
public virtual object ScalarQueryTest1(long xxx_id) {
-
System.Data.SQLite.SQLiteCommand command = this.CommandCollection[6];
-
command.Parameters[0].Value = ((long)(xxx_id));
-
System.Data.ConnectionState previousConnectionState = command.Connection.State;
-
if (((command.Connection.State & System.Data.ConnectionState.Open)
-
!= System.Data.ConnectionState.Open)) {
-
command.Connection.Open();
-
}
-
object returnValue;
-
try {
-
returnValue = command.ExecuteScalar();
-
}
-
finally {
-
if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
-
command.Connection.Close();
-
}
-
}
-
if (((returnValue == null)
-
return null;
-
}
-
else {
-
return ((object)(returnValue));
-
}
-
}
-
// COUNT() にて最大値を求めているクエリー
-
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
-
[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
-
public virtual string ScalarQueryTest2(long xxx_id) {
-
System.Data.SQLite.SQLiteCommand command = this.CommandCollection[7];
-
command.Parameters[0].Value = ((long)(xxx_id));
-
System.Data.ConnectionState previousConnectionState = command.Connection.State;
-
if (((command.Connection.State & System.Data.ConnectionState.Open)
-
!= System.Data.ConnectionState.Open)) {
-
command.Connection.Open();
-
}
-
object returnValue;
-
try {
-
returnValue = command.ExecuteScalar();
-
}
-


