Пример #1
0
 public Row(MySQL1.Result store, IntPtr value)
 {
     this.Record = new Dictionary <string, MySQL1.Record>();
     for (int i = 0; i < store.Field.Count; i++)
     {
         this.Record.Add(store.Field[i].Name, new MySQL1.Record(store.Field[i], this.GetRecord(value, i)));
     }
 }
Пример #2
0
 public SQLQuery(MySQL1.Result result, string query)
 {
     this.Query  = query;
     this.Result = result;
 }
Пример #3
0
 public static MySQL1.Result Query(string query, bool skip = false)
 {
     MySQL1.Result result = null;
     MySQL1.Result result3;
     try
     {
         if (!MySQL1.IsReady && skip)
         {
             MySQL1.Result result2 = result;
             result3 = result2;
             return(result3);
         }
         MySQL1.IsReady = false;
         int num;
         if (Core.MySQL_UTF8)
         {
             num = MySQL1.mysql_query(MySQL1.SQL, query);
         }
         else
         {
             num = MySQL1.mysql_real_query(MySQL1.SQL, query, query.Length);
         }
         if (num != 0 || MySQL1.ErrorCode != 0u)
         {
             if (MySQL1.LogLevel > MySQL1.LogLevelType.NONE)
             {
                 Helper.LogSQLError(MySQL1.Error(), true);
             }
             MySQL1.mysql_ping(MySQL1.SQL);
             MySQL1.IsReady = true;
             MySQL1.Result result2 = null;
             result3 = result2;
             return(result3);
         }
         if (MySQL1.LogLevel > MySQL1.LogLevelType.ERRORS)
         {
             Helper.LogSQL(query, false);
         }
         IntPtr intPtr = MySQL1.mysql_store_result(MySQL1.SQL);
         if (MySQL1.ErrorCode == 0u && !(intPtr == IntPtr.Zero))
         {
             result        = new MySQL1.Result();
             result.Fields = MySQL1.mysql_num_fields(intPtr);
             result.Rows   = MySQL1.mysql_num_rows(intPtr);
             int num2 = 0;
             while ((long)num2 < (long)((ulong)result.Fields))
             {
                 result.Field.Add((MySQL1.Field)Marshal.PtrToStructure(MySQL1.mysql_fetch_field(intPtr), typeof(MySQL1.Field)));
                 num2++;
             }
             IntPtr value;
             while ((value = MySQL1.mysql_fetch_row(intPtr)) != IntPtr.Zero)
             {
                 result.Row.Add(new MySQL1.Row(result, value));
             }
             MySQL1.mysql_free_result(intPtr);
         }
         else
         {
             result = null;
         }
     }
     catch (Exception ex)
     {
         result = null;
         Helper.LogSQLError(query, false);
         Helper.LogSQLError(ex.Message.ToString(), true);
     }
     MySQL1.IsReady = true;
     result3        = result;
     return(result3);
 }