sijms / go-ora

Pure go oracle client
MIT License
771 stars 169 forks source link

Issue in parseSqlText function #472

Closed oheurtel closed 7 months ago

oheurtel commented 8 months ago

There is an issue in the parseSqlText function when the query text contains a line feed character just after a bind variable. Exemple of such a query : text := "select * from t where x = :x\nand y = :y " In this exemple, as the line feed character is ignored in the function, the name captured is :xand instead of :x. According to me, the solution is to keep the line feed character in the text when it is not inside a comment :

    case '\n':
      if lineComment {
        lineComment = false
      } else {
        textBuffer = append(textBuffer, ch) // oheurtel : keep the line feed character
      }
sijms commented 8 months ago

I will add your code in next release