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


PHP ORM::_last_statement方法代码示例

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


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

示例1: _execute

 /**
  * Internal helper method for executing statments. Logs queries, and
  * stores statement object in ::_last_statment, accessible publicly
  * through ::get_last_statement()
  * @param string $query
  * @param array $parameters An array of parameters to be bound in to the query
  * @param string $connection_name Which connection to use
  * @return bool Response of PDOStatement::execute()
  */
 protected static function _execute($query, $parameters = array(), $connection_name = self::DEFAULT_CONNECTION)
 {
     self::_log_query($query, $parameters, $connection_name);
     $statement = self::$_db[$connection_name]->prepare($query);
     self::$_last_statement = $statement;
     return $statement->execute($parameters);
 }
开发者ID:mrsank,项目名称:work_sample,代码行数:16,代码来源:idiorm.php

示例2: _execute

 /**
  * Internal helper method for executing statments. Logs queries, and
  * stores statement object in ::_last_statment, accessible publicly
  * through ::get_last_statement()
  * @param string $query
  * @param array $parameters An array of parameters to be bound in to the query
  * @param string $connection_name Which connection to use
  * @return bool Response of PDOStatement::execute()
  */
 protected static function _execute($query, $parameters = array(), $connection_name = self::DEFAULT_CONNECTION)
 {
     $statement = self::get_db($connection_name)->prepare($query);
     self::$_last_statement = $statement;
     $time = microtime(true);
     foreach ($parameters as $key => &$param) {
         if (is_null($param)) {
             $type = PDO::PARAM_NULL;
         } else {
             if (is_bool($param)) {
                 $type = PDO::PARAM_BOOL;
             } else {
                 if (is_int($param)) {
                     $type = PDO::PARAM_INT;
                 } else {
                     $type = PDO::PARAM_STR;
                 }
             }
         }
         $statement->bindParam(is_int($key) ? ++$key : $key, $param, $type);
     }
     $q = $statement->execute();
     self::_log_query($query, $parameters, $connection_name, microtime(true) - $time);
     return $q;
 }
开发者ID:salvacam,项目名称:todo_list,代码行数:34,代码来源:idiorm.php

示例3: _execute

 /**
  * Internal helper method for executing statments. Logs queries, and
  * stores statement object in ::_last_statment, accessible publicly
  * through ::get_last_statement()
  * @param string $query
  * @param array $parameters An array of parameters to be bound in to the query
  * @param string $connection_name Which connection to use
  * @return bool Response of PDOStatement::execute()
  */
 protected static function _execute($query, $parameters = array(), $connection_name = self::DEFAULT_CONNECTION)
 {
     $statement = self::get_db($connection_name)->prepare($query);
     self::$_last_statement = $statement;
     $time = microtime(true);
     $count = count($parameters);
     for ($i = 0; $i < $count; $i++) {
         $type = PDO::PARAM_STR;
         if (is_null($parameters[$i])) {
             $type = PDO::PARAM_NULL;
         }
         if (is_bool($parameters[$i])) {
             $type = PDO::PARAM_BOOL;
         }
         if (is_int($parameters[$i])) {
             $type = PDO::PARAM_INT;
         }
         $statement->bindParam($i + 1, $parameters[$i], $type);
     }
     $q = $statement->execute();
     self::_log_query($query, $parameters, $connection_name, microtime(true) - $time);
     return $q;
 }
开发者ID:sindizaurs123,项目名称:framework,代码行数:32,代码来源:ORM.class.php


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