[chronojump] fixed sqlite crash on db creation (thanks jordi)



commit 3214b7c84a171323ece0d580b17b34d31aad2488
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Mar 9 21:17:58 2011 +0100

    fixed sqlite crash on db creation (thanks jordi)

 src/sqlite/country.cs |    2 +-
 src/sqlite/event.cs   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/sqlite/country.cs b/src/sqlite/country.cs
index 26476d8..4dbaa4f 100644
--- a/src/sqlite/country.cs
+++ b/src/sqlite/country.cs
@@ -79,7 +79,7 @@ class SqliteCountry : Sqlite
 		//http://stackoverflow.com/questions/4341178/getting-the-last-insert-id-with-sqlite-net-in-c
 		myString = @"select last_insert_rowid()";
 		dbcmd.CommandText = myString;
-		int myLast = (int)dbcmd.ExecuteScalar(); // Need to type-cast since `ExecuteScalar` returns an object.
+		int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since `ExecuteScalar` returns an object.
 
 		if(! dbconOpened)
 			dbcon.Close();
diff --git a/src/sqlite/event.cs b/src/sqlite/event.cs
index 02a7c96..999394b 100644
--- a/src/sqlite/event.cs
+++ b/src/sqlite/event.cs
@@ -61,7 +61,7 @@ class SqliteEvent : Sqlite
 		//http://stackoverflow.com/questions/4341178/getting-the-last-insert-id-with-sqlite-net-in-c
 		string myString = @"select last_insert_rowid()";
 		dbcmd.CommandText = myString;
-		int myLast = (int)dbcmd.ExecuteScalar(); // Need to type-cast since `ExecuteScalar` returns an object.
+		int myLast = Convert.ToInt32(dbcmd.ExecuteScalar()); // Need to type-cast since `ExecuteScalar` returns an object.
 		if(! dbconOpened) {
 			dbcon.Close();
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]