--- sql/oracle/parser3oracle.C 2001/11/14 10:33:18 1.13 +++ sql/oracle/parser3oracle.C 2002/02/08 08:32:41 1.19 @@ -1,13 +1,13 @@ /** @file Parser Oracle 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 Oracle 8.1.6 [@test tested with Oracle 7.x.x] */ -static const char *RCSId="$Id: parser3oracle.C,v 1.13 2001/11/14 10:33:18 paf Exp $"; +static const char *RCSId="$Id: parser3oracle.C,v 1.19 2002/02/08 08:32:41 paf Exp $"; #include "config_includes.h" @@ -365,19 +365,19 @@ public: unsigned int quote( SQL_Driver_services&, void *, char *to, const char *from, unsigned int length) { - /* - it's already UNTAINT_TIMES_BIGGER - */ - unsigned int result=length; - while(length--) { - switch(*from) { - case '\'': // "'" -> "''" - *to++='\''; result++; - break; + if(to) { // store mode + unsigned int result=length; + while(length--) { + switch(*from) { + 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, @@ -484,7 +484,7 @@ private: // private funcs const char *start=o; bool escaped=false; while(*o && !(o[0]=='\'' && o[1]!='\'' && !escaped)) { - escaped=*o=='\\' || (o[0]=='\'' && o[1]=='\''); + escaped=o[0]=='\'' && o[1]=='\''; if(escaped) { // write pending, skip "\" or "'" if(size_t size=o-start) { @@ -549,6 +549,9 @@ private: // private funcs (dvoid *)stmthp, (ub4)OCI_HTYPE_STMT, (ub1 *)&stmt_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, cs.errhp)); */ + + while(isspace(*statement)) + statement++; if(strncasecmp(statement, "select", 6)==0) stmt_type=OCI_STMT_SELECT; else if(strncasecmp(statement, "insert", 6)==0)