Run INSERT with the current values

@return  bool|int    Last inserted ID (if present) or false on failure
169083
public function insert()
	{
		$res = \DB::insert(call_user_func($this->model.'::table'), array_keys($this->values))
			->values(array_values($this->values))
			->execute($this->write_connection);

		// Failed to save the new record
		if ($res[1] === 0)
		{
			return false;
		}

		return $res[0];
	}
421888
public function put($data)
    {
        if (empty($data) or !is_array($data))
        {
            return false;
        }
        if ($this->db->insert($data, $this->table))
        {
            $lastInsertId = $this->db->lastInsertId();
            if ($lastInsertId == 0)
            {
                return true;
            }
            else
            {
                return $lastInsertId;
            }
        }
        else
        {
            return false;
        }
    }
1355745
public function last_insert_id( Statement $statement = NULL ) {

		if ( $statement && ! $this->last_statement === $statement )
			return FALSE;

		return $this->last_insert_id;
	}
319164
function save()
    {
        if ($this->id != false || $this->id != 0) {
            return $this->update();
        } else {
            return $this->insert();
        }
    }
1202648
final public function current()
    {
        if (!$this->valid()) {

            return null;
        }

        /*
         * Multiple calls to current() should be idempotent
         */
        if ($this->_lastPositionExecuted !== $this->_position) {

            $this->runToNextYieldStatement();
        }

        return $this->valid() ? $this->getLastYieldedValue() : null;
    }
417855
public function lastInsertID()
    {
        if (isset($this->persistence) && $this->persistence instanceof Persistence\SQL) {
            return $this->persistence->connection->lastInsertId($this);
        }

        throw new Exception('Model is not associated with SQL-enabled persistence');
    }
18228
public function save()
    {
        // Validate
        if (!$this->validates()) {
            return false;
        }

        // Run filter
        $this->runFilters('before', $this->_isNew ? 'create' : 'save');

        // Get data
        $data = static::data();

        // Create
        if ($this->_isNew) {
            $result = static::connection()
                ->insert($data)
                ->into(static::table())
                ->exec();

            $this->id = static::connection()->lastInsertId();
        }
        // Update
        else {
            $result = static::connection()
                ->update(static::table())
                ->set($data)
                ->where(static::$_primaryKey . ' = ?', $data[static::$_primaryKey])
                ->exec();
        }

        // Run filters
        $this->runFilters('after', $this->_isNew ? 'create' : 'save');

        return $result;
    }
455547
public function insert()
    {
        self::$instance->reset();
        $this->sql('INSERT INTO ' . $this->oosql_table);

        $arg_list = func_get_args();
        $numargs = func_num_args();

        if ($numargs > 0) {
            $this->oosql_numargs = $numargs;
            $this->sql(' (');

            $this->sql(implode(',', $arg_list));

            $this->sql(')');
        }
        $this->oosql_insert = true;
        return $this;
    }
421105
protected function _buildInsert()
        {
            $query[] = "INSERT INTO";
            $query[] = $this->_quoteIdentifier($this->_table_name);
            $field_list = array_map(array($this, '_quoteIdentifier'), array_keys($this->_dirty_fields));
            $query[] = "(" . join(", ", $field_list) . ")";
            $query[] = "VALUES";

            $placeholders = $this->_createPlaceholders($this->_dirty_fields);
            $query[] = "({$placeholders})";

            if (self::get_db($this->_connection_name)->getAttribute(PDO::ATTR_DRIVER_NAME) == 'pgsql') {
                $query[] = 'RETURNING ' . $this->_quoteIdentifier($this->_getIdColumnName());
            }

            return join(" ", $query);
        }
687783
public function insert()
    {
        if (is_null($this->sth)) {
            throw new QueryFailedException();
        }

        return ($this->dbh->lastInsertId() > 0) ? $this->dbh->lastInsertId() : false;
    }
52761
public function lastInsertedId()
    {
        $query = "MATCH (n) RETURN MAX(id(n)) AS lastIdCreated";

        $statement = $this->getCypherQuery($query, []);
        $result = $statement->getResultSet();

        return $result[0][0];
    }
863754
public function insert()
    {
        $data = $this->data;
        $ret = $this->conn()->selectCollection($this->table_name)->insert($data);
        $this->sql = array('table'=> $this->table_name,'insert_data'=> $this->data);

        $this->_clear_var();
        if ($ret) {
            return $data['_id'];
        } else {
            return false;
        }
    }
670020
public function run()
    {
        $values = str_split($this->value);
        foreach ($values as $item) {
            if (ord($item) >= 127) {
                $this->value = str_replace($item, ' ', $this->value);
            }
        }

        return $this->value;
    }
