@@ -42,11 +42,8 @@ private ParameterParser()
4242 public static void Parse ( string sqlString , IRecognizer recognizer )
4343 {
4444 // TODO: WTF? "CALL"... it may work for ORACLE but what about others RDBMS ? (by FM)
45- bool hasMainOutputParameter = sqlString . IndexOf ( "call" ) > 0 &&
46- sqlString . IndexOf ( "?" ) > 0 &&
47- sqlString . IndexOf ( "=" ) > 0 &&
48- sqlString . IndexOf ( "?" ) < sqlString . IndexOf ( "call" ) &&
49- sqlString . IndexOf ( "=" ) < sqlString . IndexOf ( "call" ) ;
45+ var indexOfCall = sqlString . IndexOf ( "call" , StringComparison . Ordinal ) ;
46+ bool hasMainOutputParameter = CallableParser . HasReturnParameter ( sqlString , indexOfCall ) ;
5047 bool foundMainOutputParam = false ;
5148
5249 int stringLength = sqlString . Length ;
@@ -59,7 +56,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
5956 // check comments
6057 if ( indx + 1 < stringLength && sqlString . Substring ( indx , 2 ) == "/*" )
6158 {
62- var closeCommentIdx = sqlString . IndexOf ( "*/" , indx + 2 ) ;
59+ var closeCommentIdx = sqlString . IndexOf ( "*/" , indx + 2 , StringComparison . Ordinal ) ;
6360 recognizer . Other ( sqlString . Substring ( indx , ( closeCommentIdx - indx ) + 2 ) ) ;
6461 indx = closeCommentIdx + 1 ;
6562 continue ;
@@ -112,7 +109,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
112109 if ( c == ':' )
113110 {
114111 // named parameter
115- int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparators , indx + 1 ) ;
112+ int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparatorsAsCharArray , indx + 1 ) ;
116113 int chopLocation = right < 0 ? sqlString . Length : right ;
117114 string param = sqlString . Substring ( indx + 1 , chopLocation - ( indx + 1 ) ) ;
118115 recognizer . NamedParameter ( param , indx ) ;
@@ -124,7 +121,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
124121 if ( indx < stringLength - 1 && char . IsDigit ( sqlString [ indx + 1 ] ) )
125122 {
126123 // a peek ahead showed this as an ejb3-positional parameter
127- int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparators , indx + 1 ) ;
124+ int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparatorsAsCharArray , indx + 1 ) ;
128125 int chopLocation = right < 0 ? sqlString . Length : right ;
129126 string param = sqlString . Substring ( indx + 1 , chopLocation - ( indx + 1 ) ) ;
130127 // make sure this "name" is an integral
@@ -160,4 +157,4 @@ public static void Parse(string sqlString, IRecognizer recognizer)
160157 }
161158 }
162159 }
163- }
160+ }
0 commit comments