Ejemplo n.º 1
0
        public IDbCommandResult Execute(string command)
        {
            try
            {
                _dbConnection.Open();
                var query = new SchemaQuery(command);
                var schema = GetSchemaFrom(query);
                var result = new QueryResult();

                foreach (DataColumn column in schema.Columns)
                {
                    if (query.SelectAll || query.ColumnNames.Contains(column.ColumnName.ToLowerInvariant()))
                    {
                        result.AddColumn(column.ColumnName, column.DataType);
                    }
                }
                foreach (DataRow row in schema.Rows)
                {
                    result.AddRow(row.ItemArray);
                }
                return result;
            }
            finally
            {
                _dbConnection.Close();
            }
        }
Ejemplo n.º 2
0
        public IDbCommandResult Execute(string command)
        {
            try
            {
                _dbConnection.Open();
                var query  = new SchemaQuery(command);
                var schema = GetSchemaFrom(query);
                var result = new QueryResult();

                foreach (DataColumn column in schema.Columns)
                {
                    if (query.SelectAll || query.ColumnNames.Contains(column.ColumnName.ToLowerInvariant()))
                    {
                        result.AddColumn(column.ColumnName, column.DataType);
                    }
                }
                foreach (DataRow row in schema.Rows)
                {
                    result.AddRow(row.ItemArray);
                }
                return(result);
            }
            finally
            {
                _dbConnection.Close();
            }
        }
Ejemplo n.º 3
0
 private DataTable GetSchemaFrom(SchemaQuery query)
 {
     return query.HasNoCollectionName
         ? _dbConnection.GetSchema()
         : _dbConnection.GetSchema(query.CollectionName);
 }
Ejemplo n.º 4
0
 private DataTable GetSchemaFrom(SchemaQuery query)
 {
     return(query.HasNoCollectionName
         ? _dbConnection.GetSchema()
         : _dbConnection.GetSchema(query.CollectionName));
 }