/**
  * Bind a value of the column or field table
  * @access public
  * @param string $column
  * @param mixed $param
  * @param string $type
  * @return void 
  */
 public function bindColumn($column, &$param, $type = null)
 {
     if ($type === null) {
         $this->_statement->bindColumn($column, $param);
     } else {
         $this->_statement->bindColumn($column, $param, $type);
     }
 }
예제 #2
0
 /**
  * @covers Fabfuel\Prophiler\Decorator\PDO\PDOStatement::bindColumn
  * @uses Fabfuel\Prophiler\Decorator\PDO\PDOStatement
  */
 public function testBindColumn()
 {
     $column = 'foo';
     $param = 'bar';
     $type = \PDO::PARAM_STR;
     $maxlen = 15;
     $driverdata = 'lorem ipsum';
     $this->pdoStatement->expects($this->once())->method('bindColumn')->with($column, $param, $type, $maxlen, $driverdata)->willReturn(true);
     $this->assertTrue($this->decorator->bindColumn($column, $param, $type, $maxlen, $driverdata));
 }
예제 #3
0
 /**
  * Bind a column of the statement result set to a PHP variable.
  *
  * @param string $column Name the column in the result set, either by
  *                       position or by name.
  * @param mixed  $param  Reference to the PHP variable containing the value.
  * @param mixed  $type   OPTIONAL
  * @return bool
  * @throws Zend_Db_Statement_Exception
  */
 public function bindColumn($column, &$param, $type = null)
 {
     try {
         if (is_null($type)) {
             return $this->_stmt->bindColumn($column, $param);
         } else {
             return $this->_stmt->bindColumn($column, $param, $type);
         }
     } catch (PDOException $e) {
         require_once 'Zend/Db/Statement/Exception.php';
         throw new Zend_Db_Statement_Exception($e->getMessage());
     }
 }
예제 #4
0
 protected function bindColumns()
 {
     if (!$this->columnsBound) {
         $this->columnsBound = true;
         $this->actRow = array();
         $this->actRowIndex = array();
         $count = $this->pdoStmt->columnCount();
         for ($i = 0; $i < $count; $i++) {
             $meta = $this->pdoStmt->getColumnMeta($i);
             if (array_key_exists('native_type', $meta) && $meta['native_type'] == 'BLOB') {
                 $this->pdoStmt->bindColumn($i + 1, $this->actRow[$meta['name']], \PDO::PARAM_LOB);
             } else {
                 $this->pdoStmt->bindColumn($i + 1, $this->actRow[$meta['name']]);
             }
             $this->actRowIndex[$i] =& $this->actRow[$meta['name']];
         }
     }
 }
예제 #5
0
 /**
  * Bind a column of the statement result set to a PHP variable.
  * Note: This method exists because pass-by-reference won't work with
  * call_user_func_array();
  *
  * @param string $column   Name the column in the result set, either by position
  *                         or by name. Note: if by name must match case.
  * @param mixed  $variable Reference to the PHP variable containing the value.
  * @param mixed  $type     OPTIONAL: PDO::PARAM_* Type hint.
  * @return bool            TRUE on success, FALSE on failure
  */
 public function bindColumn($column, &$variable, $type = null)
 {
     try {
         if (is_null($type)) {
             return $this->_stmt->bindColumn($column, $variable);
         } else {
             return $this->_stmt->bindColumn($column, $variable, $type);
         }
     } catch (PDOException $e) {
         throw new DBALite_Exception("Error binding column '{$column}' to PHP variable", $e);
     }
 }
예제 #6
0
 public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
 {
     switch ($type) {
         case PDO::PARAM_JSON:
         case PDO::PARAM_DATETIME:
         case PDO::PARAM_DATE:
         case PDO::PARAM_ARRAY:
             $this->setColumnType($column, $type);
             $this->_columnsVars[$column] =& $param;
             break;
         default:
             return $this->_statement->bindColumn($column, $param, $type, $maxlen, $driverdata);
     }
     return true;
 }
예제 #7
0
파일: View.php 프로젝트: nishimura/YokazeDb
    public function bind(PDOStatement $stmt, YokazeDb_Vo $vo)
    {
        $columnCount = $stmt->columnCount();
        $columnTypes = array();
        $columnNames = array();
        $VoNames     = array();
        for ($i = 0; $i < $columnCount; $i++){
            $meta = $stmt->getColumnMeta($i);
            if (!$meta)
                break;
            //if (isset($meta['pdo_type']))
                $columnTypes[$i] = $meta['pdo_type'];
            $columnNames[$i] = $meta['name'];
            $name = implode('', array_map('ucfirst', explode('_', $meta['name'])));
            $name[0] = strtolower($name[0]);
            $voNames[$i] = $name;
        }


        for($i = 0; $i < $columnCount; $i++){
            $name = $voNames[$i];
            $vo->$name = null;
            $stmt->bindColumn($columnNames[$i], $vo->$name, $columnTypes[$i]);
        }
    }
 /**
  * {@inheritdoc}
  */
 public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
 {
     return $this->statement->bindColumn($column, $param, $type, $maxlen, $driverdata);
 }
예제 #9
0
파일: Router.php 프로젝트: falmar/Epsilon
 /**
  * @param \PDOStatement $stmt
  * @param               $AppID
  * @param               $ComponentID
  * @param               $URL
  * @param               $MenuID
  */
 public function bindMenuValues($stmt, $AppID, $ComponentID, $URL, &$MenuID)
 {
     $stmt->bindValue(':AppID', $AppID, PDO::PARAM_STR);
     $stmt->bindValue(':ComponentID', $ComponentID, PDO::PARAM_STR);
     $stmt->bindValue(':URL', "%{$URL}", PDO::PARAM_STR);
     $stmt->bindColumn('MenuID', $MenuID, PDO::PARAM_INT);
 }
예제 #10
0
 private function bind(\PDOStatement $statement, $values)
 {
     $count = 1;
     foreach ($values as $value) {
         $statement->bindColumn($count, $value, \PDO::PARAM_STR, strlen($value));
     }
     return $statement;
 }
 /**
  * @param $column
  * @param $param
  * @param null $type
  * @param null $maxlen
  * @param null $driverdata
  * @return bool
  */
 public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
 {
     $archLog = array('method' => 'PDOStatement::bindColumn', 'input' => array('column' => $column, 'param' => $param, 'type' => $type, 'maxlen' => $maxlen, 'driverdata' => $driverdata), 'output' => $this->PDOStatement->bindColumn($column, $param, $type, $maxlen, $driverdata), 'pointer' => $this->assignPointerString());
     return self::setLogReturnOutput($archLog);
 }
 /**
  * @inheritdoc
  */
 public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
 {
     $this->params[$column] = $param;
     return parent::bindColumn($column, $param, $type, $maxlen, $driverdata);
 }