Example #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);
        }
Example #2
0
 public void CheckForChanges(Process process, AbstractConnection connection)
 {
     if (!CanDetectChanges(connection.IsDatabase))
     {
         return;
     }
     process.OutputConnection.LoadBeginVersion(this);
     connection.LoadEndVersion(this);
 }
        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);
        }