Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Specified domain or source column BIT does not exist #48

Open
MattDeering opened this issue Feb 6, 2019 · 0 comments
Open

Specified domain or source column BIT does not exist #48

MattDeering opened this issue Feb 6, 2019 · 0 comments

Comments

@MattDeering
Copy link

The issue

Hi, hoping I have the right place for this.

When converting from the fluent Linq expression to an SQL output the generated SQL includes the type BIT, which does not exist in firebird 2.5.

The DTO property CanPackBeBroken is a Bool.
The Table column BCANBEBROKEN is a Char(1)

I have previously been using EntityFramework 6 and checking BCANBEBROKEN == "T" to convert the string to a bool.

Any insights would be appreciated.

Steps to reproduce

var pbsMppRules = context.RX_PBS_RULE.Where(x => x.SPBSCODE == pbsCode)
                                         .OrderByDescending(x => x.DTEFFECTIVESTART)
                                         .Select(
                                             r =>
                                             new PbsDrugRule
                                                 {
                                                     CanPackBeBroken = r.BCANBEBROKEN == "T",
                                                     SafetyNetDays = r.ISAFETYNETDAYS,
                                                     MaximumQuantityUse = r.DMAXQTYUNITOFUSE,
                                                     MaximumQuantityPack = r.DMAXQTYPACK,
                                                     Title = r.STITLE,
                                                     ImmediateSupplyExempt =
                                                         !string.IsNullOrEmpty(r.BSAFETYNETCOUNTED)
                                                         && r.BSAFETYNETCOUNTED == "T"
                                                 })
                                         .FirstOrDefault();

Produces

SELECT FIRST 1 
    CASE
        WHEN "x"."BCANBEBROKEN" = _UTF8'T'
        THEN CAST(1 AS BIT) 
        ELSE CAST(0 AS BIT)
    END AS "CanPackBeBroken", 
"x"."ISAFETYNETDAYS" AS "SafetyNetDays", "x"."DMAXQTYUNITOFUSE" AS "MaximumQuantityUse", "x"."DMAXQTYPACK" AS "MaximumQuantityPack", "x"."STITLE" AS "Title"
   CASE
        WHEN ("x"."BSAFETYNETCOUNTED" IS NOT NULL AND ("x"."BSAFETYNETCOUNTED" <> _UTF8'')) AND ("x"."BSAFETYNETCOUNTED" = _UTF8'T')
        THEN CAST(1 AS BIT) 
        ELSE CAST(0 AS BIT)
    END AS "ImmediateSupplyExempt"
FROM "RX_PBS_RULE" AS "x"
WHERE "x"."SPBSCODE" = '8213G'
ORDER BY "x"."DTEFFECTIVESTART" DESC

Error details

Dynamic SQL Error

Exception message: Dynamic SQL Error
SQL error code = -607
Invalid command
Specified domain or source column BIT does not exist

Stack trace:    at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 507
   at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 610
   at System.Data.Common.DbCommand.ExecuteReader()
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
   at Microsoft.EntityFrameworkCore.Storage.Internal.NoopExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at lambda_method(Closure )
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ResultEnumerable`1.GetEnumerator()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass15_1`1.<CompileQueryCore>b__0(QueryContext qc)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
   at EfCoreStandard.PbsDrugPriceModelDataBroker.GetPbsMppRules(String pbsCode, RxContext context) in C:\POSWorks\PWSuite\Dispense2017\EfCoreStandard\PbsDrugPriceModelDataBroker.cs:line 586
   at DispenseAIDO.PbsDrugDomain.PbsGetDrugDatabaseValues.GetDrugDatabaseValues(PbsDrugCalculatedPrice& pbsDrug) in C:\POSWorks\PWSuite\Dispense2017\DispenseAIDO\PbsDrugDomain\PbsGetDrugDatabaseValues.cs:line 84

Further technical details

Firebird version: Firebird 2.5.1
EntityFrameworkCore.FirebirdSql version: 6.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant