Binds parameters into statement to create a new statement ready to execute
@return string final statement
@throws InvalidParameterNumberException
3447
protected function doBind() {
        $parsed = self::$parser->parse($this->statement);
        $index = 0;
        $params = $this->getParameters();
        $this->walk($parsed, $index, $params);
        return self::$creator->create($parsed);
    }
1143634
private function bindParameters()
    {
        $bindedParameterReferences = array(implode('', $this->bindedTypes));
        $lobParameters = array();
        $null = null;

        foreach ($this->bindedParameters as $key => &$parameter) {
            if (isset($this->bindedTypes[$key - 1])
                && ($this->bindedTypes[$key - 1] === self::$mappedTypes[\PDO::PARAM_LOB])) {
                $lobParameters[$key - 1] = $parameter;
                $bindedParameterReferences[$key] = &$null;
            } else {
                $bindedParameterReferences[$key] = &$parameter;
            }
        }

        call_user_func_array(array($this->mysqliStatement, 'bind_param'), $bindedParameterReferences);

        foreach ($lobParameters as $key => $lobParameter) {
            rewind($lobParameter);

            while (!feof($lobParameter)) {
                $this->mysqliStatement->send_long_data(
                    $key,
                    fread($lobParameter, $this->connection->getMaxAllowedPacket())
                );
            }
        }
    }
1134089
public function compile()
    {
        $value = $this->value();

        if ( ! empty($this->parameters))
        {
            $params = $this->parameters;
            $value = strtr($value, $params);
        }

        return $value;
    }
356196
public function bindExecute($query, $parameters = [])
    {
        $statement = $this->link->prepare($query);

        foreach ($parameters as $index => $paramProperties) {
            if (is_object($paramProperties)) {
                $paramProperties = (array) $paramProperties;
            }
            if (is_array($paramProperties)) {
                $statement->bindValue(
                    (int) $index + 1,
                    $paramProperties['value'],
                    $paramProperties['param']
                );
            } else {
                $statement->bindValue((int) $index + 1, $paramProperties);
            }
        }

        $statement->execute();

        return $statement->rowCount();
    }
1130589
protected function doInsert()
    {
        /**
         * Run pre-INSERT logic
         */
        $this->beforeInsert();

        $data = $this->toArray();
        /**
         * Execute validator logic
         * Can throw ValidatorException
         */
        $this->assert($data);

        $table = $this->getTable();

        /**
         * Execute the INSERT (this may throw an exception)
         */
        $primaryKey = $table::insert($data);

        /**
         * Normalize the result to an array indexed by primary key column(s)
         */
        $tempPrimaryKey = $table->getPrimaryKey();
        $newPrimaryKey = [current($tempPrimaryKey) => $primaryKey];

        /**
         * Save the new primary key value in object. The primary key may have
         * been generated by a sequence or auto-increment mechanism, and this
         * merge should be done before the afterInsert() method is run, so the
         * new values are available for logging, etc.
         */
        $this->setFromArray($newPrimaryKey);

        /**
         * Run post-INSERT logic
         */
        $this->afterInsert();

        /**
         * Update the "clean" to reflect that the data has been inserted.
         */
        $this->clean = $this->toArray();

        return $newPrimaryKey;
    }
647128
public FunctionCall bindParameter(Number number) {
		int pos = bindings.size();
		String parameterName = function.getNthParameter(pos);
		bindings.put(parameterName, number);
		return this;
	}
821306
public function bindValue($parameter, $value, int $dataType = \PDO::PARAM_STR): bool
    {
        return $this->statement->bindValue($parameter, $value, $dataType);
    }
