public function insert_audit($table = '', $record = NULL) { $this->_reset_write(); if (!is_null($record)) { $this->set($record); } //print_r(array_keys($this->ar_set)); if (count($this->ar_set) == 0) { if ($this->db_debug) { return $this->display_error('db_must_use_set'); } return FALSE; } if ($table == '') { if (!isset($this->ar_from[0])) { if ($this->db_debug) { return $this->display_error('db_must_set_table'); } return FALSE; } $table = $this->ar_from[0]; } //execute parent sql $sql = parent::_insert($table, array_keys($this->ar_set), array_values($this->ar_set)); $this->_reset_write(); return $this->query($sql); }
public final function __construct($params) { parent::__construct($params); }
/** http://stackoverflow.com/questions/6470267/grouping-where-clauses-in-codeigniter * This function will allow you to do complex group where clauses in to c and (a AND b) or ( d and e) * This function is needed as else the where clause will append an automatic AND in front of each where Thus if you wanted to do something * like a AND ((b AND c) OR (d AND e)) you won't be able to as the where would insert it as a AND (AND (b...)) which is incorrect. * Usage: start_group_where(key,value)->where(key,value)->close_group_where() or complex queries like * open_bracket()->start_group_where(key,value)->where(key,value)->close_group_where() * ->start_group_where(key,value,'','OR')->close_group_where()->close_bracket() would produce AND ((a AND b) OR (d)) * @param $key mixed the table columns prefix.columnname * @param $value mixed the value of the key * @param $escape string any escape as per CI * @param $type the TYPE of query. By default it is set to 'AND' * @return db object. */ public function start_group_where($key, $value = NULL, $escape = NULL, $type = "AND") { $this->open_bracket($type); return parent::_where($key, $value, '', $escape); }