private void AddParameter(SqlQuery query, QueryParameter queryParameter, object value) { var sqlType = GetSqlType(queryParameter.Type); var param = new Sql.QueryParameter(queryParameter.Name, sqlType, (ISqlObject)value); param.Direction = QueryParameterDirection.In; query.Parameters.Add(param); }
protected override void AddParameter(DbCommand command, QueryParameter parameter, object value) { DbQueryType sqlType = (DbQueryType)parameter.QueryType; if (sqlType == null) sqlType = (DbQueryType)this.Provider.Language.TypeSystem.GetColumnType(parameter.Type); var p = ((SqlCeCommand)command).Parameters.Add("@" + parameter.Name, sqlType.SqlDbType, sqlType.Length); if (sqlType.Precision != 0) p.Precision = (byte)sqlType.Precision; if (sqlType.Scale != 0) p.Scale = (byte)sqlType.Scale; p.Value = value ?? DBNull.Value; }
protected override void AddParameter(DbCommand command, QueryParameter parameter, object value) { DbQueryType sqlType = (DbQueryType)parameter.QueryType; if (sqlType == null) sqlType = (DbQueryType)this.Provider.Language.TypeSystem.GetColumnType(parameter.Type); int len = sqlType.Length; if (len == 0 && DbTypeSystem.IsVariableLength(sqlType.SqlDbType)) { len = Int32.MaxValue; } //var p = ((OracleCommand)command).Parameters.Add(":" + parameter.Name, ToOracleType(sqlType.SqlDbType), len); var p = provider.AdoProvider.CreateParameter(":" + parameter.Name, sqlType.SqlDbType, len); /* if (sqlType.Precision != 0) p.Precision = (byte)sqlType.Precision; if (sqlType.Scale != 0) p.Scale = (byte)sqlType.Scale; */ p.Value = value ?? DBNull.Value; command.Parameters.Add(p); }
protected override void AddParameter(DbCommand command, QueryParameter parameter, object value) { DbQueryType sqlType = (DbQueryType)parameter.QueryType; if (sqlType == null) { sqlType = (DbQueryType)this.Provider.Language.TypeSystem.GetColumnType(parameter.Type); } int len = sqlType.Length; if (len == 0 && DbTypeSystem.IsVariableLength(sqlType.SqlDbType)) { len = Int32.MaxValue; } var p = ((SqlCommand)command).Parameters.Add("@" + parameter.Name, sqlType.SqlDbType, len); if (sqlType.Precision != 0) { p.Precision = (byte)sqlType.Precision; } if (sqlType.Scale != 0) { p.Scale = (byte)sqlType.Scale; } p.Value = value ?? DBNull.Value; }
protected override void AddParameter(DbCommand command, QueryParameter parameter, object value) { QueryType qt = parameter.QueryType; if (qt == null) qt = this.provider.Language.TypeSystem.GetColumnType(parameter.Type); var p = ((OleDbCommand)command).Parameters.Add(parameter.Name, this.GetOleDbType(qt), qt.Length); if (qt.Precision != 0) p.Precision = (byte)qt.Precision; if (qt.Scale != 0) p.Scale = (byte)qt.Scale; p.Value = value ?? DBNull.Value; }
protected override void AddParameter(DbCommand command, QueryParameter parameter, object value) { QueryType qt = parameter.QueryType; if (qt == null) qt = this.provider.Language.TypeSystem.GetColumnType(parameter.Type); var p = ((SQLiteCommand)command).Parameters.Add(parameter.Name, ((DbQueryType)qt).DbType, qt.Length); if (qt.Length != 0) { p.Size = qt.Length; } else if (qt.Scale != 0) { p.Size = qt.Scale; } p.Value = value ?? DBNull.Value; }