public function __construct(Adapter $adapter, $table, array $fields, Where $where, Options $options) { parent::__construct($adapter, $table); $this->fields = $fields; $this->bound = array_merge($this->bound, $where->getBindings(), $options->getBindings()); $this->where = $where; $this->options = $options; }
/** * Insert a row into the database. * * @param Dabble\Adapter $adapter The adapter to use. * @param string $table The table to insert into. * @param array $fields Array of Field => value pairs to insert. * @return mixed The last inserted serial, or 0 or true if none found. * @throws Dabble\Query\InsertException if no rows were inserted. * @throws Dabble\Query\SqlException on error. */ public function __construct(Adapter $adapter, $table, array $fields) { parent::__construct($adapter, $table); $use = []; foreach ($fields as $name => $field) { if (is_null($field)) { continue; } $use[$name] = $field; } if (!$use) { throw new InsertException("No fields to bind; did you pass only NULL values?"); } $this->fields = $this->prepareBindings($use); }
public function __construct(Adapter $adapter, $table, Where $where) { parent::__construct($adapter, $table); $this->where = $where; $this->bound = $where->getBindings(); }