internal ReadOnlyCollection<ReadOnlyCollection<SqlParameterInfo>> ParameterizeBlock(SqlBlock block) { SqlParameterInfo rowStatus = new SqlParameterInfo( new SqlParameter(typeof(int), _typeProvider.From(typeof(int)), "@ROWCOUNT", block.SourceExpression) ); List<ReadOnlyCollection<SqlParameterInfo>> list = new List<ReadOnlyCollection<SqlParameterInfo>>(); for(int i = 0, n = block.Statements.Count; i < n; i++) { SqlNode statement = block.Statements[i]; List<SqlParameterInfo> parameters = this.ParameterizeInternal(statement); if(i > 0) { parameters.Add(rowStatus); } list.Add(parameters.AsReadOnly()); } return list.AsReadOnly(); }
private SqlParameter InsertLookup(SqlValue cp) { SqlParameterInfo pi = null; if(!this.map.TryGetValue(cp, out pi)) { SqlParameter p; if(this.timeProviderType == null) { p = new SqlParameter(cp.ClrType, cp.SqlType, this.parameterizer.CreateParameterName(), cp.SourceExpression); pi = new SqlParameterInfo(p, cp.Value); } else { p = new SqlParameter(cp.ClrType, this.timeProviderType, this.parameterizer.CreateParameterName(), cp.SourceExpression); pi = new SqlParameterInfo(p, ((DateTime)cp.Value).TimeOfDay); } this.map.Add(cp, pi); this.currentParams.Add(pi); } return pi.Parameter; }