Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46974 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99858 invoked from network); 10 Feb 2010 16:37:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2010 16:37:40 -0000 Authentication-Results: pb1.pair.com header.from=ewgraf@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ewgraf@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.224 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ewgraf@gmail.com X-Host-Fingerprint: 209.85.220.224 mail-fx0-f224.google.com Received: from [209.85.220.224] ([209.85.220.224:52953] helo=mail-fx0-f224.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/10-19537-3D0E27B4 for ; Wed, 10 Feb 2010 11:37:40 -0500 Received: by fxm24 with SMTP id 24so198241fxm.23 for ; Wed, 10 Feb 2010 08:37:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cgg69sIPlmQaiP1wwhhQVTeU0pt386QNlwS4dFa6Tbc=; b=u1KGxVlM/KzRhTFjWPPAMTf533s4TV9I5JUOAFHDvDFkLPB5xf+ADusePgVCTvYp4k iIS8GbmJNZi3PLAm4mksNfbAe0JIjYQu7cotFKdqrcjTmVlQBcf50asbzlco8jwZBB0b /weYYsHf7WgSdleccbo2UzrpDDa/RFV2/PD5I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=xJ4zVpqbHZKXQ0Sq8UV4eUPzKp4SueHw49hb2o58BRgs6WTly+0wpRcbFTdqFuFhn8 m1DCjU0aZrcF4Us/5rAkUIN0RyHzmF9zaZHgfEW3TnMM1uude6h05PJWc462y9OJUhga fbThoGEZYZuONRFenGvXhxkL4ZkZY0pCBC2jY= MIME-Version: 1.0 Received: by 10.216.91.82 with SMTP id g60mr265502wef.98.1265819856841; Wed, 10 Feb 2010 08:37:36 -0800 (PST) In-Reply-To: <1265729924.2988.408.camel@guybrush> References: <1265723806.2988.193.camel@guybrush> <1265729924.2988.408.camel@guybrush> Date: Wed, 10 Feb 2010 21:37:36 +0500 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PATCH for bug #47199 From: ewgraf@gmail.com (Sokolov Evgeniy) Thank you very much. This patch is passed, also as other patches from this extension. It's time for choose next bug :) Index: ext/pgsql/tests/bug47199.phpt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ext/pgsql/tests/bug47199.phpt (revision 0) +++ ext/pgsql/tests/bug47199.phpt (revision 0) @@ -0,0 +1,23 @@ +--TEST-- +Bug #47199 pg_delete fails on NULL +--SKIPIF-- + +--FILE-- + NULL, 'not_null_field' =3D> 2),PGSQL_DML_STRING)); +@pg_query("DROP TABLE $tbl_name"); +pg_close($dbh); +echo PHP_EOL."Done".PHP_EOL; +?> +--EXPECTF-- +DELETE FROM %s WHERE null_field IS NULL AND not_null_field=3D2; +Done Index: ext/pgsql/pgsql.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ext/pgsql/pgsql.c (revision 294790) +++ ext/pgsql/pgsql.c (working copy) @@ -5523,7 +5523,7 @@ } /* }}} */ -static inline int build_assignment_string(smart_str *querystr, HashTable *ht, const char *pad, int pad_len TSRMLS_DC) +static inline int build_assignment_string(smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len TSRMLS_DC) { HashPosition pos; uint fld_len; @@ -5542,8 +5542,13 @@ return -1; } smart_str_appendl(querystr, fld, fld_len - 1); - smart_str_appendc(querystr, '=3D'); + if (where_cond && Z_TYPE_PP(val) =3D=3D IS_STRING && !strcmp(Z_STRVAL_PP(val), "NULL")) { + smart_str_appends(querystr, " IS "); + } else { + smart_str_appendc(querystr, '=3D'); + } + switch(Z_TYPE_PP(val)) { case IS_STRING: smart_str_appendl(querystr, Z_STRVAL_PP(val), Z_STRLEN_PP(val)); @@ -5604,12 +5609,12 @@ smart_str_appends(&querystr, table); smart_str_appends(&querystr, " SET "); - if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), ",", = 1 TSRMLS_CC)) + if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), 0, ",", 1 TSRMLS_CC)) goto cleanup; smart_str_appends(&querystr, " WHERE "); - if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC)) + if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC)) goto cleanup; smart_str_appendc(&querystr, ';'); @@ -5705,7 +5710,7 @@ smart_str_appends(&querystr, table); smart_str_appends(&querystr, " WHERE "); - if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC)) + if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC)) goto cleanup; smart_str_appendc(&querystr, ';'); @@ -5841,7 +5846,7 @@ smart_str_appends(&querystr, table); smart_str_appends(&querystr, " WHERE "); - if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), " AND ", sizeof(" AND ")-1 TSRMLS_CC)) + if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC)) goto cleanup; smart_str_appendc(&querystr, ';'); 2010/2/9 Johannes Schl=FCter : > Hi, > > On Tue, 2010-02-09 at 20:11 +0500, Sokolov Evgeniy wrote: >> > did you really run this test and was it successful? - doesn't looklike >> > for me. >> I just run "php tests/27_bug47199.phpt" and check the result output. >> Is this correct way? > > The easy way to run it using the test Framework is by executing > > make test TESTS=3Dtests/27_bug47199.phpt > > from your build directory which will prepare some environment things and > then run run-tests.php from PHP's source directory which has the > implementation of our test system, you can also run it directly to have > more ocntrol. See README.TESTING in the php-src root folder and > http://qa.php.net/write-test.php for more details on the test system. > > If you run your test it will tell you it failed as you're tests EXPECTF > section has to look something like this: > > --EXPECTF-- > DELETE FROM %s WHERE null_field IS NULL AND not_null_field=3D2; > Done > > Mind the %s place holder there! > >> > And please also add a link to the patch to the bug report >> Can it be link on pastebin.org? For example http://pastebin.org/88880 > > I don't know how persistent these pastebins are, > http://news.php.net/php.internals/46965 might be an alternative link > though :-) > > johannes best regards