@@ -114,29 +114,16 @@ public function callback(array $m): string
114114 private function formatValue ($ value , $ mode = NULL )
115115 {
116116 if (!$ mode || $ mode === 'auto ' ) {
117- if (is_string ($ value )) {
118- if (strlen ($ value ) > 20 ) {
119- $ this ->remaining [] = $ value ;
120- return '? ' ;
121-
122- } else {
123- return $ this ->connection ->quote ($ value );
124- }
125-
126- } elseif (is_int ($ value )) {
127- return (string ) $ value ;
128-
129- } elseif (is_float ($ value )) {
130- return rtrim (rtrim (number_format ($ value , 10 , '. ' , '' ), '0 ' ), '. ' );
131-
132- } elseif (is_bool ($ value )) {
133- return $ this ->driver ->formatBool ($ value );
117+ if (is_scalar ($ value ) || is_resource ($ value )) {
118+ $ this ->remaining [] = $ value ;
119+ return '? ' ;
134120
135121 } elseif ($ value === NULL ) {
136122 return 'NULL ' ;
137123
138124 } elseif ($ value instanceof Table \IRow) {
139- return $ this ->formatValue ($ value ->getPrimary ());
125+ $ this ->remaining [] = $ value ->getPrimary ();
126+ return '? ' ;
140127
141128 } elseif ($ value instanceof SqlLiteral) {
142129 $ prep = clone $ this ;
@@ -151,10 +138,7 @@ private function formatValue($value, $mode = NULL)
151138 return $ this ->driver ->formatDateInterval ($ value );
152139
153140 } elseif (is_object ($ value ) && method_exists ($ value , '__toString ' )) {
154- return $ this ->formatValue ((string ) $ value );
155-
156- } elseif (is_resource ($ value )) {
157- $ this ->remaining [] = $ value ;
141+ $ this ->remaining [] = (string ) $ value ;
158142 return '? ' ;
159143 }
160144
0 commit comments