1 | public static int bindNamedParameters(↵ | | 1 | protected int bindNamedParameters(↵
|
2 | final PreparedStatement ps,↵ | | 2 | final PreparedStatement ↵
|
3 | ↵ | | 3 | statement,↵
|
4 | final Map namedParams,↵ | | 4 | final Map namedParams,↵
|
5 | final int start,↵ | | 5 | final int start↵
|
6 | final NamedParameterSource source,↵ | | |
|
7 | ↵ | | 6 | Index,↵
|
8 | final SessionImplementor session) throws SQLException, HibernateException {↵ | | 7 | final SessionImplementor session) throws SQLException, HibernateException {↵
|
9 | if ( namedParams != null ) {↵ | | 8 | if ( namedParams != null ) {↵
|
10 | // assumes that types are all of span 1↵ | | 9 | // assumes that types are all of span 1↵
|
11 | Iterator iter = namedParams.entrySet().iterator();↵ | | 10 | Iterator iter = namedParams.entrySet().iterator();↵
|
12 | int result = 0;↵ | | 11 | int result = 0;↵
|
13 | while ( iter.hasNext() ) {↵ | | 12 | while ( iter.hasNext() ) {↵
|
14 | Map.Entry e = ( Map.Entry ) iter.next();↵ | | 13 | Map.Entry e = ( Map.Entry ) iter.next();↵
|
15 | String name = ( String ) e.getKey();↵ | | 14 | String name = ( String ) e.getKey();↵
|
16 | TypedValue typedval = ( TypedValue ) e.getValue();↵ | | 15 | TypedValue typedval = ( TypedValue ) e.getValue();↵
|
17 | int[] locations = source.getNamedParameterLocations( name );↵ | | 16 | int[] locs = getNamedParameterLocs( name );↵
|
18 | for ( int i = 0; i < locations.length; i++ ) {↵ | | 17 | for ( int i = 0; i < locs.length; i++ ) {↵
|
19 | if ( log.isDebugEnabled() ) {↵ | | 18 | if ( log.isDebugEnabled() ) {↵
|
20 | log.debug( ↵ | | 19 | log.debug(↵
|
21 | "bindNamedParameters() " +↵ | | 20 | "bindNamedParameters() " +↵
|
22 | typedval.getValue() + " -> " + name +↵ | | 21 | typedval.getValue() + " -> " + name +↵
|
23 | " [" + ( locations[i] + start ) + "]" ↵ | | 22 | " [" + ( locs[i] + startIndex ) + "]"↵
|
24 | );↵ | | 23 | );↵
|
25 | }↵ | | 24 | }↵
|
26 | typedval.getType().nullSafeSet( ps, typedval.getValue(), locations[i] + start, session );↵ | | 25 | typedval.getType().nullSafeSet( statement, typedval.getValue(), locs[i] + startIndex, session );↵
|
27 | }↵ | | 26 | }↵
|
28 | result += locations.length;↵ | | 27 | result += locs.length;↵
|
29 | }↵ | | 28 | }↵
|
30 | return result;↵ | | 29 | return result;↵
|
31 | }↵ | | 30 | }↵
|
32 | else {↵ | | 31 | else {↵
|
33 | return 0;↵ | | 32 | return 0;↵
|
34 | | | 33 |
|