Exemplo n.º 1
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <byte[]> data, int layer, int level)
 {
     _texture = texture;
     _data    = data;
     _layer   = layer;
     _level   = level;
 }
Exemplo n.º 2
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <ResultBox <PinnedSpan <byte> > > result, int layer, int level)
 {
     _texture = texture;
     _result  = result;
     _layer   = layer;
     _level   = level;
 }
Exemplo n.º 3
0
 public ColumnRef(string tableName, string columnName, string aliasName)
 {
     Parent     = null;
     Table      = new TableRef(tableName);
     ColumnName = new Identifier(columnName);
     Alias      = new Identifier(aliasName);
 }
Exemplo n.º 4
0
 // consider select from( select from ( select ...) ...)...
 // here we use recursion
 void checkifHasdtableAndifOnlyReplicated(TableRef x, ref bool hasdtable, ref bool onlyreplicated)
 {
     if (x is BaseTableRef bx)
     {
         var method = bx.Table().distMethod_;
         if (bx.IsDistributed())
         {
             hasdtable = true;
             if (method != TableDef.DistributionMethod.Replicated)
             {
                 onlyreplicated = false;
             }
         }
     }
     else if (x is QueryRef qx)
     {
         var t_hasdtable      = hasdtable;
         var t_onlyreplicated = onlyreplicated;
         if (qx.query_ != null)
         {
             if (qx.query_.from_ != null)
             {
                 var from = qx.query_.from_;
                 from.ForEach(x => checkifHasdtableAndifOnlyReplicated(x, ref t_hasdtable, ref t_onlyreplicated));
                 hasdtable      = t_hasdtable;
                 onlyreplicated = t_onlyreplicated;
             }
         }
     }
 }
 public AlterTableQuery(AlterTableQuery other)
 {
     TableName      = other.TableName.Clone();
     AlterType      = other.AlterType;
     AlteredColumns = new List <AlteredColumn>(other.AlteredColumns.Count);
     AlteredColumns.AddRange(other.AlteredColumns.Select(x => x.Clone() as AlteredColumn));
 }
Exemplo n.º 6
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <ThreadedTexture> destination, int firstLayer, int firstLevel)
 {
     _texture     = texture;
     _destination = destination;
     _firstLayer  = firstLayer;
     _firstLevel  = firstLevel;
 }
Exemplo n.º 7
0
 public void Set(TableRef <ITexture> texture, TableRef <ISampler> sampler, Extents2DF srcRegion, Extents2DF dstRegion)
 {
     _texture   = texture;
     _sampler   = sampler;
     _srcRegion = srcRegion;
     _dstRegion = dstRegion;
 }
 public void Set(ShaderStage stage, int binding, TableRef <ITexture> texture, TableRef <ISampler> sampler)
 {
     _stage   = stage;
     _binding = binding;
     _texture = texture;
     _sampler = sampler;
 }
Exemplo n.º 9
0
 public void Set(BufferHandle buffer, int offset, int size, TableRef <ResultBox <PinnedSpan <byte> > > result)
 {
     _buffer = buffer;
     _offset = offset;
     _size   = size;
     _result = result;
 }
Exemplo n.º 10
0
 public ColumnRef(TableRef table, Identifier columnName, Identifier alias)
 {
     Parent     = null;
     Table      = table;
     ColumnName = columnName;
     Alias      = alias;
 }
Exemplo n.º 11
0
 protected virtual string BuildSelect(TableRef tbl, params string[] columns)
 {
     return("SELECT "
            + String.Join(",", columns.Select(c => QuoteIdentifier(c)).ToArray())
            + " FROM "
            + FormatSchemaName(tbl));
 }
Exemplo n.º 12
0
 public OutputStream(TableRef tbl, ISchemaProvider provider)
 {
     if (tbl == null) throw new ArgumentNullException("tbl");
     if (provider == null) throw new ArgumentNullException("provider");
     this._provider = provider;
     this._tbl = tbl;
 }
Exemplo n.º 13
0
        // table APIs
        //
        public void RegisterTable(TableRef tab)
        {
            bool FindSameInParents(TableRef tab)
            {
                var top = parent_;

                while (top != null)
                {
                    // it is ok to have same alias in the virtical (different levels) but not on the same level
                    if (top.boundFrom_.Values.Any(x => x.alias_.Equals(tab.alias_)))
                    {
                        Debug.Assert(top.boundFrom_.Values.Count(x => x.alias_.Equals(tab.alias_)) == 1);
                        return(true);
                    }

                    top = top.parent_;
                }
                return(false);
            }

            if (FindSameInParents(tab))
            {
                tab.alias_ = $"{tab.alias_}__{TopContext().globalSubqCounter_}";
            }
            boundFrom_.Add(boundFrom_.Count, tab);
        }
