| | |
| | | $sTxt = $this->escape($sValue); |
| | | |
| | | $sTxt = str_replace('`', '', $sTxt); |
| | | if(strpos($sTxt, '.') !== false) $sTxt = preg_replace('/^(.+)\.(.+)$/', '`$1`.`$2`', $sTxt); |
| | | else $sTxt = '`' . $sTxt . '`'; |
| | | if(strpos($sTxt, '.') !== false) { |
| | | $sTxt = preg_replace('/^(.+)\.(.+)$/', '`$1`.`$2`', $sTxt); |
| | | $sTxt = str_replace('.`*`', '.*', $sTxt); |
| | | } else $sTxt = '`' . $sTxt . '`'; |
| | | |
| | | $sQuery = substr_replace($sQuery, $sTxt, $iPos2, 2); |
| | | $iPos2 += strlen($sTxt); |
| | |
| | | } |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | public function insertFromArray($tablename, $data) { |
| | | if(!is_array($data)) return false; |
| | | |
| | | $k_query = ''; |
| | | $v_query = ''; |
| | | |
| | | $params = array($tablename); |
| | | $v_params = array(); |
| | | |
| | | foreach($data as $key => $value) { |
| | | $k_query .= ($k_query != '' ? ', ' : '') . '??'; |
| | | $v_query .= ($v_query != '' ? ', ' : '') . '?'; |
| | | $params[] = $key; |
| | | $v_params[] = $value; |
| | | } |
| | | |
| | | $query = 'INSERT INTO ?? (' . $k_query . ') VALUES (' . $v_query . ')'; |
| | | return $this->query($query, true, $params + $v_params); |
| | | } |
| | | |
| | | public function diffrec($record_old, $record_new) { |
| | | $diffrec_full = array(); |
| | | $diff_num = 0; |