/** * @param $row * @return bool|mixed */ public function insert($row, $insertMethod = 'INSERT') { $row = $this->objToRel($row); // This allows for dummy columns to be part of the object without the // DAO automatically accessing them in the queries. if ($this->ignoreCols != null) { foreach ($this->ignoreCols as $ignoreCol) { unset($row[$ignoreCol]); } } if (Cfg::get('jb_db', false)) { $pKey = DBMaintenance::dbNextNumber($this->db, $this->tableName); $row[$this->primaryKey] = $pKey; } $keys = array_keys($row); $values = array_values($row); $sql = $insertMethod . ' INTO ' . $this->tableName . ' (' . join(',', $keys) . ') VALUES (' . DB::in($values) . ')'; if (DB::exec($this->db, $sql, $values) != 1) { return false; } if (!Cfg::get('jb_db', false)) { $pKey = DB::lastInsertId($this->db); } return $pKey; }