Changed Exception catch types. Removed trying to insert to ID field

This commit is contained in:
Twitchy 2011-07-12 19:36:17 +12:00
parent 236cf6b42b
commit b74455433e
6 changed files with 27 additions and 28 deletions

View file

@ -62,7 +62,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -87,7 +87,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -108,7 +108,7 @@ namespace TShockAPI.DB
}
return true;
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -127,7 +127,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -144,7 +144,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}

View file

@ -88,7 +88,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -141,7 +141,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}

View file

@ -39,7 +39,7 @@ namespace TShockAPI.DB
com.ExecuteNonQuery();
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -56,7 +56,7 @@ namespace TShockAPI.DB
com.ExecuteNonQuery();
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -78,7 +78,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}

View file

@ -74,7 +74,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -94,7 +94,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -120,7 +120,7 @@ namespace TShockAPI.DB
return false;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
return false;
@ -162,7 +162,7 @@ namespace TShockAPI.DB
}
return false;
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
return false;
@ -223,7 +223,7 @@ namespace TShockAPI.DB
return false;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
return false;
@ -245,7 +245,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}

View file

@ -46,11 +46,10 @@ namespace TShockAPI.DB
com.ExecuteNonQuery();
if (TShock.Config.StorageType.ToLower() == "sqlite")
com.CommandText = "INSERT OR IGNORE INTO Users (ID, UserGroup, IP) VALUES (@id, @group, @ip);";
com.CommandText = "INSERT OR IGNORE INTO Users (UserGroup, IP) VALUES (@group, @ip);";
else if (TShock.Config.StorageType.ToLower() == "mysql")
com.CommandText = "INSERT IGNORE INTO Users (ID, UserGroup, IP) VALUES (@id, @group, @ip);";
com.CommandText = "INSERT IGNORE INTO Users (UserGroup, IP) VALUES (@group, @ip);";
com.AddParameter("@id", 1);
com.AddParameter("@ip", "127.0.0.1");
com.AddParameter("@group", "superadmin");
com.ExecuteNonQuery();
@ -86,7 +85,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
//Return code 0 (Add failed)
Log.Error(ex.ToString());
@ -121,7 +120,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
//Return code 0 (Remove failed)
Log.Error(ex.ToString());
@ -154,7 +153,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -183,7 +182,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -219,7 +218,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}

View file

@ -66,7 +66,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -86,7 +86,7 @@ namespace TShockAPI.DB
return true;
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -109,7 +109,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}
@ -131,7 +131,7 @@ namespace TShockAPI.DB
}
}
}
catch (SqliteExecutionException ex)
catch (Exception ex)
{
Log.Error(ex.ToString());
}