Add data to table

@param  string|null  $data
@param  string|null  $sqlQuery
@rturn  bool
505439
public function add($data, $sqlQuery = false)
    {
        if(!is_array($data) || count($data) == 0) {
            echo 'no data to save'; //no argument
            exit;
        }
        $sql = $this->buildQuery('insert', $data);
        if($sqlQuery === true) {
            return $this->getQuery();
        }
        $result = $this->executeQuery($sql);
        return $result;
    }
209783
public function add($data = [])
    {
        $insertId = $this->db->insert($this->table, $data);
        if ($insertId) {
            return (int) $insertId;
        }

        return 0;
    }
108590
private function executeQuery($query, $data = null) {
        $stmt = $this->conn->prepare($query);
        $stmt->execute($data);
        
        return $stmt;
    }
828579
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('country.add.before', $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $result = true;
        $this->db->insert('country', $data);
        $this->hook->attach('country.add.after', $data, $result, $this);
        return (bool) $result;
    }
103331
public function do(String $app = NULL, $key, String $data = NULL) : Bool
    {
        return (new Insert)->do($app, $key, $data);
    }
1169390
final public function create(array $data)
    {
        $this->query->setStartInsert($data);
        
        $this->query->prepare()->bindValuesForInsert($data)->execute();

        $this->setRowCount();

        $this->query->close();
    }
1131322
protected function _composeInsertQuery(SQL $SQL){

		$query_pre = "INSERT INTO `$this->_table`";

		if(empty($this->_fields)){

			throw new QueryBuilderException(
				'No fields specified for SQL query'
			);
		}

		$fields = [];
		$updates = [];

		foreach($this->_fields as $field => $value){

			$prepared = $this->_prepareValue($value, $SQL);

			$fields[$field] = $prepared;
			$updates[] = "$field = $prepared";
		}

		$query_fields = '(' . implode(', ', array_keys($fields)) . ')';
		$query_values = '(' . implode(', ', $fields) . ')';
		$query_updates = implode(', ', $updates);

		return "{$query_pre}
			{$query_fields} VALUES {$query_values}
			ON DUPLICATE KEY UPDATE {$query_updates}
		";
	}
1362437
public static function update($sqlstatement, array $data = [])
    {
        static::verifyConnection();

        if (preg_match("/^update\s[\w\d_`]+\s\bset\b\s.+\s\bwhere\b\s.+$/i", $sqlstatement)) {
            return static::executePrepareQuery($sqlstatement, $data);
        }

        return false;
    }
637024
public function addView($view, $data = null)
    {
        if(!is_object($view))
            $view = new \erdiko\core\View($view, $data);
        if($data != null)
            $view->setData($data);
        
        $this->appendContent($view->toHtml());
    }
714702
function create(array $data = null, $returning = "*") {
		$query = $this->getQueryWriter()->reset();
		$query->write("INSERT INTO", $this->conn->quoteName($this->name));
		if ($data) {
			$first = true;
			$params = array();
			foreach ($data as $key => $val) {
				$query->write($first ? "(" : ",", $key);
				$params[] = $query->param($val, $this->getAttributes()->getColumn($key)->type);
				$first and $first = false;
			}
			$query->write(") VALUES (", $params, ")");
		} else {
			$query->write("DEFAULT VALUES");
		}
		
		if (strlen($returning)) {
			$query->write("RETURNING", $returning);
		}
		return $this->execute($query);
	}
62840
protected function insertTableData(& $data, $useQueue = true)
    {
        $job = new DBInsert($this->service->getName(), $this->resource, $data);
        if ($useQueue !== true) {
            $job->onConnection('sync');
        }

        dispatch($job);
        $data = [];
    }
1112674
public function update(string $value, array $data, string $key = null)
    {
        // Initialize the set string to null
        $set = null;

        // Loops on the new data
        foreach ($data as $dataKey => $dataValue) {

            // Creates the set string
            $set .= $dataKey . ' = "' . $dataValue . '", ';
        }
        // Cuts the comma & the space at the end
        $set = substr_replace($set, '', -2);

        // Checks if a key was given
        if (isset($key)) {

            // Any key could be use in the where clause
            $query = 'UPDATE ' . $this->table . ' SET ' . $set . ' WHERE ' . $key . ' = ?';
        } else {
            // The id key would be use in the where clause
            $query = 'UPDATE ' . $this->table . ' SET ' . $set . ' WHERE id = ?';
        }
        // Executes the query
        $this->database->action($query, [$value]);
    }
397875
public function populate($data = array())
    {
        $this->pageId = (isset($data['pageId'])) ? $data['pageId'] : null;
        $this->pageName = (isset($data['pageName'])) ? $data['pageName'] : null;
        $this->pageLink = (isset($data['pageLink'])) ? $data['pageLink'] : null;

    }
633700
public function insertBatch(string $table, $data=[]): ?PDOStatement
	{
		// Get the generated values and sql string
		[$sql, $data] = $this->driver->insertBatch($table, $data);

		return $sql !== NULL
			? $this->_run('', $table, $sql, $data)
			: NULL;
	}
1178720
public function insert($columns = null, $data = null) {
        $sql = $this->grammar()->compileInsert($this, $columns, $data);
        return $this->command()
            ->insert($sql, $this->getBindings());
    }
1029647
public function addQueries(array $queries = array()) {
	    foreach($queries as $queryInfo) {
	        $batchAction = (isset($queryInfo[1])) ? $queryInfo[1] : null;
	        $this->addQuery($queryInfo[0], $batchAction);
	    }
	}
93662
private function sendQuery($query, array $data = null) {
        if (!is_null($data)) {
            $Template = new QueryTemplate();
            $Template->load($query);
            pg_send_query($this->Resource, $Template->parse($data));
        } else {
            pg_send_query($this->Resource, $query);
        }
    }