public ParametricStatement set ( String sql ) throws IllegalArgumentException { if ( _env != null ) { try { sql = Macro . expand ( sql , _env . call ( ) ) ; } catch ( Exception x ) { throw new IllegalArgumentException ( x . getMessage ( ) , x ) ; } } if ( _params != null ) { int count = 0 ; int qmark = sql . indexOf ( ' ' ) ; while ( qmark > 0 ) { ++ count ; qmark = sql . indexOf ( ' ' , qmark + 1 ) ; } if ( _params . length == count ) { _sql = sql ; } else { throw new IllegalArgumentException ( "Wrong number of parameters in '" + sql + ' ' ) ; } } else { List < Param > params = new ArrayList < Param > ( ) ; _sql = transformer . invoke ( new StringBuilder ( ) , params , sql ) . toString ( ) ; _params = params . toArray ( new Param [ params . size ( ) ] ) ; } return this ; }
Assigns a SQL string to this ParametricStatement .