public static void Update(string query) { if (DlqMysql.IsReady) { try { DlqMysql.IsReady = false; int num; if (Core.MySQL_UTF8) { num = DlqMysql.mysql_query(DlqMysql.SQL, query); } else { num = DlqMysql.mysql_real_query(DlqMysql.SQL, query, query.Length); } if (DlqMysql.LogLevel > DlqMysql.LogLevelType.ERRORS) { Helper.LogSQL(query, false); } if (num != 0 || DlqMysql.ErrorCode != 0u) { if (DlqMysql.LogLevel > DlqMysql.LogLevelType.NONE) { Helper.LogSQLError(DlqMysql.Error(), true); } DlqMysql.mysql_ping(DlqMysql.SQL); DlqMysql.IsReady = true; return; } } catch (Exception ex) { Helper.LogSQLError(query, false); Helper.LogSQLError(ex.Message.ToString(), true); } DlqMysql.IsReady = true; } }
public static DlqMysql.Result Query(string query, bool skip = false) { DlqMysql.Result result = null; DlqMysql.Result result3; try { if (!DlqMysql.IsReady && skip) { DlqMysql.Result result2 = result; result3 = result2; return(result3); } DlqMysql.IsReady = false; int num; if (Core.MySQL_UTF8) { num = DlqMysql.mysql_query(DlqMysql.SQL, query); } else { num = DlqMysql.mysql_real_query(DlqMysql.SQL, query, query.Length); } if (num != 0 || DlqMysql.ErrorCode != 0u) { if (DlqMysql.LogLevel > DlqMysql.LogLevelType.NONE) { Helper.LogSQLError(DlqMysql.Error(), true); } DlqMysql.mysql_ping(DlqMysql.SQL); DlqMysql.IsReady = true; DlqMysql.Result result2 = null; result3 = result2; return(result3); } if (DlqMysql.LogLevel > DlqMysql.LogLevelType.ERRORS) { Helper.LogSQL(query, false); } IntPtr intPtr = DlqMysql.mysql_store_result(DlqMysql.SQL); if (DlqMysql.ErrorCode == 0u && !(intPtr == IntPtr.Zero)) { result = new DlqMysql.Result(); result.Fields = DlqMysql.mysql_num_fields(intPtr); result.Rows = DlqMysql.mysql_num_rows(intPtr); int num2 = 0; while ((long)num2 < (long)((ulong)result.Fields)) { result.Field.Add((DlqMysql.Field)Marshal.PtrToStructure(DlqMysql.mysql_fetch_field(intPtr), typeof(DlqMysql.Field))); num2++; } IntPtr value; while ((value = DlqMysql.mysql_fetch_row(intPtr)) != IntPtr.Zero) { result.Row.Add(new DlqMysql.Row(result, value)); } DlqMysql.mysql_free_result(intPtr); } else { result = null; } } catch (Exception ex) { result = null; Helper.LogSQLError(query, false); Helper.LogSQLError(ex.Message.ToString(), true); } DlqMysql.IsReady = true; result3 = result; return(result3); }