src/Titon/Db/Driver/AbstractPdoDriver.php
public function resolveBind($field, $value, array $schema = []) {
        $type = null;

        // Exit early for functions since we don't have a valid field
        if ($field instanceof Func) {
            return [$value, $this->resolveType($value)];
        }

        // Use the raw value for binding
        if ($value instanceof RawExpr) {
            $value = $value->getValue();
        }

        // Type cast
        if ($value === null) {
            $type = PDO::PARAM_NULL;

        } else if (isset($schema[$field]['type'])) {
            $dataType = $this->getType($schema[$field]['type']);
            $value = $dataType->to($value);
            $type = $dataType->getBindingType();
        }

        // Fallback and resolve
        if (!$type) {
            $type = $this->resolveType($value);
        }

        return [$value, $type];
    }
public function resolveBind($field, $value, array $schema = []) {
        $type = null;

        // Exit early for functions since we don't have a valid field
        if ($field instanceof Func) {
            return [$value, $this->resolveType($value)];
        }

        // Use the raw value for binding
        if ($value instanceof RawExpr) {
            $value = $value->getValue();
        }

        // Type cast
        if ($value === null) {
            $type = PDO::PARAM_NULL;

        } else if (isset($schema[$field]['type'])) {
            $dataType = $this->getType($schema[$field]['type']);
            $value = $dataType->to($value);
            $type = $dataType->getBindingType();
        }

        // Fallback and resolve
        if (!$type) {
            $type = $this->resolveType($value);
        }

        return [$value, $type];
    }
public function resolveBind ( $ field , $ value , array $ schema = [ ] ) { $ type = null ; // Exit early for functions since we don't have a valid field if ( $ field instanceof Func ) { return [ $ value , $ this -> resolveType ( $ value ) ] ; } // Use the raw value for binding if ( $ value instanceof RawExpr ) { $ value = $ value -> getValue ( ) ; } // Type cast if ( $ value === null ) { $ type = PDO :: PARAM_NULL ; } else if ( isset ( $ schema [ $ field ] [ 'type' ] ) ) { $ dataType = $ this -> getType ( $ schema [ $ field ] [ 'type' ] ) ; $ value = $ dataType -> to ( $ value ) ; $ type = $ dataType -> getBindingType ( ) ; } // Fallback and resolve if ( ! $ type ) { $ type = $ this -> resolveType ( $ value ) ; } return [ $ value , $ type ] ; }
Resolve the bind value and the PDO binding type.

@param string $field
@param mixed $value
@param array $schema
@return array
Resolve the bind value and the PDO binding type .