Esempio n. 1
0
        public SqlEntityKeysExtractAllFromInput(AbstractConnection connection, Entity entity)
            : base(connection)
        {
            _entity    = entity;
            EntityName = entity.Name;
            _fields    = _entity.PrimaryKey.WithInput().Aliases().ToArray();
            _length    = _fields.Length;

            if (_entity.CanDetectChanges(connection.IsDatabase))
            {
                connection.LoadEndVersion(_entity);
                if (!_entity.HasRows)
                {
                    Debug("No data detected in {0}.", _entity.Alias);
                }
            }

            if (connection.Schemas && entity.Schema.Equals(string.Empty))
            {
                entity.Schema = connection.DefaultSchema;
            }

            _sql = _entity.CanDetectChanges(connection.IsDatabase)
                ? connection.KeyQuery(_entity)
                : connection.KeyAllQuery(_entity);
        }
Esempio n. 2
0
        public EntityInputKeysExtractDelta(Process process, Entity entity, AbstractConnection connection)
            : base(connection)
        {
            _entity    = entity;
            _fields    = _entity.PrimaryKey.WithInput().Aliases().ToArray();
            _length    = _fields.Length;
            EntityName = entity.Name;

            _entity.CheckForChanges(process, connection);

            if (!_entity.HasRows)
            {
                Debug("No data detected in {0}.", _entity.Alias);
            }

            if (_entity.BeginAndEndAreEqual())
            {
                Debug("No changes detected in {0}.", _entity.Alias);
            }

            var keyQuery = _entity.CanDetectChanges(connection.IsDatabase)
                ? connection.KeyQuery(_entity)
                : connection.KeyAllQuery(_entity);

            var sql = _entity.HasRange ?
                      connection.KeyRangeQuery(_entity) :
                      keyQuery;

            Debug(sql);
            _sql = sql;
        }
        public SqlEntityKeysExtractAllFromInput(AbstractConnection connection, Entity entity)
            : base(connection) {

            _entity = entity;
            EntityName = entity.Name;
            _fields = _entity.PrimaryKey.WithInput().Aliases().ToArray();
            _length = _fields.Length;

            if (_entity.CanDetectChanges(connection.IsDatabase)) {
                connection.LoadEndVersion(_entity);
                if (!_entity.HasRows) {
                    Debug("No data detected in {0}.", _entity.Alias);
                }
            }

            if (connection.Schemas && entity.Schema.Equals(string.Empty)) {
                entity.Schema = connection.DefaultSchema;
            }

            _sql = _entity.CanDetectChanges(connection.IsDatabase)
                ? connection.KeyQuery(_entity)
                : connection.KeyAllQuery(_entity);
        }