@@ -88,9 +88,30 @@ public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams,
8888 {
8989 if ( value == null ) return "NULL" ;
9090 if ( type . IsNumberType ( ) ) return string . Format ( CultureInfo . InvariantCulture , "{0}" , value ) ;
91- if ( type == typeof ( byte [ ] ) ) return $ "x'{ CommonUtils . BytesSqlRaw ( value as byte [ ] ) } '";
92- if ( type == typeof ( string ) && col != null && ( specialParamFlag == "c" || specialParamFlag == "cu" ) )
93- return $ "cast('{ value . ToString ( ) . Replace ( "'" , "''" ) } ' as { col . Attribute . DbType . Replace ( "NOT NULL" , "" ) . Replace ( "NULL" , "" ) } )"; //#1923
91+ if ( type == typeof ( byte [ ] ) )
92+ {
93+ if ( col . Attribute . StringLength < 0 )
94+ {
95+ var pam = AppendParamter ( specialParams , $ "p_{ specialParams ? . Count } { specialParamFlag } ", null , type , value ) ;
96+ return pam . ParameterName ;
97+ }
98+ else
99+ {
100+ return $ "x'{ CommonUtils . BytesSqlRaw ( value as byte [ ] ) } '";
101+ }
102+ }
103+ if ( type == typeof ( string ) )
104+ {
105+ if ( col . Attribute . StringLength < 0 )
106+ {
107+ var pam = AppendParamter ( specialParams , $ "p_{ specialParams ? . Count } { specialParamFlag } ", null , type , value ) ;
108+ return pam . ParameterName ;
109+ }
110+ else if ( col != null && ( specialParamFlag == "c" || specialParamFlag == "cu" ) )
111+ {
112+ return $ "cast('{ value . ToString ( ) . Replace ( "'" , "''" ) } ' as { col . Attribute . DbType . Replace ( "NOT NULL" , "" ) . Replace ( "NULL" , "" ) } )"; //#1923
113+ }
114+ }
94115 return FormatSql ( "{0}" , value , 1 ) ;
95116 }
96117 }
0 commit comments