src/Native5/Core/Database/DB.php
protected function bindValues (\PDOStatement $statement, $valArr = array()) {
        if (empty($valArr))
            return $statement;

        /**
         * valArr can be of 2 types:
         *     type1: array( array(key1, value1, PDO::PARAM_INT), array(key2, value2 // if no 3rd param consider a string //), .. )
         *     type2: array( key1 => value1, key2 => value2, key3 => value3, .. ) or
         */
        $type1 = false;
        if (isset($valArr[0]) && is_array($valArr[0]) && isset($valArr[0][0]) && isset($valArr[0][1]))
            $type1 = true;

        foreach ($valArr as $idx=>$val) {
            try {
                if ($type1)
                    $statement->bindValue(
                        $val[0],
                        $val[1],
                        ((isset($val[2]) && $this->_checkIsPDOParamConstant($val[2])) ? $val[2] : \PDO::PARAM_STR)
                    );
                else
                    $statement->bindValue(
                        $idx,
                        $val,
                        \PDO::PARAM_STR
                    );
            } catch (\PDOException $pe) {
                throw new \Exception("Error in binding parameter:: query: ".$statement->queryString.PHP_EOL."Message: ".$pe->getMessage());
            }
        }

        return $statement;
    }
protected function bindValues (\PDOStatement $statement, $valArr = array()) {
        if (empty($valArr))
            return $statement;

        /**
         * valArr can be of 2 types:
         *     type1: array( array(key1, value1, PDO::PARAM_INT), array(key2, value2 // if no 3rd param consider a string //), .. )
         *     type2: array( key1 => value1, key2 => value2, key3 => value3, .. ) or
         */
        $type1 = false;
        if (isset($valArr[0]) && is_array($valArr[0]) && isset($valArr[0][0]) && isset($valArr[0][1]))
            $type1 = true;

        foreach ($valArr as $idx=>$val) {
            try {
                if ($type1)
                    $statement->bindValue(
                        $val[0],
                        $val[1],
                        ((isset($val[2]) && $this->_checkIsPDOParamConstant($val[2])) ? $val[2] : \PDO::PARAM_STR)
                    );
                else
                    $statement->bindValue(
                        $idx,
                        $val,
                        \PDO::PARAM_STR
                    );
            } catch (\PDOException $pe) {
                throw new \Exception("Error in binding parameter:: query: ".$statement->queryString.PHP_EOL."Message: ".$pe->getMessage());
            }
        }

        return $statement;
    }
protected function bindValues ( \ PDOStatement $ statement , $ valArr = array ( ) ) { if ( empty ( $ valArr ) ) return $ statement ; /**
         * valArr can be of 2 types:
         *     type1: array( array(key1, value1, PDO::PARAM_INT), array(key2, value2 // if no 3rd param consider a string //), .. )
         *     type2: array( key1 => value1, key2 => value2, key3 => value3, .. ) or
         */ $ type1 = false ; if ( isset ( $ valArr [ 0 ] ) && is_array ( $ valArr [ 0 ] ) && isset ( $ valArr [ 0 ] [ 0 ] ) && isset ( $ valArr [ 0 ] [ 1 ] ) ) $ type1 = true ; foreach ( $ valArr as $ idx => $ val ) { try { if ( $ type1 ) $ statement -> bindValue ( $ val [ 0 ] , $ val [ 1 ] , ( ( isset ( $ val [ 2 ] ) && $ this -> _checkIsPDOParamConstant ( $ val [ 2 ] ) ) ? $ val [ 2 ] : \ PDO :: PARAM_STR ) ) ; else $ statement -> bindValue ( $ idx , $ val , \ PDO :: PARAM_STR ) ; } catch ( \ PDOException $ pe ) { throw new \ Exception ( "Error in binding parameter:: query: " . $ statement -> queryString . PHP_EOL . "Message: " . $ pe -> getMessage ( ) ) ; } } return $ statement ; }
bindValues Bind values to a prepared statement

@param object $statement PDOStatement object
@param array $valArr array with statment placeholders mapped to values to bind

@access protected
@return object prepared statement with bound values
@throws Exception if could not bind parameter to statement successfuly
bindValues Bind values to a prepared statement