FirebirdSQL / php-firebird

Firebird PHP driver
Other
66 stars 15 forks source link

Incorrect values within SQLDA structure in firebird 4 (php-8.0.1-interbase-1.1.1-linux-x64.so) #26

Open koltsov4 opened 2 years ago

koltsov4 commented 2 years ago

Hi. php-8.0.1-interbase-1.1.1-linux-x64.so does not work in firebird 4 with DECIMAL or NUMERIC types when using the SUM function. As a result, I get Incorrect values within SQLDA structure. For example select sum (p.balance) from dog p will not work if the data type is DECIMAL. Similarly, it does not work if any operations occur inside the sum, for example, if the field is made INTEGER and the following query is executed select sum (p.balance 100) from dog p similarly we get Incorrect values within SQLDA structure Also does not work with TIMESTAMP WITH TIME ZONE fields. For example, select from MON $ ATTACHMENTS will return an error Incorrect values within SQLDA structure

mrotteveel commented 2 years ago

As a workaround, set DataTypeCompatibility to 3.0 or 2.5 in either firebird.conf (server wide), or per-database in databases.conf. This seems to be the same issues as reported in #24.

koltsov4 commented 2 years ago

This problem is with 4.0. With 3.0 it works fine.

mrotteveel commented 2 years ago

The problem is that Firebird 4.0 introduced wider NUMERIC and DECIMAL (38 digits, previous versions supported 18 digits), and an INT128 type, these get used for some of the aggregate functions and other calculations. The DataTypeCompatibility setting when set to 3.0, will ensure that Firebird 4.0 will not return the new data types, but instead it will convert (cast) them to types as supported by Firebird 3.0. See also the Firebird 4.0 release notes, section DataTypeCompatibility.

To be clear, I don't maintain the Firebird PHP driver. This is a workaround you can use until this gets fixed in the driver.

koltsov4 commented 2 years ago

Thanks! Indeed, it helped.

But not quite to the end. For example, TIMESTAMP WITH TIME ZONE is converted to TIMESTAMP, but “select * from MON$ATTACHMENTS” will still not work because there is a type BOLLEAN. “Select p.mon $ wire_compressed from MON$ATTACHMENTS p” will return “Incorrect values within SQLDA structure”. But this is not important, since the structure worked from the old configuration.

PS: it surprised me, because 3.0 also has a BOLLEAN type. I just never used it. Perhaps a similar driver problem exists when working with 3.0.

mrotteveel commented 2 years ago

If you do have a boolean somewhere, you need to set DataTypeCompatibility to 2.5, so boolean is also converted. As I said, I don't maintain the Firebird PHP driver (nor do I use it), so I don't know all the ins and outs of it.

MartinKoeditz commented 2 years ago

The problem is not related to BOOLEAN, but to TIMESTAMP field CREATION_DATE. If I set DataTypeCompatibility to 3.0 everything works fine.

So I will investigate in the new timezone feature.

buhlerax commented 1 year ago

Good Morning, Any news about the extension's compatibility with the new firebird 4.0 types?

MartinKoeditz commented 1 year ago

Hi,

still in progress. Will last some weeks. Any help is welcome.

Regards, Martin

[https://www.it-syn.de/wp-content/uploads/2013/03/130313-it-synergy-Logo-200x81.png]

E-Mail: @.*** Festnetz: +49 5131 46358 - 300 Mobil: +49 174 9095174

Adresse: Dieselstraße 18 30827 Garbsen

Geschäftsführer: Jörg Obermann USt.-ID: DE266943764 Gerichtsstand: Amtsgericht Hannover HRB 204887 [cid:Synny-standard-122x128_893d5d75-a3d9-4751-8d28-35edcac23c6b.png] https://www.it-syn.de/

[cid:Instagram_b049198f-ae33-4adb-8f4c-c93023d156b5.png]https://www.instagram.com/it.synergy https://plus.google.com/114028260526830186292?prsrc=3/ http://www.youtube.com/codetwochannel#p/u/ [tweeter] https://www.linkedin.com/company/it-synergy-gmbh

Vertraulichkeitshinweis: Die in dieser E-Mail enthaltenen Informationen sind vertraulich zu behandeln und sind nur für die Personen oder das Unternehmen bestimmt, an welche sie tatsächlich gerichtet sind. Sollten Sie diese Nachricht aufgrund eines Übermittlungsfehlers erhalten haben, bitten wir Sie den Versender der Nachricht unverzüglich zu informieren. Ebenso bitten wir Sie, den Inhalt Dritten gegenüber vertraulich zu behandeln und ihn nicht weiter zu verbreiten.

Sicherheitshinweis: Das Internet ist kein sicheres Kommunikationsmedium. Im Rahmen unseres Qualitätsmanagements und aller gebotenen Sorgfalt wurden Schritte eingeleitet die einen Virenbefall dieser E-Mail weitgehend ausschließen, aber wegen der Beschaffenheit des Übertragungsmediums nicht garantiert werden können.

Von: Alexandre Pereira Bühler @. Gesendet: Donnerstag, 26. Januar 2023 10:32 An: FirebirdSQL/php-firebird @.> Cc: Köditz, Martin @.>; Assign @.> Betreff: Re: [FirebirdSQL/php-firebird] Incorrect values within SQLDA structure in firebird 4 (php-8.0.1-interbase-1.1.1-linux-x64.so) (Issue #26)

Good Morning, Any news about the extension's compatibility with the new firebird 4.0 types?

— Reply to this email directly, view it on GitHubhttps://github.com/FirebirdSQL/php-firebird/issues/26#issuecomment-1404745359, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADEKGLRL3SN6PAYER24YQU3WUJAAHANCNFSM5HDUSXMQ. You are receiving this because you were assigned.Message ID: @.**@.>>

hmoffatt commented 1 month ago

Is there any progress on support for TIMESTAMP WITH TIME ZONE ?