@@ -42,11 +42,8 @@ private ParameterParser()
42
42
public static void Parse ( string sqlString , IRecognizer recognizer )
43
43
{
44
44
// 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 ) ;
50
47
bool foundMainOutputParam = false ;
51
48
52
49
int stringLength = sqlString . Length ;
@@ -59,7 +56,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
59
56
// check comments
60
57
if ( indx + 1 < stringLength && sqlString . Substring ( indx , 2 ) == "/*" )
61
58
{
62
- var closeCommentIdx = sqlString . IndexOf ( "*/" , indx + 2 ) ;
59
+ var closeCommentIdx = sqlString . IndexOf ( "*/" , indx + 2 , StringComparison . Ordinal ) ;
63
60
recognizer . Other ( sqlString . Substring ( indx , ( closeCommentIdx - indx ) + 2 ) ) ;
64
61
indx = closeCommentIdx + 1 ;
65
62
continue ;
@@ -112,7 +109,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
112
109
if ( c == ':' )
113
110
{
114
111
// named parameter
115
- int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparators , indx + 1 ) ;
112
+ int right = StringHelper . FirstIndexOfChar ( sqlString , ParserHelper . HqlSeparatorsAsCharArray , indx + 1 ) ;
116
113
int chopLocation = right < 0 ? sqlString . Length : right ;
117
114
string param = sqlString . Substring ( indx + 1 , chopLocation - ( indx + 1 ) ) ;
118
115
recognizer . NamedParameter ( param , indx ) ;
@@ -124,7 +121,7 @@ public static void Parse(string sqlString, IRecognizer recognizer)
124
121
if ( indx < stringLength - 1 && char . IsDigit ( sqlString [ indx + 1 ] ) )
125
122
{
126
123
// 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 ) ;
128
125
int chopLocation = right < 0 ? sqlString . Length : right ;
129
126
string param = sqlString . Substring ( indx + 1 , chopLocation - ( indx + 1 ) ) ;
130
127
// make sure this "name" is an integral
@@ -160,4 +157,4 @@ public static void Parse(string sqlString, IRecognizer recognizer)
160
157
}
161
158
}
162
159
}
163
- }
160
+ }
0 commit comments