private void OpenReader() { if (this.m_dr == null) { PDO.PDO_CURSOR cursor = (PDO.PDO_CURSOR) this.m_attributes[PDO.PDO_ATTR.ATTR_CURSOR].ToLong(); this.m_dr = this.m_pdo.Driver.OpenReader(this.m_pdo, this.m_cmd, cursor); switch (cursor) { case PDO.PDO_CURSOR.CURSOR_FWDONLY: this.m_dr = this.m_cmd.ExecuteReader(); break; case PDO.PDO_CURSOR.CURSOR_SCROLL: this.m_dr = this.m_cmd.ExecuteReader(); break; default: throw new InvalidProgramException(); } this.m_dr_names = new string[this.m_dr.FieldCount]; for (int i = 0; i < this.m_dr_names.Length; i++) { this.m_dr_names[i] = this.m_dr.GetName(i); } } }
private void OpenReader() { if (this.m_dr == null) { PDO.PDO_CURSOR cursor = (PDO.PDO_CURSOR) this.m_attributes[PDO.PDO_ATTR.ATTR_CURSOR].ToLong(); this.m_dr = this.m_pdo.Driver.OpenReader(this.m_pdo, this.m_cmd, cursor); switch (cursor) { case PDO.PDO_CURSOR.CURSOR_FWDONLY: this.m_dr = this.m_cmd.ExecuteReader(); break; case PDO.PDO_CURSOR.CURSOR_SCROLL: this.m_dr = this.m_cmd.ExecuteReader(); break; default: throw new InvalidProgramException(); } initializeColumnNames(); } }
/// <summary> /// Opens a DataReader. /// </summary> /// <param name="pdo">The pdo.</param> /// <param name="cmd">The command.</param> /// <param name="cursor">The cursor configuration.</param> /// <returns></returns> public virtual DbDataReader OpenReader(PDO pdo, DbCommand cmd, PDO.PDO_CURSOR cursor) { return(cmd.ExecuteReader()); }