Re: [PATCH] pg_escape_literal/pg_escape_identifier for pgsql

From: Date: Fri, 20 May 2011 10:35:56 +0000
Subject: Re: [PATCH] pg_escape_literal/pg_escape_identifier for pgsql
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-52474@lists.php.net to get a copy of this message
On Fri, May 20, 2011 at 03:24, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > Hi all > > Current PostgreSQL has new escape functions for literals and identifiers. > Since there is no function for that, I made patch for that. Attached patch is > for trunk and tested with PostgreSQL 8.4 and 9.0. > > This patch would also applied to 5.4 branch but how about 5.3? > It's pain not to have escape functions. > > Any comments? This won't compile if HAVE_PQESCAPE isn't declared since you only register the arginfo when it is, but use it even if it wasn't. There is also very inconsistent usage of space vs tab in the patch. + if (!tmp) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape"); + RETURN_FALSE; + } Won't this also trigger the error if there was no from passed? I suppose checking from_len wouldn't be stupid. Should we really provide fallback if PQescape(Literal|Identifier) isn't available? Did you copy the escaping from postgresql directly? -Hannes

« previous php.internals (#52474) next »