using System.Data;
using System.Data.SqlClient;

using MySql.Data.MySqlClient;

namespace BeWo.Data.Access
{
    public class AdoDAO : AbstractBaseDAO
    {
        public DataSet ExecuteQuery(string pQuery)
        {
            DataSet lDs = new DataSet();
            if (!string.IsNullOrEmpty(pQuery))
            {
                var lCommand = this.Session.Connection.CreateCommand();
                lCommand.CommandText = pQuery;



                IDataAdapter lAdapter = lCommand is SqlCommand
                                            ? new SqlDataAdapter {SelectCommand = (SqlCommand) lCommand}
                                            : (IDataAdapter)
                                              new MySqlDataAdapter {SelectCommand = (MySqlCommand) lCommand};

                lAdapter.Fill(lDs);
            }
            return lDs;
        }
    }
}