Embarcadero/InterBasePython

Error Code -804 when using SELECT with boolean field

danielerizzoarchivi opened this issue ยท 19 comments

Dear developers,

I am currently working with the InterBase Python library (latest version downloaded from Git) for database connectivity, a and I am encountering an issue with specific queries where I request boolean fields in the SELECT statements. When attempting to retrieve a boolean field using the following queries:

example "#SELECT id,<boolean_field> FROM <table_with field_id,<boolean_field>"

or simply "SELECT TRUE FROM table "

I consistently receive the following error: "-804: Incorrect values within SQLDA structure."
I have already ensured that the connection to the database is established successfully.

When executing this query using ISQL and IBExpert, I do not encounter any problems, and the results are as expected.

Thank you for your time.
Best regards,
Daniele

Thanks Daniele. We'll look into it and get back to you once we have tested.

This is an absolutely ridiculous set of database drivers. Even the one for .NET. What an absolute joke. Nothing works. For the love of all things holy, can you PLEASE test things before you throw them out into the world?!

This is an absolutely ridiculous set of database drivers. Even the one for .NET. What an absolute joke. Nothing works. For the love of all things holy, can you PLEASE test things before you throw them out into the world?!

Hello @jordanzdimirovic,

Can you detail what is not working to you?

This isn't exclusive to the Python driver, but I cannot include any boolean fields for any query for any table.

I'm using Python for some mission-uncritical tooling, but the most immensely frustrating realisation is that the .NET EF extension / plugin just straight up breaks when performing deletes / some other CRUD operations. Hell, EF was producing incorrect syntax (SELECT * FROM TABLE WHERE BOOL instead of SELECT * FROM TABLE WHERE BOOL = TRUE.

I realise this repo isn't the one relevant to entity-framework, however it appears to be a related issue (conversion from and to boolean query). I just don't know how it's remotely possible that an even somewhat proficient testing suite wouldn't pick up on these inconsistencies...

It seems that the team is completely unaware of the implicational cost towards businesses and employees alike that have to bang their head in an attempt to resolve these problems, instead of working on business logic and the items that are actually important to them!

Hi, this bug is currently ocurring any way to solve, it?

I realise this repo isn't the one relevant to entity-framework

Have you tried posting on the entity-framework forums/repos instead of here? We have absolutely nothing to do with that project and can't do anything about any problems in it.

Hi, this bug is currently ocurring any way to solve, it?

I'll come back to your shortly with an update.

@checkdigits it appears to be an internal problem in the IB library. I will sort this out and provide updates here.

Hi any update my company, are stuck by this driver to make some deployements.

Hi everyone,

In October 2023, I raised this issue regarding the BOOLEAN datatype (see here) and, unfortunately, I haven't received any response from Embarcadero's developers so far.

To address the problem and move forward with my project, I developed a workaround. I created a module that includes the following function to handle BOOLEAN columns by casting them to INTEGER.

Here's the code:

def _filter_query(column):
    if column['datatype'] == 'BOOLEAN':
        return f"CAST({column['name']} AS INTEGER)"
    return column['name']

How It Works:
If a column has the BOOLEAN datatype, the function uses CAST to convert it to INTEGER. This ensures compatibility and avoids issues with queries.
For all other column types, the function simply returns the column name without modification.
This workaround has proven effective for my use case. It might not be the ideal long-term solution, but it enables development to proceed until an official fix or update is released.

I hope this helps anyone else encountering the same issue.
If you have further suggestions or improvements, feel free to share!

Hi everyone,

In October 2023, I raised this issue regarding the BOOLEAN datatype (see here) and, unfortunately, I haven't received any response from Embarcadero's developers so far.

To address the problem and move forward with my project, I developed a workaround. I created a module that includes the following function to handle BOOLEAN columns by casting them to INTEGER.

Here's the code:

def _filter_query(column):
    if column['datatype'] == 'BOOLEAN':
        return f"CAST({column['name']} AS INTEGER)"
    return column['name']

How It Works: If a column has the BOOLEAN datatype, the function uses CAST to convert it to INTEGER. This ensures compatibility and avoids issues with queries. For all other column types, the function simply returns the column name without modification. This workaround has proven effective for my use case. It might not be the ideal long-term solution, but it enables development to proceed until an official fix or update is released.

I hope this helps anyone else encountering the same issue. If you have further suggestions or improvements, feel free to share!

Hi, can work with insert too, i made sucesfull your insert statement, but the insert keep failing :C

Hi, can work with insert too, i made sucesfull your insert statement, but the insert keep failing :C

I made this patch just for the SELECT.

@danielerizzoarchivi you ought to be waiting months upon months. The audacity of Embarcadero to charge thousands in licensing fees for some of the worst software and support I've ever seen is astonishing.

If anyone needs a light-weight / embedded database, choose SQLite. Otherwise go with PG. Actually choose anything else and you'll be in a better position than you'll be with Interbase ๐Ÿ˜†