--- sql/pgsql/parser3pgsql.C 2001/11/11 11:01:47 1.3 +++ sql/pgsql/parser3pgsql.C 2002/02/08 07:28:25 1.5 @@ -1,13 +1,13 @@ /** @file Parser PgSQL driver. - Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) + Copyright(c) 2001, 2002 ArtLebedev Group(http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) 2001.07.30 using PgSQL 7.1.2 */ -static const char *RCSId="$Id: parser3pgsql.C,v 1.3 2001/11/11 11:01:47 paf Exp $"; +static const char *RCSId="$Id: parser3pgsql.C,v 1.5 2002/02/08 07:28:25 paf Exp $"; #include "config_includes.h" @@ -123,22 +123,22 @@ public: unsigned int quote( SQL_Driver_services&, void *connection, char *to, const char *from, unsigned int length) { - /* - it's already UNTAINT_TIMES_BIGGER - */ - unsigned int result=length; - while(length--) { - switch(*from) { - case '\'': // "'" -> "''" - *to++='\''; - break; - case '\\': // "\" -> "\\" - *to++='\''; - break; + if(to) { // store mode + unsigned int result=length; + while(length--) { + switch(*from) { + case '\'': // "'" -> "''" + *to++='\''; result++; + break; + case '\\': // "\" -> "\\" + *to++='\''; result++; + break; + } + *to++=*from++; } - *to++=*from++; - } - return result; + return result; + } else // estimate mode + return length*2; } void query( SQL_Driver_services& services, void *connection,