--- sql/pgsql/parser3pgsql.C 2001/09/21 15:44:37 1.1.1.1 +++ sql/pgsql/parser3pgsql.C 2002/02/08 08:32:50 1.6 @@ -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) + Author: Alexandr Petrosian (http://paf.design.ru) 2001.07.30 using PgSQL 7.1.2 */ -static const char *RCSId="$Id: parser3pgsql.C,v 1.1.1.1 2001/09/21 15:44:37 parser Exp $"; +static const char *RCSId="$Id: parser3pgsql.C,v 1.6 2002/02/08 08:32:50 paf Exp $"; #include "config_includes.h" @@ -63,7 +63,7 @@ public: /// get api version int api_version() { return SQL_DRIVER_API_VERSION; } /// initialize driver by loading sql dynamic link library - const char *initialize(const char *dlopen_file_spec) { + const char *initialize(char *dlopen_file_spec) { return dlopen_file_spec? dlink(dlopen_file_spec):"client library column is empty"; } @@ -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, @@ -425,4 +425,4 @@ private: // conn client library funcs li extern "C" SQL_Driver *SQL_DRIVER_CREATE() { return new PgSQL_Driver(); -} \ No newline at end of file +}