966858
public function _execute(array $params = null)
    {
        if (!$this->_stmt) {
            return false;
        }

        // if no params were given as an argument to execute(),
        // then default to the _bindParam array
        if ($params === null) {
            $params = $this->_bindParam;
        }
        // send $params as input parameters to the statement
        if ($params) {
            array_unshift($params, str_repeat('s', count($params)));
            $stmtParams = array();
            foreach ($params as $k => &$value) {
                $stmtParams[$k] = &$value;
            }
            call_user_func_array(
                array($this->_stmt, 'bind_param'),
                $stmtParams
                );
        }

        // execute the statement
        $retval = $this->_stmt->execute();
        if ($retval === false) {
            /**
             * @see Zend_Db_Statement_Mysqli_Exception
             */
            // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
            throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error, $this->_stmt->errno);
        }


        // retain metadata
        if ($this->_meta === null) {
            $this->_meta = $this->_stmt->result_metadata();
            if ($this->_stmt->errno) {
                /**
                 * @see Zend_Db_Statement_Mysqli_Exception
                 */
                // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
                throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error, $this->_stmt->errno);
            }
        }

        // statements that have no result set do not return metadata
        if ($this->_meta !== false) {

            // get the column names that will result
            $this->_keys = array();
            foreach ($this->_meta->fetch_fields() as $col) {
                $this->_keys[] = $this->_adapter->foldCase($col->name);
            }

            // set up a binding space for result variables
            $this->_values = array_fill(0, count($this->_keys), null);

            // set up references to the result binding space.
            // just passing $this->_values in the call_user_func_array()
            // below won't work, you need references.
            $refs = array();
            foreach ($this->_values as $i => &$f) {
                $refs[$i] = &$f;
            }

            $this->_stmt->store_result();
            // bind to the result variables
            call_user_func_array(
                array($this->_stmt, 'bind_result'),
                $this->_values
            );
        }
        return $retval;
    }
155136
protected function bindNumericParameters(): void
    {
        $values = $this->getValues();
        $cnt    = count($values);
        for ($index0 = 0, $index1 = 1; $index0 < $cnt; $index0++, $index1++) {
            $value = $this->toScalar($values[$index0]);
            $this->getWrappedStatement()->bindValue($index1, $value, $this->getPdoType($value));
        }
    }
455064
public function bindValues($statement, $bindings)
    {
        foreach ($bindings as $key => $value) {
            $statement->bindValue(
                is_string($key) ? $key : $key + 1, $value,
                is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR
            );
        }
    }
671435
public static BoundStatement bind(PreparedStatement statement, Object[] params) {
        if(CQL_LOGGER.isDebugEnabled()) {
            CQL_LOGGER.debug("{} parameters ({})", statement.getQueryString(), StringUtils.join(params, ","));
        }
        return statement.bind(params);
    }
1048020
public function bindParam($paramno, &$param, $type = null, $maxlen = null, $driverdata = null)
    {
        $log = 'Binding Parameters: ' . $paramno . '=' . $param;
        if (!is_null($type)) {
            $log .= '| Type: ' . $type;
        }
        if (!is_null($maxlen)) {
            $log .= '| Maxlen: ' . $maxlen;
        }

        if (!is_null($driverdata)) {
            $log .= '| DriverData: ' . $driverdata;
        }
        $this->connection->writeToLog($log);

        if (!empty($type)) {
            return parent::bindParam($paramno, $param, $type, $maxlen, $driverdata);
        }

        return parent::bindParam($key, $val);
    }
171671
public function prepare($statement, $options = null)
    {
        $options = is_null($options) ? [] : $options;
        if (strpos($statement, ':') !== false) {
            $i = 0;
            $bindKeyMap = [];
            $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function ($matches) use (&$i, &$bindKeyMap) {
                $bindKeyMap[$matches[1]] = $i++;

                return '?';
            }, $statement);
        }

        $stmtObj = $this->client->prepare($statement);

        if ($stmtObj) {
            $stmtObj->bindKeyMap = $bindKeyMap ?? [];

            return new PDOStatement($this, $stmtObj, $options);
        } else {
            $statementException = new StatementException($this->client->error, $this->client->errno);
            throw new QueryException($statement, [], $statementException);
        }
    }
