Core/Misc: Misc Fixes
This commit is contained in:
@@ -32,11 +32,17 @@ namespace Framework.Collections
|
||||
|
||||
public StringArray(string str, params string[] separator)
|
||||
{
|
||||
if (str.IsEmpty())
|
||||
return;
|
||||
|
||||
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public StringArray(string str, params char[] separator)
|
||||
{
|
||||
if (str.IsEmpty())
|
||||
return;
|
||||
|
||||
_str = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
@@ -51,7 +57,12 @@ namespace Framework.Collections
|
||||
return _str.GetEnumerator();
|
||||
}
|
||||
|
||||
public int Length { get { return _str.Length; } }
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return _str == null || _str.Length == 0;
|
||||
}
|
||||
|
||||
public int Length => _str.Length;
|
||||
|
||||
string[] _str;
|
||||
}
|
||||
|
||||
@@ -80,8 +80,6 @@ namespace Framework.Database
|
||||
// Populate and update only if updates are enabled for this pool
|
||||
_populate.Add(() =>
|
||||
{
|
||||
//Hack used to allow big querys
|
||||
database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
|
||||
if (!database.GetUpdater().Populate())
|
||||
{
|
||||
Log.outError(LogFilter.ServerLoading, $"Could not populate the {database.GetDatabaseName()} database, see log for details.");
|
||||
@@ -92,8 +90,6 @@ namespace Framework.Database
|
||||
|
||||
_update.Add(() =>
|
||||
{
|
||||
//Hack used to allow big querys
|
||||
database.Apply("SET GLOBAL max_allowed_packet=1073741824;");
|
||||
if (!database.GetUpdater().Update())
|
||||
{
|
||||
Log.outError(LogFilter.ServerLoading, $"Could not update the {database.GetDatabaseName()} database, see log for details.");
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Framework.Database
|
||||
public bool Populate()
|
||||
{
|
||||
SQLResult result = _database.Query("SHOW TABLES");
|
||||
if (!result.IsEmpty() && result.GetRowCount() > 0)
|
||||
if (!result.IsEmpty() && !result.IsEmpty())
|
||||
return true;
|
||||
|
||||
Log.outInfo(LogFilter.SqlUpdates, $"Database {_database.GetDatabaseName()} is empty, auto populating it...");
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Framework.Database
|
||||
if (!hasNext)
|
||||
return QueryCallbackStatus.Completed;
|
||||
|
||||
callback = _callbacks.Dequeue();
|
||||
callback = _callbacks.Peek();
|
||||
}
|
||||
else
|
||||
return QueryCallbackStatus.NotReady;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
|
||||
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
||||
<PackageReference Include="MySqlConnector" Version="0.40.4" />
|
||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user