Embarcadero/IB.NETDataProvider

Needed Boolean support.

onyamegatron opened this issue · 1 comments

Hi there I have been pained by these drivers lack of proper support for booleans. Whether it is querying the db or inserting an entry with a boolean.
For example
BoolHolder foo = new BoolHolder {test = true, id = 1};

`

        var context = GetContext(session);
        using (IDbContextTransaction transaction = context.Database.BeginTransaction())
        {
            try
            {
                context.Entry(foo).State = EntityState.Added;
                await context.SaveChangesAsync();
                await transaction.CommitAsync();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                Console.WriteLine("Error occurred.");
            }
        }`

This will be added to my database with the boolean being randomly assigned a false or true value.
A simple workaround is doing something like
(EDIT: THIS ACTUALLY DOESNT FIX IT SAME ISSUE OCCURS WHEN USING PARAMETERIZED UPDATEDS W/ RAWSQL)

`

        var context = GetContext(session);
        using (IDbContextTransaction transaction = context.Database.BeginTransaction())
        {
            try
            {
                context.Entry(foo).State = EntityState.Added;
                await context.SaveChangesAsync();
                await transaction.CommitAsync();
                await context.Database.ExecuteSqlRawAsync("UPDATE Boolholder SET test = @p0 WHERE id = @p1", foo.test, foo.id);
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                Console.WriteLine("Error occurred.");
            }
        }`

And that seems to work fine however this problem is even more of a headache when trying to retrieve data. Trying to query something based on a boolean just straight up does not work. You'd have to workaround it by switching flags to another datatype
Cheers

EDIT: SEE PHOTO BELOW NOT EVEN RAWSQL WORKS WITH PARAMETERISED VALUES ONLY HARD TYPING BOOL VALUES WORK ?????????

Console.WriteLine($"Pickup : {order.Pickup}");
Console.WriteLine($"Pickup : {order.MultiPay}");
await context.Database.ExecuteSqlRawAsync("UPDATE OrderHdr SET Pickup = @p0, Multi_Pay = @p1 WHERE Order_Id = @p2", order.Pickup, order.MultiPay, order.OrderId);
image