25806
private function bindFields()
    {
        foreach ($this->fields as $key => $value) {
            $this->statement->bindValue(':' . $key, $value);
        }
    }
1179012
private function createStatement()
    {
        $this->wrappedStatement = $this->connection->prepareUnwrapped($this->sql);
        foreach ($this->params as $params) {
            $this->bindParam(...$params);
        }
        $this->params = [];
        foreach ($this->values as $values) {
            $this->bindValue(...$values);
        }
        $this->values = [];
    }
1342024
private function doStoreStatements($statements, $method = 'post', $parameters = array(), $validStatusCode = 200)
    {
        $attachments = array();

        if (is_array($statements)) {
            foreach ($statements as $statement) {
                if (null !== $statement->getAttachments()) {
                    foreach ($statement->getAttachments() as $attachment) {
                        if ($attachment->getContent()) {
                            $attachments[] = $attachment;
                        }
                    }
                }
            }

            $serializedStatements = $this->statementSerializer->serializeStatements($statements);
        } else {
            if (null !== $statements->getAttachments()) {
                foreach ($statements->getAttachments() as $attachment) {
                    if ($attachment->getContent()) {
                        $attachments[] = $attachment;
                    }
                }
            }

            $serializedStatements = $this->statementSerializer->serializeStatement($statements);
        }

        $headers = array();

        if (!empty($attachments)) {
            $builder = new MultipartStatementBody($serializedStatements, $attachments);
            $headers = array(
                'Content-Type' => 'multipart/mixed; boundary='.$builder->getBoundary(),
            );
            $body = $builder->build();
        } else {
            $body = $serializedStatements;
        }

        $request = $this->requestHandler->createRequest(
            $method,
            'statements',
            $parameters,
            $body,
            $headers
        );
        $response = $this->requestHandler->executeRequest($request, array($validStatusCode));
        $statementIds = json_decode((string) $response->getBody());

        if (is_array($statements)) {
            /** @var Statement[] $statements */
            $createdStatements = array();

            foreach ($statements as $index => $statement) {
                $createdStatements[] = $statement->withId(StatementId::fromString($statementIds[$index]));
            }

            return $createdStatements;
        } else {
            /** @var Statement $statements */

            if (200 === $validStatusCode) {
                return $statements->withId(StatementId::fromString($statementIds[0]));
            } else {
                return $statements;
            }
        }
    }
426759
protected function doInsert()
    {
        //check if there is an error from previous function execution
        if (static::$response["status"] == "error") {
           return static::terminate(static::$response);
        }
        //convert each columns to ? parameter
        $columnParam = array_map(function () {
            return '?';
        }, $this->values);


        $sql = /** @lang sql */
            'INSERT INTO ' . self::$table .
            ' (' . $this->columns .
            ') VALUES(' . implode(',', $columnParam) . ')';

            $ext=array_map(function ($column){
                return $column.'=VALUES('.$column.')';
            },explode(',',$this->columns));
            if($this->updateOrInsert){ //if update when duplicate is found is set to true
                $sql.=' ON DUPLICATE KEY UPDATE '.implode(',',$ext);
            }

        try {
            $stm = Connect::getConn()->prepare($sql);
        } catch (Exception $e) {
            static::$response["status"] = "error";
            static::$response["response"] = $e->getMessage();
            static::$response["code"] = $e->getCode();
           return static::terminate(static::$response);
        }

        try {
            $stm->execute($this->values);

            static::$response["status"] = "success";
            static::$response["response"] = "success";
            static::$response["code"] = 200;

            return static::terminate(static::$response);
        } catch (Exception $e) {
            static::$response["status"] = "error";
            static::$response["response"] = $e->getMessage();
            static::$response["code"] = $e->getCode();
            return static::terminate(static::$response);
        }
    }