/// <summary> /// Retrieve the value as the given column index /// </summary> /// <param name="index">The column value to retrieve</param> /// <returns>The value as the given column</returns> public IMySqlValue this[int index] { get { if (rowIndex < 0) { throw new MySqlException(Resources.AttemptToAccessBeforeRead); } // keep count of how many columns we have left to access uaFieldsUsed[index] = true; if (isSequential && index != seqIndex) { if (index < seqIndex) { throw new MySqlException(Resources.ReadingPriorColumnUsingSeqAccess); } while (seqIndex < (index - 1)) { driver.SkipColumnValue(values[++seqIndex]); } values[index] = driver.ReadColumnValue(index, fields[index], values[index]); seqIndex = index; } return(values[index]); } }
public IMySqlValue this[int index] { get { if (this.rowIndex < 0) { throw new MySqlException(Resources.AttemptToAccessBeforeRead); } this.uaFieldsUsed[index] = true; if (this.isSequential && index != this.seqIndex) { if (index < this.seqIndex) { throw new MySqlException(Resources.ReadingPriorColumnUsingSeqAccess); } while (this.seqIndex < index - 1) { Driver arg_60_0 = this.driver; IMySqlValue[] arg_5F_0 = this.values; int num = this.seqIndex + 1; this.seqIndex = num; arg_60_0.SkipColumnValue(arg_5F_0[num]); } this.values[index] = this.driver.ReadColumnValue(index, this.fields[index], this.values[index]); this.seqIndex = index; } return(this.values[index]); } }
private IMySqlValue GetFieldValue(int index, bool checkNull) { if (index < 0 || index >= fields.Length) { throw new ArgumentException("You have specified an invalid column ordinal."); } if (!hasRead) { throw new MySqlException("Invalid attempt to access a field before calling Read()"); } // keep count of how many columns we have left to access this.uaFieldsUsed[index] = true; if ((this.commandBehavior & CommandBehavior.SequentialAccess) != 0 && index != seqIndex) { if (index < seqIndex) { throw new MySqlException("Invalid attempt to read a prior column using SequentialAccess"); } while (seqIndex < (index - 1)) { driver.SkipColumnValue(values[++seqIndex]); } values[index] = driver.ReadColumnValue(index, fields[index], values[index]); seqIndex = index; } IMySqlValue v = values[index]; if (checkNull && v.IsNull) { throw new SqlNullValueException(); } return(v); }