|
@@ -29,29 +29,10 @@ namespace HyperCube
|
|
|
}
|
|
|
|
|
|
public async Task<bool> IsConnect()
|
|
|
- {
|
|
|
-
|
|
|
+ {
|
|
|
string connstring = $"Server={Server}; database={DatabaseName}; UID={UserName}; password={Password}";
|
|
|
if (Connection != null)
|
|
|
- {
|
|
|
- //Console.WriteLine($"IsConnect {Connection.State}");
|
|
|
- //try
|
|
|
- //{
|
|
|
- await SQLSelectComplex("select COUNT(*) from accounts", false);
|
|
|
- // }
|
|
|
- // catch (Exception e)
|
|
|
- // {
|
|
|
- // Console.WriteLine("SQL Exception " + e.Message + "stack trace" + e.StackTrace);
|
|
|
- // Console.WriteLine($"catch SQL IsConnect making NEW Connection!");
|
|
|
- // Connection = new MySqlConnection(connstring);
|
|
|
- // Connection.Open();
|
|
|
- // }
|
|
|
- // //finally
|
|
|
- // //{
|
|
|
-
|
|
|
- // //}
|
|
|
- // Console.WriteLine($"SQL IsConnect state: {Connection.State}");
|
|
|
- }
|
|
|
+ await SQLSelectComplex("select COUNT(*) from accounts", false);
|
|
|
else
|
|
|
Console.WriteLine($"SQL IsConnect Connection null");
|
|
|
|
|
@@ -109,7 +90,6 @@ namespace HyperCube
|
|
|
//if (!rdr.IsDBNull(15))
|
|
|
// newacc.eth_address = rdr.GetString(15);
|
|
|
|
|
|
-
|
|
|
if (!accs.ContainsKey(newacc.UUID))
|
|
|
accs.Add(newacc.UUID, newacc);
|
|
|
newacc.bsel = rdr.GetByte(17);
|
|
@@ -249,7 +229,7 @@ namespace HyperCube
|
|
|
if (connected)
|
|
|
{
|
|
|
//Console.WriteLine($"SQLSelectComplex connected");
|
|
|
- List<Dictionary<string, object>> retval = new List<Dictionary<string, object>>();
|
|
|
+ List<Dictionary<string, object>> retval = new();
|
|
|
MySqlCommand SQLcom2 = new(request, Connection);
|
|
|
//Console.WriteLine($"SQLSelectComplex new SQLcom");
|
|
|
//try
|
|
@@ -259,7 +239,7 @@ namespace HyperCube
|
|
|
while (Reader.Read())
|
|
|
{
|
|
|
//Console.WriteLine($"SQLSelectComplex Reader.Read");
|
|
|
- Dictionary<string, object> data = new Dictionary<string, object>();
|
|
|
+ Dictionary<string, object> data = new();
|
|
|
|
|
|
for (int i = 0; i < Reader.FieldCount; i++)
|
|
|
{
|