Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32997 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29686 invoked by uid 1010); 1 Nov 2007 22:05:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 29671 invoked from network); 1 Nov 2007 22:05:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Nov 2007 22:05:57 -0000 X-Host-Fingerprint: 80.197.188.103 0x50c5bc67.odnxx5.adsl-dhcp.tele.dk Received: from [80.197.188.103] ([80.197.188.103:14935] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/E6-02860-4CD4A274 for ; Thu, 01 Nov 2007 17:05:57 -0500 Message-ID: <67.E6.02860.4CD4A274@pb1.pair.com> To: internals@lists.php.net Reply-To: "Lars Westermann" Date: Thu, 1 Nov 2007 23:05:53 +0100 Lines: 156 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original X-Posted-By: 80.197.188.103 Subject: RFC: ext/interbase/ibase_query.c (PHP_5_3) From: Lars.Westermann@privat.dk ("Lars Westermann") Hi! Request For Comments for bugfixes made to ext/interbase/ibase_query.c. I'm working on the PHP_5_3 branch. I've been working on bugfixes for the following bugreports: #30690, InterBase: Resource handle from ibase_execute becomes invalid after return #32143, ibase_query() causes IB server crash with invalid DB and parameters #39397, invalid statement handle in Unknown on line 0 #39700, NUMERIC error when result precision are 7,8 or 12-14 #32143 is solved by checking for an empty querystring - if that's the case, an error is returned, and no attempt to prepare a query is made. #39700 is also quite easy to solve (solutions presented in comment section of bugreport) #30690 and #39397 are somewhat related as they both address problems with destruction of query and result resources. My bugfix for this is based on the fact, that there is a one-to-one relationship between a query resource and a result resource. Both resources share a common statement handle to the Interbase/Firebird API, and the idea behind the solution is to only drop this statement handle, when neither the query resource nor the result resource need it. I have therefore bound the two resources together with a pointer in each structure pointing at each other. These pointers are assigned a value when a result resource is created. Upon destruction of either, the pointer in the opposite structure is NULL'ed, indicating that this resource no longer exists. When the last of the two resources is destroyed, the pointer to the other resource is NULL, and then it is time to drop the statement handle in the API. In addition, before the statement handle is dropped, it is checked, that the database link is still valid (to prevent a Warning when destroying a query resource after the database link is closed). I have attached a unified diff for the changes made. I would appreciate any comments to the solutions chosen/made. Best regards Lars W begin 666 ibase_query_c-diff-u.txt M9&EF9B M=2 MPH@"6EB M87-E7V1B7VQI;FL@*FQI;FL["B ):6)A2!["B ):6)AWL@*B\**WL**PEI M9B HPHK"0E)0D1%0E5'*")$F5O9BAR97-?8G5F*2P@2 JR J+PH@>PH@"6EB87-E M7W)E7!E("$]($58 M14-55$5?4D5354Q4*2!["BT)"0E)0D1%0E5'*")$2 A/2!.54Q, M*2!["BL)"0E)0D1%0E5'*")Q=65R>2!S=&EL;"!V86QI9#L@9&]N)W0@9')O M<"!S=&%T96UE;G0@:&%N9&QE(BD["BL)"0EI8E]R97-U;'0M/G%U97)Y+3YR M97-U;'0@/2!.54Q,.PDO*B!);F1I8V%T92!T;R!Q=65R>2P@=&AA="!R97-U M;'0@:7,@PH@"0EE9G)E92AI8E]Q=65R>2T^;W5T7W-Q;&1A*3L*( E]"BT) M:68@*&EB7W%U97)Y+3YS=&UT*2!["BT)"4E"1$5"542T^2T^2D["D! ("TQ-C8L,3$@*S$X-BPW($! "B * M( EI9B H:6)?<75EPH@"0E)0D1%0E5'*")02!B>2!D=&]R+BXN(BD["BT*( D)7W!H<%]I8F%S M95]F2T^7!E6UT@/2![:7-C7VEN9F]?2T^2 ]($Y53$P["B ):6)?<75E2 ]($Y53$P["D! ("TY,CDL-R K.34R+#$P($! "B )"7)E2T^;W5T7V%R2T^2 J+PHK"0ER97,M/G%U M97)Y(#T@:6)?<75E2T^R J+PH@"6EN="!S8V%L92P@:6YT(&9L86<@5%-234Q37T1#*0H@>PHM"7-T M871I8R!)4T-?24Y4-C0@8V]NR Q+" Q,"P@,3 P+" Q,# P+" **PD),3 P,# L( HK"0DQ M,# P,# L( HK"0DQ,# P,# P+" **PD),3 P,# P,# L"BL)"3$P,# P,# P M,"P@"BL)"3$P,# P,# P,# L( HK"0E,3%],250H,3 P,# P,# P,# I+" * M*PD)3$Q?3$E4*#$P,# P,# P,# P,"DL"BL)"4Q,7TQ)5"@Q,# P,# P,# P M,# P*2P@"BL)"4Q,7TQ)5"@Q,# P,# P,# P,# P,"DL( HK"0E,3%],250H M,3 P,# P,# P,# P,# P*2P**PD)3$Q?3$E4*#$P,# P,# P,# P,# P,# I M+ HK"0E,3%],250H,3 P,# P,# P,# P,# P,# I+" **PD)3$Q?3$E4*#$P M,# P,# P,# P,# P,# P,"DL( HK"0E,3%],250H,3 P,# P,# P,# P,# P M,# P,"D**PE].PH@"B )7!E("8@?C$I('L*( D)=6YS:6=N -960@