Exemplo n.º 14
0
 public void Set(TableRef <ThreadedCounterEvent> evt, CounterType type, TableRef <EventHandler <ulong> > resultHandler, bool hostReserved)
 {
     _event         = evt;
     _type          = type;
     _resultHandler = resultHandler;
     _hostReserved  = hostReserved;
 }
Exemplo n.º 15
0
 public void CreateTable(TableRef tblName, bool idAsIdentityColumn)
 {
     Log.DebugFormat("CreateTable [{0}] {1} and a primary key",
                     tblName,
                     idAsIdentityColumn ? "with identity" : "without identity");
     _provider.CreateTable(tblName, idAsIdentityColumn);
 }
Exemplo n.º 16
0
 public bool CheckFKColumnContainsUniqueValues(TableRef tblName, string colName)
 {
     using (var cmd = new OleDbCommand(string.Format("SELECT COUNT(*) FROM (SELECT TOP 1 [{1}] FROM [{0}] WHERE [{1}] IS NOT NULL GROUP BY [{1}] HAVING COUNT([{1}]) > 1) AS tbl", tblName, colName), db, tx))
     {
         QueryLog.Debug(cmd.CommandText);
         return((int)cmd.ExecuteScalar() == 0);
     }
 }
Exemplo n.º 17
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <ThreadedTexture> destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
 {
     _texture      = texture;
     _destination  = destination;
     _srcRegion    = srcRegion;
     _dstRegion    = dstRegion;
     _linearFilter = linearFilter;
 }
Exemplo n.º 18
0
 public bool CheckColumnContainsValues(TableRef tblName, string colName)
 {
     using (var cmd = new OleDbCommand(string.Format("SELECT COUNT(*) FROM (SELECT TOP 1 [{1}] FROM [{0}] WHERE [{1}] IS NOT NULL) AS nulls", tblName, colName), db, tx))
     {
         QueryLog.Debug(cmd.CommandText);
         return((int)cmd.ExecuteScalar() > 0);
     }
 }
Exemplo n.º 19
0
 public void CreateTable(TableRef tblName, IEnumerable <Column> cols)
 {
     if (Log.IsDebugEnabled)
     {
         Log.DebugFormat("CreateTable {0} with {1} columns", tblName, cols.Count());
     }
     _provider.CreateTable(tblName, cols);
 }
Exemplo n.º 20
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <byte[]> data, int layer, int level, Rectangle <int> region)
 {
     _texture = texture;
     _data    = data;
     _layer   = layer;
     _level   = level;
     _region  = region;
 }
Exemplo n.º 21
0
 public bool CheckTableContainsData(TableRef tblName)
 {
     using (var cmd = new OleDbCommand(string.Format("SELECT COUNT(*) FROM {0}", FormatTableName(tblName), db, tx)))
     {
         QueryLog.Debug(cmd.CommandText);
         return((int)cmd.ExecuteScalar() > 0);
     }
 }
Exemplo n.º 22
0
            /// <summary>
            /// Read ctor
            /// </summary>
            internal Map(EntryInstance parent, ResReader reader)
            {
                this.parent = parent;

                // header
                nameRef = TableRef.Read(reader);
                value   = new Value(reader);
            }
Exemplo n.º 23
0
 public CreateIndexQuery()
 {
     Name                  = new Identifier();
     OnTable               = new TableRef("");
     Type                  = IndexType.DEFAULT;
     Modifier              = IndexModifier.DEFAULT;
     OnColumns             = new List <ColumnRef>();
     MsSqlFullTextKeyIndex = null;
 }
Exemplo n.º 24
0
 public void Set(TableRef <ThreadedTexture> texture, TableRef <ThreadedTexture> destination, int srcLayer, int dstLayer, int srcLevel, int dstLevel)
 {
     _texture     = texture;
     _destination = destination;
     _srcLayer    = srcLayer;
     _dstLayer    = dstLayer;
     _srcLevel    = srcLevel;
     _dstLevel    = dstLevel;
 }
Exemplo n.º 25
0
 public bool CheckViewExists(TableRef viewName)
 {
     using (var cmd = new OleDbCommand("SELECT COUNT(*) FROM sys.objects WHERE object_id = OBJECT_ID(@view) AND type IN (N'V')", db, tx))
     {
         cmd.Parameters.AddWithValue("@view", viewName);
         QueryLog.Debug(cmd.CommandText);
         return((int)cmd.ExecuteScalar() > 0);
     }
 }
