Persists the current site view to database

@return bool
760015
public function saveCurrent()
    {
        if ($this->saveEnabled() && $this->isViewValid() && $this->isViewUnique())
        {
            $success = $this->saveCurrentModel();

            // Keep on only if the model save has succeeded
            if ($success)
            {
                $this->storeCurrentHash();

                $this->saveTrackables(
                    $this->getCurrent(),
                    $success
                );
            }

            return $success;
        }

        return false;
    }
1299866
public function saveToDB() {
		BLog::addToLog('[Items.Item.' . $this->tableName . ']: saveToDB()');
		if ($this->isNew) {
			return $this->dbInsert();
		} else {
			return $this->dbupdate();
		}
	}
1051928
public function persist()
    {

        $blob = $this->serializer->serialize($this->_attributes, $this->serializeOptions);

        $result = (bool)$this->filesystem->write($this->url, $blob, $this->getOption('file_locking'));

        if (!$hashMethod = $this->getOption('checksum_method')) {
            return $result;
        }

        $checksum = $this->createChecksum($hashMethod, $blob);

        $savedBlob = $this->filesystem->read($this->url);

        $this->checkData($hashMethod, $savedBlob, $checksum);

        return $result;
    }
614154
public function store()
    {
        if (!$this->_runtime_queries || $this->already_saved) {
            // No queries to save or already saved
            return;
        }

        // Prevent recursive saves
        $this->already_saved = true;

        $path = defined('PATH') ? PATH : (defined('PATH_INTERNAL') ? PATH_INTERNAL : '');

        $objects = [];
        foreach ($this->_runtime_queries as $query) {
            $query_obj = new DbQueryAnalyzerEntity;
            $query_obj->loadDataFromArray([
                'hash' => md5($query['query']),
                'query' => $query['query'],
                'tt' => round($query['run_time'], 3),
                'path' => $path,
            ]);

            $objects[] = $query_obj;
        }

        // Reset queue
        $this->_runtime_queries = [];

        // Save collected objects
        if ($objects) {
            $query_repository = new DbQueryAnalyzerEntityRepository;
            $query_repository->setCollectedObjects($objects);
            $query_repository->save(); // Save all objects
        }
    }
363855
public function Save(){
        if($this->transactionActive) {
            try {
                $this->commit();
                $this->exec("SET FOREIGN_KEY_CHECKS = 1;");
            } catch (\Exception $e) {
                $this->rollBack();
                echo $e->getMessage();
            }

            $this->transactionActive = false;
        }

        return false;
    }
494465
public function save()
    {
        $this->load();
        // Do the work in case we have only changed hash
        if ($this->isChanged()) {
            @chmod($this->path, 0777);
            return file_put_contents($this->path, $this->fileType->render($this->config));
        } else {
            return true;
        }
    }
1293270
public function persist()
    {

        $this->ensureRootDirectory();

        $someoneSaved = false;
        foreach ($this->storages as $url=>$storage) {
            $this->ensureStorageDirectory($url);
            if ($storage->persist()) {
                $someoneSaved = true;
            }
        }

        foreach ($this->purgeQueue as $url) {
            $storage = $this->getOrCreateStorage($url);
            if ($storage->purge()) {
                $someoneSaved = true;
            }
            $this->removeStorageIfLoaded($url);
        }

        $this->purgeQueue = [];

        return $someoneSaved;
    }
1284374
public function saveToDB(){
		//Validate...
		if(empty($this->alias)){
			return false;
			}
		//Save to db...
		if(empty($this->id)){
			return $this->db_insert();
			}
		return $this->db_update();
		}
1274016
public function persist(): bool
    {
        $success = true;
        foreach ($this->values as $key => $value) {
            $success &= $this->writeOption($key, $value);
        }

        return $success;
    }
