/// <inheritdoc />
 public void Close()
 {
     if (!IsClosed)
     {
         //Releases memory associated with the result set produced by execution of the prepared statement.
         //If there is a cursor open for the statement, mysql_stmt_free_result() closes it.
         int errorCode = Stmt.mysql_stmt_free_result();
         if (errorCode != 0)//Error occurred
         {
             throw new MySqlException(Stmt);
         }
         IsClosed = true;
         for (int i = 0; i < _fields.Length; i++)
         {
             RowDispose(i);
         }
         if (_connection != null && _closeConnection)
         {
             _connection.Close();
         }
     }
     base.Dispose();
 }
Exemple #2
0
        /// <summary>
        /// Closes the MySQLDataReader 0bject.
        /// </summary>
        public override void Close()
        {
            if (_nativeResult != null)
            {
                _nativeResult.Dispose();
                _nativeResult = null;
            }

            // Add by Omar del Valle Rodríguez ([email protected])
            // Close connection if connection is not null and CommandBehavior is CloseConnection
            if (_connection != null && m_CloseConnection)
            {
                _connection.Close();
            }

            if (dt == null)
            {
                return;
            }
            _RecordsAffected = dt.Rows.Count;
            dt.Dispose();
            dt = null;
        }