Exemplo n.º 26
0
        public IEnumerable <string> GetTableColumnNames(TableRef tblName)
        {
            QueryLog.Debug("GetSchema(Columns)");
            var columns = db.GetSchema(OleDbMetaDataCollectionNames.Columns, new string[] { null, null, tblName.Name, null });

            foreach (DataRow col in columns.Rows)
            {
                yield return((string)col["COLUMN_NAME"]);
            }
        }
 /// <summary>
 /// Configure Column checkbox event handler
 /// </summary>
 protected void OnConfigureChecked(IColumn <TableItem> column, object value)
 {
     if (column != null)
     {
         column.ShowColumn = (bool)value;
         column.ShowHeaderRowFilterable = (column.DefaultShowHeaderFilter != null && column.DefaultShowHeaderFilter != true) ? false : column.ShowColumn;
         TableRef.Update();
         StateHasChanged();
     }
 }
Exemplo n.º 28
0
        public async Task <DeviceEntity> GetWithApiKeyAsync(string deviceId, string apiKey)
        {
            var keyCondition                = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, deviceId);
            var sharedKeyCondition          = TableQuery.GenerateFilterCondition("ApiKey", QueryComparisons.Equal, apiKey);
            var finalCondition              = TableQuery.CombineFilters(keyCondition, TableOperators.And, sharedKeyCondition);
            TableQuery <DeviceEntity> query = new TableQuery <DeviceEntity>().Where(finalCondition);
            var result = await TableRef.ExecuteQuerySegmentedAsync <DeviceEntity>(query, null);

            return(result.Results.FirstOrDefault());
        }
Exemplo n.º 29
0
        public override async Task <List <DeviceEntity> > GetAsync(string partitionKey)
        {
            var keyCondition                = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey);
            var deletedNotTrueCondition     = TableQuery.GenerateFilterConditionForBool("Deleted", QueryComparisons.NotEqual, true);
            var finalCondition              = TableQuery.CombineFilters(keyCondition, TableOperators.And, deletedNotTrueCondition);
            TableQuery <DeviceEntity> query = new TableQuery <DeviceEntity>().Where(finalCondition);
            var result = await TableRef.ExecuteQuerySegmentedAsync <DeviceEntity>(query, null);

            return(result.Results);
        }
Exemplo n.º 30
0
        public virtual bool CheckPositionColumnValidity(TableRef tblName, string posName)
        {
            var failed = CheckColumnContainsNulls(tblName, posName);

            if (failed)
            {
                Log.WarnFormat("Order Column [{0}].[{1}] contains NULLs.", tblName, posName);
                return(false);
            }

            return(CallRepairPositionColumn(false, tblName, posName));
        }