321877
public function save()
    {
        $sQuery = $this->_prepare();

        if (preg_match('/INSERT INTO/i', $sQuery)) {

            $oDb = self::connect();

            if (!$oDb->exec($sQuery)) {
                error_log($sQuery."\n".print_r($oDb->errorInfo(), true));
            }

            $this->flush();
            return $oDb->lastInsertId();
        }
        else {

            $this->flush();

            if ($this->_mWhere instanceof Where) { $this->_mWhere->flush(); }

            return self::connect()->exec($sQuery);
        }

    }
879591
protected function saveCodeToDatabase()
    {
        $success = false;
        $this->openDatabase();

        if ($this->use_database && $this->pdo_conn) {
            $id = $this->getCaptchaId(false);
            $ip = $_SERVER['REMOTE_ADDR'];

            if (empty($id)) {
                $id = $ip;
            }

            $time      = time();
            $code      = $this->code;
            $code_disp = $this->code_display;

            // This is somewhat expensive in PDO Sqlite3 (when there is something to delete)
            // Clears previous captcha for this client from database so we can do a straight insert
            // without having to do INSERT ... ON DUPLICATE KEY or a find/update
            $this->clearCodeFromDatabase();

            $query = "INSERT INTO {$this->database_table} ("
                    ."id, code, code_display, namespace, created) "
                    ."VALUES(?, ?, ?, ?, ?)";

            $stmt    = $this->pdo_conn->prepare($query);
            $success = $stmt->execute(array($id, $code, $code_disp, $this->namespace, $time));

            if (!$success) {
                $err   = $stmt->errorInfo();
                $error = "Failed to insert code into database. {$err[1]}: {$err[2]}.";

                if ($this->database_driver == self::SI_DRIVER_SQLITE3) {
                    $err14 = ($err[1] == 14);
                    if ($err14) $error .= sprintf(" Ensure database directory and file are writeable by user '%s' (%d).",
                                                   get_current_user(), getmyuid());
                }

                trigger_error($error, E_USER_WARNING);
            }
        }

        return $success !== false;
    }
1311433
def save(self, update_site=False, *args, **kwargs):
        
        if update_site or (self.id is None and self.site_id is None):
            self.site_id = current_site_id()
        super(SiteRelated, self).save(*args, **kwargs)
999990
public function save()
	{
		$this->db->begin();
		foreach($this->data as $item)
		{
			$this->db->insert($this->tableName,$item);
		}
		$this->db->commit();
		return true;
	}
1371781
public function save()
	{
		$sQuery = $this->_prepare();

		if (preg_match('/INSERT INTO/i', $sQuery)) {

			$oDb = self::connect();
			$oDb->exec($sQuery);
			$this->flush();
			return $oDb->lastInsertId();
		}
		else {

			$this->flush();

			if ($this->_mWhere instanceof Where) { $this->_mWhere->flush(); }

			return self::connect()->exec($sQuery);
		}

	}
1227106
public function save() {
        global $DB;
        if (!$this->dirty) {
            return true;
        }
        $fordb = new StdClass();
        foreach (array('id', 'name', 'plugin', 'visible') as $field) {
            $fordb->{$field} = $this->{$field};
        }
        $DB->update_record('portfolio_instance', $fordb);
        $this->dirty = false;
        return true;
    }
883558
public function save()
    {
        $di = DI::getDefault();

        $database = $di->getService( "database" );

        /**
         * Decide if we should update or insert
         * (if we know the record exists in the database...)
         */
        if ( $this->_exists_in_db )
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "update", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Add "snap_" prefix to the snapshot in order to not get index conflict when we merge attributes and snapshot
             */
            $snapshot = array();
            
            foreach ( $this->_snapshot as $key => $value )
            {
                $snapshot["snap_" . $key] = $value;
            }
            
            /**
             * Merge our binding parameters.
             * Bind the parameters to the query and return the result.
             */
            return $query->execute( array_merge($attributes, $snapshot) );
        }
        else
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "insert", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Bind the parameters and return the result
             */
            return $query->execute( $attributes );
        }
    }
1097848
protected function getCachedView()
    {
        if ($this->hasCachedView()) {
            $key = $this->getCacheKey();

            return $this->cache->get($key);
        }

        return false;
    }