当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveRecord::connection方法代码示例

本文整理汇总了PHP中ActiveRecord::connection方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::connection方法的具体用法?PHP ActiveRecord::connection怎么用?PHP ActiveRecord::connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActiveRecord的用法示例。


在下文中一共展示了ActiveRecord::connection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ActiveRecord

 public function ActiveRecord($params = array())
 {
     $this->__class_name = $this->getClassName();
     $this->__table_name = Inflector::tabelize($this->__class_name);
     $this->__fields = ActiveRecord::connection()->getTableInfo($this->__table_name)->getFields();
     $this->__primary_key = current(array_filter($this->__fields, array($this, '__pk')));
     foreach ($params as $key => $value) {
         $this->{$key} = $value;
     }
 }
开发者ID:aurelian,项目名称:medick2,代码行数:10,代码来源:Base.php

示例2: execute

 public function execute()
 {
     // 1. create a statement
     $stmt = ActiveRecord::connection()->prepare($this->compile()->toSQL());
     $stmt->setLimit($this->limit);
     $stmt->setOffset($this->offset);
     // 2. reflect on owner
     $clazz = new ReflectionClass($this->owner);
     // 3. return stuff.
     if ($this->type == 'all') {
         return $stmt->getAllRecords($this->bindings, $clazz);
     } else {
         return $clazz->newInstance($stmt->executeQuery($this->bindings)->next()->getRow());
     }
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:15,代码来源:SQLBuilder.php

示例3: create_result_set

 /**
  * Creates a ResultSet from a QueryBuilder
  *
  * @return ResultSet
  */
 protected static function create_result_set(QueryBuilder $builder)
 {
     $timer = new MTimer();
     $stmt = ActiveRecord::connection()->prepareStatement($builder->compile()->getQueryString());
     $i = 1;
     foreach ($builder->getBindings() as $binding) {
         $stmt->set($i++, $binding);
     }
     if ($limit = $builder->getLimit()) {
         $stmt->setLimit($limit);
     }
     if ($offset = $builder->getOffset()) {
         $stmt->setOffset($offset);
     }
     $rs = $stmt->executeQuery();
     ActiveRecord::log($timer);
     $stmt->close();
     return $rs;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:24,代码来源:Base.php

示例4: create_result_set

 /**
  * Creates a ResultSet from a QueryBuilder
  *
  * @return ResultSet
  */
 protected static function create_result_set(QueryBuilder $builder)
 {
     $stmt = ActiveRecord::connection()->prepareStatement($builder->compile()->getQueryString());
     $i = 1;
     foreach ($builder->getBindings() as $binding) {
         $stmt->set($i++, $binding);
     }
     if ($limit = $builder->getLimit()) {
         $stmt->setLimit($limit);
     }
     if ($offset = $builder->getOffset()) {
         $stmt->setOffset($offset);
     }
     $rs = $stmt->executeQuery();
     Registry::get('__logger')->debug('Query: ' . ActiveRecord::$conn->lastQuery);
     $stmt->close();
     return $rs;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:23,代码来源:Base.php


注:本文中的ActiveRecord::connection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。