diff --git a/source/pdo_sqlsrv/pdo_parser.cpp b/source/pdo_sqlsrv/pdo_parser.cpp index 9bc11845..2951a7dd 100644 --- a/source/pdo_sqlsrv/pdo_parser.cpp +++ b/source/pdo_sqlsrv/pdo_parser.cpp @@ -415,9 +415,12 @@ void conn_string_parser:: parse_conn_string( TSRMLS_D ) // Primary function which parses out the named placeholders from a sql string. void sql_string_parser::parse_sql_string( TSRMLS_D ) { try { + int start_pos = -1; while ( !this->is_eos() ) { - int start_pos = -1; - + // if pos is -1, then reading from a string is an initialized read + if ( pos == -1 ) { + next(); + } // skip until a '"', '\'', ':' or '?' char sym; while ( this->orig_str[pos] != '"' && this->orig_str[pos] != '\'' && this->orig_str[pos] != ':' && this->orig_str[pos] != '?' && !this->is_eos() ) {