예제 #1
0
        private void AddColumnsForType(Schema.TableVar tableVar, Schema.ScalarType d4Type)
        {
            // Add columns for the base type, if any
            foreach (var parentType in d4Type.ParentTypes)
            {
                AddColumnsForType(tableVar, parentType);
            }

            // Add columns for the default representation
            var representation = Compiler.FindDefaultRepresentation(d4Type);

            if (representation != null)
            {
                // And columns for each property of the default representation
                foreach (var property in representation.Properties)
                {
                    var column         = new Schema.Column(property.Name, property.DataType);
                    var tableVarColumn = new Schema.TableVarColumn(column);
                    tableVar.DataType.Columns.Add(column);
                    tableVar.Columns.Add(tableVarColumn);
                }
            }

            tableVar.AddDependency(d4Type);
        }
예제 #2
0
 public void CheckDataType(Plan plan, Schema.ScalarType expectedDataType)
 {
     Schema.Object dataTypeObject = Compiler.ResolveCatalogIdentifier(plan, DocumentType.DataType, true);
     if
     (
         !(dataTypeObject is Schema.ScalarType) ||
         (
             (expectedDataType != plan.DataTypes.SystemBinary) &&
             !((Schema.ScalarType)dataTypeObject).Is(expectedDataType)
         )
     )
     {
         throw new CompilerException(CompilerException.Codes.ExpressionTypeMismatch, dataTypeObject.Name, expectedDataType.Name);
     }
 }
예제 #3
0
 private void PopulateScalarTypeExplicitCastFunctions(Program AProgram, NativeTable ANativeTable, Row ARow)
 {
     foreach (Schema.Object LObject in AProgram.Catalog)
     {
         if (LObject is Schema.ScalarType)
         {
             Schema.ScalarType LScalarType = (Schema.ScalarType)LObject;
             foreach (Schema.Operator LOperator in LScalarType.ExplicitCastOperators)
             {
                 ARow[0] = LScalarType.Name;
                 ARow[1] = LOperator.Name;
                 ANativeTable.Insert(AProgram.ValueManager, ARow);
             }
         }
     }
 }
예제 #4
0
        private void ChangeObjectOwner(Program program, Schema.CatalogObject objectValue, Schema.User user)
        {
            if (objectValue != null)
            {
                objectValue.Owner = user;
                ((ServerCatalogDeviceSession)program.CatalogDeviceSession).SetCatalogObjectOwner(objectValue.ID, user.ID);

                if (objectValue is Schema.ScalarType)
                {
                    Schema.ScalarType scalarType = (Schema.ScalarType)objectValue;

                    if (scalarType.EqualityOperator != null)
                    {
                        ChangeObjectOwner(program, scalarType.EqualityOperator, user);
                    }

                    if (scalarType.ComparisonOperator != null)
                    {
                        ChangeObjectOwner(program, scalarType.ComparisonOperator, user);
                    }

                    if (scalarType.IsSpecialOperator != null)
                    {
                        ChangeObjectOwner(program, scalarType.IsSpecialOperator, user);
                    }

                    foreach (Schema.Special special in scalarType.Specials)
                    {
                        ChangeObjectOwner(program, special.Selector, user);
                        ChangeObjectOwner(program, special.Comparer, user);
                    }

                                        #if USETYPEINHERITANCE
                    foreach (Schema.Operator operatorValue in scalarType.ExplicitCastOperators)
                    {
                        ChangeObjectOwner(AProgram, operatorValue, AUser);
                    }
                                        #endif

                    foreach (Schema.Representation representation in scalarType.Representations)
                    {
                        if (representation.Selector != null)
                        {
                            ChangeObjectOwner(program, representation.Selector, user);
                        }

                        foreach (Schema.Property property in representation.Properties)
                        {
                            if (property.ReadAccessor != null)
                            {
                                ChangeObjectOwner(program, property.ReadAccessor, user);
                            }
                            if (property.WriteAccessor != null)
                            {
                                ChangeObjectOwner(program, property.WriteAccessor, user);
                            }
                        }
                    }
                }
            }
        }