@@ -414,11 +414,11 @@ protected function parseSet($data)
414414 } elseif (is_scalar ($ val )) {
415415 // 过滤非标量数据
416416 if (0 === strpos ($ val , ': ' ) && in_array ($ val , array_keys ($ this ->bind ))) {
417- $ set [] = $ this ->parseKey ($ key ) . '= ' . $ this -> escapeString ( $ val) ;
417+ $ set [] = $ this ->parseKey ($ key ) . '= ' . $ val ;
418418 } else {
419419 $ name = count ($ this ->bind );
420- $ set [] = $ this ->parseKey ($ key ) . '=: ' . $ name ;
421- $ this ->bindParam ($ name , $ val );
420+ $ set [] = $ this ->parseKey ($ key ) . '=: ' . $ key . ' _ ' . $ name ;
421+ $ this ->bindParam ($ key . ' _ ' . $ name , $ val );
422422 }
423423 }
424424 }
@@ -443,7 +443,7 @@ protected function bindParam($name, $value)
443443 * @param string $key
444444 * @return string
445445 */
446- protected function parseKey (& $ key )
446+ protected function parseKey ($ key )
447447 {
448448 return $ key ;
449449 }
@@ -522,8 +522,7 @@ protected function parseTable($tables)
522522 }
523523 $ tables = $ array ;
524524 } elseif (is_string ($ tables )) {
525- $ tables = explode (', ' , $ tables );
526- array_walk ($ tables , array (&$ this , 'parseKey ' ));
525+ $ tables = array_map (array ($ this , 'parseKey ' ), explode (', ' , $ tables ));
527526 }
528527 return implode (', ' , $ tables );
529528 }
@@ -909,11 +908,11 @@ public function insert($data, $options = array(), $replace = false)
909908 // 过滤非标量数据
910909 $ fields [] = $ this ->parseKey ($ key );
911910 if (0 === strpos ($ val , ': ' ) && in_array ($ val , array_keys ($ this ->bind ))) {
912- $ values [] = $ this -> parseValue ( $ val) ;
911+ $ values [] = $ val ;
913912 } else {
914913 $ name = count ($ this ->bind );
915- $ values [] = ': ' . $ name ;
916- $ this ->bindParam ($ name , $ val );
914+ $ values [] = ': ' . $ key . ' _ ' . $ name ;
915+ $ this ->bindParam ($ key . ' _ ' . $ name , $ val );
917916 }
918917 }
919918 }
@@ -982,8 +981,8 @@ public function selectInsert($fields, $table, $options = array())
982981 $ fields = explode (', ' , $ fields );
983982 }
984983
985- array_walk ( $ fields, array ($ this , 'parseKey ' ));
986- $ sql = 'INSERT INTO ' . $ this ->parseTable ($ table ) . ' ( ' . implode (', ' , $ fields ) . ') ' ;
984+ $ fields = array_map ( array ($ this , 'parseKey ' ), $ fields );
985+ $ sql = 'INSERT INTO ' . $ this ->parseTable ($ table ) . ' ( ' . implode (', ' , $ fields ) . ') ' ;
987986 $ sql .= $ this ->buildSelectSql ($ options );
988987 return $ this ->execute ($ sql , !empty ($ options ['fetch_sql ' ]) ? true : false );
989988 }
0 commit comments