Exemple #1
0
        internal override bool TryResolveSourceColumnType(BatchOutputColumnTypeResolver batchResolver, string sourceColumnName, out SourceColumnType columnDbType)
        {
            if (string.IsNullOrEmpty(sourceColumnName))
            {
                throw new ArgumentNullException(nameof(sourceColumnName));
            }

            if (resolved_table == null)
            {
                resolved_table = batchResolver.SchemaMetadata.TryGetColumnSourceMetadata(SchemaName, TableName);
                if (resolved_table == null)
                {
                    // table not exists???
                    throw new NotImplementedException(Key + "." + sourceColumnName);
                }
            }

            ColumnTypeMetadata sourceColumnType = resolved_table.TryGetColumnTypeByName(sourceColumnName);

            if (sourceColumnType != null)
            {
                columnDbType = new SourceColumnType(this, sourceColumnName, sourceColumnType.ColumnDbType, sourceColumnType.AllowNull);
                return(true);
            }
            else
            {
                //throw new NotImplementedException(Key + "." + sourceColumnName + "   Table: [" + SchemaName + "].[" + TableName + "]");
                columnDbType = null;// DbType.Object; // column 'personid' without alias => source traversion
                return(false);
            }
        }
Exemple #2
0
        //private QueryColumnBase override_TryResolveSelectedColumn(BatchOutputColumnTypeResolver batchResolver, string outputColumnName, string sourceColumnName)
        //{
        //    if (resolved_source_metadata == null)
        //    {
        //        resolved_source_metadata = batchResolver.TryGetTableVariable(VarTableRef.Variable.Name);
        //        if (resolved_source_metadata == null)
        //        {
        //            throw new NotImplementedException(VarTableRef.WhatIsThis());
        //        }
        //    }

        //    return base.AddResolveOutputdColumn(new QueryColumnE(this, outputColumnName, sourceColumnName, columnDbType.Value));

        //}

        internal override bool TryResolveSourceColumnType(BatchOutputColumnTypeResolver batchResolver, string sourceColumnName, out SourceColumnType columnType)
        {
            if (resolved_source_metadata == null)
            {
                resolved_source_metadata = batchResolver.TryGetTableVariable(VarTableRef.Variable.Name);
                if (resolved_source_metadata == null)
                {
                    throw new NotImplementedException(VarTableRef.WhatIsThis());
                }
            }

            ColumnTypeMetadata columnDbType = resolved_source_metadata.TryGetColumnTypeByName(sourceColumnName);

            if (columnDbType != null)
            {
                columnType = new SourceColumnType(this, sourceColumnName, columnDbType.ColumnDbType, columnDbType.AllowNull);
                return(true);
            }

            columnType = null;// DbType.Object;
            return(false);
        }
Exemple #3
0
        //internal QueryColumnBase override_TryResolveSelectedColumn(BatchOutputColumnTypeResolver batchResolver, string outputColumnName, string sourceColumnName)
        //{
        //    if (resolved_source_metadata == null)
        //    {
        //        resolved_source_metadata = batchResolver.SchemaMetadata.TryGetFunctionTableMetadata(SchemaName, FunctionName);
        //        if (resolved_source_metadata == null)
        //        {
        //            throw new NotImplementedException(SchemaName + "." + FunctionName + "  => " + outputColumnName);
        //        }
        //    }

        //    DbType? columnDbType = resolved_source_metadata.TryGetColumnTypeByName(sourceColumnName);
        //    if (columnDbType == null)
        //    {
        //        return null;
        //    }

        //    string outputColumnNameSafe = outputColumnName ?? sourceColumnName;

        //    return base.AddResolveOutputdColumn(new QueryColumnE(this, outputColumnNameSafe, sourceColumnName, columnDbType.Value));
        //}

        internal override bool TryResolveSourceColumnType(BatchOutputColumnTypeResolver batchResolver, string sourceColumnName, out SourceColumnType columnType)
        {
            if (resolved_source_metadata == null)
            {
                resolved_source_metadata = batchResolver.SchemaMetadata.TryGetFunctionTableMetadata(SchemaName, FunctionName);
                if (resolved_source_metadata == null)
                {
                    throw new NotImplementedException(SchemaName + "." + FunctionName + "  : " + sourceColumnName);
                }
            }


            ColumnTypeMetadata columnDbType = resolved_source_metadata.TryGetColumnTypeByName(sourceColumnName);

            if (columnDbType != null)
            {
                columnType = new SourceColumnType(this, sourceColumnName, columnDbType.ColumnDbType, columnDbType.AllowNull);
                return(true);
            }

            columnType = null; // DbType.Object;
            return(false);
        }