Exemplo n.º 31
0
        public UpdateQuery(UpdateQuery other)
        {
            UpdateTable = other.UpdateTable.Clone();

            UpdateExpressions = new List <Tuple <ColumnRef, Constant> >(other.UpdateExpressions.Count);
            foreach (var pr in other.UpdateExpressions)
            {
                var newpr = new Tuple <ColumnRef, Constant>((ColumnRef)(pr.Item1.Clone()), (Constant)pr.Item2.Clone());
                UpdateExpressions.Add(newpr);
            }

            Where = new WhereClause(other.Where);
        }
 public void MigrateFKs(TableRef srcTblName, string srcColName, TableRef tblName, string colName)
 {
     _provider.MigrateFKs(srcTblName, srcColName, tblName, colName);
 }
 public IDataReader ReadJoin(TableRef tblName, IEnumerable<ProjectionColumn> colNames, IEnumerable<Join> joins)
 {
     return _provider.ReadJoin(tblName, colNames, joins);
 }
 public void AlterColumn(TableRef tblName, string colName, DbType type, int size, int scale, bool isNullable, params DatabaseConstraint[] constraints)
 {
     _provider.AlterColumn(tblName, colName, type, size, scale, isNullable, constraints);
 }
 public void DropFKConstraint(TableRef tblName, string constraintName)
 {
     Log.DebugFormat("Dropping foreign key constraint [{0}].[{1}]", tblName, constraintName);
     _provider.DropFKConstraint(tblName, constraintName);
 }
 public bool RepairPositionColumn(TableRef tblName, string positionColumnName)
 {
     return _provider.RepairPositionColumn(tblName, positionColumnName);
 }
 public void WriteTableData(TableRef destTbl, IDataReader source, IEnumerable<string> colNames)
 {
     _provider.WriteTableData(destTbl, source, colNames);
 }
 public bool GetHasColumnDefaultValue(TableRef tblName, string colName)
 {
     return _provider.GetHasColumnDefaultValue(tblName, colName);
 }
 public void RenameFKConstraint(TableRef tblName, string oldConstraintName, TableRef refTblName, string colName, string newConstraintName, bool onDeleteCascade)
 {
     _provider.RenameFKConstraint(tblName, oldConstraintName, refTblName, colName, newConstraintName, onDeleteCascade);
 }
 public void DropView(TableRef viewName)
 {
     Log.DebugFormat("Dropping view [{0}]", viewName);
     _provider.DropView(viewName);
 }
 public int GetColumnMaxLength(TableRef tblName, string colName)
 {
     return _provider.GetColumnMaxLength(tblName, colName);
 }
 public void DropTrigger(TableRef objName, string triggerName)
 {
     Log.DebugFormat("Dropping trigger [{0}]", triggerName);
     _provider.DropTrigger(objName, triggerName);
 }
 public void DropTable(TableRef tblName)
 {
     Log.DebugFormat("Dropping table [{0}]", tblName);
     _provider.DropTable(tblName);
 }
 public void DropIndex(TableRef tblName, string idxName)
 {
     _provider.DropIndex(tblName, idxName);
 }
 public IDataReader ReadTableData(TableRef tblName, IEnumerable<string> colNames)
 {
     return _provider.ReadTableData(tblName, colNames);
 }
 public bool GetIsColumnNullable(TableRef tblName, string colName)
 {
     return _provider.GetIsColumnNullable(tblName, colName);
 }
 public void RenameColumn(TableRef tblName, string oldColName, string newColName)
 {
     _provider.RenameColumn(tblName, oldColName, newColName);
 }
 public IEnumerable<string> GetTableColumnNames(TableRef tblName)
 {
     return _provider.GetTableColumnNames(tblName);
 }
 public void RenameTable(TableRef oldTblName, TableRef newTblName)
 {
     _provider.RenameTable(oldTblName, newTblName);
 }
 public void CreateUpdateRightsTrigger(string triggerName, TableRef tblName, List<RightsTrigger> tblList, List<string> dependingCols)
 {
     _provider.CreateUpdateRightsTrigger(triggerName, tblName, tblList, dependingCols);
 }
 public void TruncateTable(TableRef tblName)
 {
     Log.DebugFormat("Truncating table [{0}]", tblName);
     _provider.TruncateTable(tblName);
 }
        public void CreateTable(TableRef tblName, bool idAsIdentityColumn, bool createPrimaryKey)
        {
            if (tblName == null)
                throw new ArgumentNullException("tblName");

            Log.DebugFormat("CreateTable [{0}] {1} {2}",
                tblName,
                idAsIdentityColumn ? "with identity" : "without identity",
                createPrimaryKey ? "and a primary key" : "and no primary key");
            _provider.CreateTable(tblName, idAsIdentityColumn, createPrimaryKey);
        }
 public void WriteTableData(TableRef destTbl, IEnumerable<string> colNames, IEnumerable values)
 {
     _provider.WriteTableData(destTbl, colNames, values);
 }
 public void InsertFKs(TableRef srcTblName, string srcColName, TableRef tblName, string colName, string fkColName)
 {
     _provider.InsertFKs(srcTblName, srcColName, tblName, colName, fkColName);
 }
 public bool CheckColumnContainsValues(TableRef tblName, string colName)
 {
     return _provider.CheckColumnContainsValues(tblName, colName);
 }
 public void DropColumn(TableRef tblName, string colName)
 {
     Log.DebugFormat("Dropping column [{0}].[{1}]", tblName, colName);
     _provider.DropColumn(tblName, colName);
 }
 public IEnumerable<Column> GetTableColumns(TableRef tblName)
 {
     return _provider.GetTableColumns(tblName);
 }
 public void CreateTable(TableRef tblName, bool idAsIdentityColumn)
 {
     Log.DebugFormat("CreateTable [{0}] {1} and a primary key",
         tblName,
         idAsIdentityColumn ? "with identity" : "without identity");
     _provider.CreateTable(tblName, idAsIdentityColumn);
 }
 public void DblinkConnect(TableRef tblName)
 {
     _provider.DblinkConnect(tblName);
 }
 public string GetViewDefinition(TableRef view)
 {
     return _provider.GetViewDefinition(view);
 }