File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,19 @@ public function _execute(array $data): bool
6666 throw new BadMethodCallException ('You must call prepare before trying to execute a prepared statement. ' );
6767 }
6868
69- // First off -bind the parameters
70- $ bindTypes = '' ;
69+ // First off - bind the parameters
70+ $ bindTypes = '' ;
71+ $ binaryData = [];
7172
7273 // Determine the type string
73- foreach ($ data as $ item ) {
74+ foreach ($ data as $ key => $ item ) {
7475 if (is_int ($ item )) {
7576 $ bindTypes .= 'i ' ;
7677 } elseif (is_numeric ($ item )) {
7778 $ bindTypes .= 'd ' ;
79+ } elseif (is_string ($ item ) && $ this ->isBinary ($ item )) {
80+ $ bindTypes .= 'b ' ;
81+ $ binaryData [$ key ] = $ item ;
7882 } else {
7983 $ bindTypes .= 's ' ;
8084 }
@@ -83,6 +87,11 @@ public function _execute(array $data): bool
8387 // Bind it
8488 $ this ->statement ->bind_param ($ bindTypes , ...$ data );
8589
90+ // Stream binary data
91+ foreach ($ binaryData as $ key => $ value ) {
92+ $ this ->statement ->send_long_data ($ key , $ value );
93+ }
94+
8695 try {
8796 return $ this ->statement ->execute ();
8897 } catch (mysqli_sql_exception $ e ) {
You can’t perform that action at this time.
0 commit comments