903466
public function dbInsert() {
		BLog::addToLog('[Items.ItemTree]: Inserting data...');
		if (!$db = \Brilliant\BFactory::getDBO()) {
			return false;
			}
		$closeTransaction=false;

		if(!$this->isRoot){
			$db->startTransaction();
			$closeTransaction = true;
			//---------------------------------------------------
			// Try to get parent / root element, create root
			// if we does not have root element.
			//---------------------------------------------------
			BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Try to get parent / root element.');
			$parent = $this->getParentOrRoot();
			if (empty($parent)) {
				$className = get_class($this);
				if(DEBUG_LOG_BITEMS){
					BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Parent is empty. Need to insert parent element ('.$className.')');
					}
				$parent = new $className();
				$parent->{$this->groupKeyName} = $this->{$this->groupKeyName};
				$parent->{$this->leftKeyName} = 1;
				$parent->{$this->rightKeyName} = 4;
				$parent->{$this->levelKeyName} = 1;
				$parent->isRoot = true;
				$r = $parent->saveToDB();
				if(empty($r)){
					return false;
					}
				//
				$this->{$this->parentKeyName} = $parent->{$this->primaryKeyName};
				$this->{$this->groupKeyName} = $parent->{$this->groupKeyName};
				$this->{$this->leftKeyName} = 2;
				$this->{$this->rightKeyName} = 3;
				$this->{$this->levelKeyName} = 2;
				} else {
				if(DEBUG_LOG_BITEMS){
					BLog::addToLog('[Items.ItemTree.'.$this->tableName.']: Parent is not empty.');
					}
				$this->{$this->parentKeyName} = $parent->{$this->primaryKeyName};
				$this->{$this->groupKeyName} = $parent->{$this->groupKeyName};
				$this->{$this->leftKeyName} = (int)$parent->{$this->rightKeyName};
				$this->{$this->rightKeyName} = (int)$parent->{$this->rightKeyName} + 1;
				$this->{$this->levelKeyName} = (int)$parent->{$this->levelKeyName} + 1;
				$qr = 'UPDATE `' . $this->tableName . '` SET ';
				$qr .= '`' . $this->rightKeyName . '`=`' . $this->rightKeyName . '`+2, ';
				$qr .= '`' . $this->leftKeyName . '` = IF(`' . $this->leftKeyName . '` > ' . $parent->{$this->rightKeyName} . ', `' . $this->leftKeyName . '`+2, `' . $this->leftKeyName . '`)';
				$qr .= ' WHERE ((`' . $this->groupKeyName . '` = ' . $this->{$this->groupKeyName} . ') AND (`' . $this->rightKeyName . '`>=' . $parent->{$this->rightKeyName} . '))';
				$q = $db->query($qr);
				if (empty($q)) {
					$db->rollback();
					return false;
					}
				//Because some elements in our internal cache was changed - need to flush it.
				$collection=$this->getCollection();
				$collection->flushInternalCache();
				}
			}
		//---------------------------------------------------
		//Forming query...
		//---------------------------------------------------
		$this->modified = new \DateTime();
		if(empty($this->created)){
			$this->created=new \DateTime();
			}
		$qr = $this->dbInsertQuery();
		//Running query...
		$q = $db->query($qr);
		if (empty($q)) {
			if ($closeTransaction) {
				$db->rollback();
				}
			return false;
			}
		$this->{$this->primaryKeyName} = $db->insertId();
		if ($closeTransaction) {
			$db->commit();
			}
		//Updating cache...
		$this->updateCache();
		//Return result
		return true;
	}
555576
protected function _insert()
    {
        if (!$this->oxnews__oxdate || \OxidEsales\Eshop\Core\Registry::getUtilsDate()->isEmptyDate($this->oxnews__oxdate->value)) {
            // if date field is empty, assigning current date
            $this->oxnews__oxdate = new \OxidEsales\Eshop\Core\Field(date('Y-m-d'));
        } else {
            $this->oxnews__oxdate = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getUtilsDate()->formatDBDate($this->oxnews__oxdate->value, true));
        }

        return parent::_insert();
    }
503698
protected function insert_id()
    {
        $query = $this->database->getQueryCollection()->findQuery($this->strQuery);

        if ($query) {
            return $query->result()->getRow($query->result()->count());
        }

        return null;
    }
1086116
public function db_insert(){
		if(!$db=BFactory::getDBO()){
			return false;
			}
		$qr='INSERT INTO `soft_modules_alias` (alias) VALUES ('.$db->escapeString($this->alias).')';
		if(!$db->query($qr)){
			return false;
			}
		$this->id=$db->insertId();
		return true;
		}